CD Print And Preview
Posted: Sat Feb 04, 2017 8:27 am
Hi All
After learning a little more about PB and printing decided to recreate the print and preview module.
I needed a couple of things.
1. The ability to print in landscape and\or portrait depending on what I wish to print and whatever the user selects from the print requester on a page by page basis.
2. The ability to print whatever on whatever the user selected.
3. To give the user the ability to choose which pages to print after a preview or not.
This new module is based on the printrequester() and after selection the printer information is stored and is available in the main programme.
New pages are added as required with a flag to indicate the required orientation of the printed page.
Vector drawing commands are used throughout to do the actual printing to maintain quality.
This works by creating a Printjob directory and file, then each command used to print is stored in the file. After all print operations are complete the user is shown a preview of the print if selected when opening the print job. On the preview window is a Print button. Clicking this displays the Print Which pages dialog where All pages can be selected or a range entered or a list of individual pages can be entered. Clicking the Ok button will then print the selected pages.
Opening a print job with no preview does exactly the same but no preview window is displayed and the module runs straight into the print which pages dialog.
The test programme in cluded simply prints three pages. Page 1 a box and a line, Page 2 some text and Page 3 an image. To test run the programme select your printer and print. Whichever orientation you choose on the printer the output will be the same this is deliberate. The chosen orientation is only used for the preview window and shows how the pages will be printed.
All native Purebasic commands used throughout just need a little help getting the printer info for all operating systems, Windows is done.
The code and test programme can be found here:-https://github.com/collectordave/PureBa ... nd-Preview
If anyone can test and suggest improvements at this stage I will be gratefull.
I will be adding more commands as I go along and develop some little test programmes such as printing a text file, grids or photos.
Update: 6 Feb 2017
Courtesy of infratec there is now a single file which holds the module and a simple test programme so rather than visiting github to download it all you can download the single file from dropbox herehttps://www.dropbox.com/s/m42wkcmk0s7o3 ... er.pb?dl=0
Update: 10 Feb 2017
In some circumstances printing images could get a little confused depedant on the calling programme. All image printing routines now updated.
Small PDF manual now part of the download. Also available here :- https://www.dropbox.com/s/b3lbilsp10fd5 ... t.pdf?dl=0 If anyone can offer suggestions for improvement they will be gratefully recieved.
Kind Regards
cd
After learning a little more about PB and printing decided to recreate the print and preview module.
I needed a couple of things.
1. The ability to print in landscape and\or portrait depending on what I wish to print and whatever the user selects from the print requester on a page by page basis.
2. The ability to print whatever on whatever the user selected.
3. To give the user the ability to choose which pages to print after a preview or not.
This new module is based on the printrequester() and after selection the printer information is stored and is available in the main programme.
New pages are added as required with a flag to indicate the required orientation of the printed page.
Vector drawing commands are used throughout to do the actual printing to maintain quality.
This works by creating a Printjob directory and file, then each command used to print is stored in the file. After all print operations are complete the user is shown a preview of the print if selected when opening the print job. On the preview window is a Print button. Clicking this displays the Print Which pages dialog where All pages can be selected or a range entered or a list of individual pages can be entered. Clicking the Ok button will then print the selected pages.
Opening a print job with no preview does exactly the same but no preview window is displayed and the module runs straight into the print which pages dialog.
The test programme in cluded simply prints three pages. Page 1 a box and a line, Page 2 some text and Page 3 an image. To test run the programme select your printer and print. Whichever orientation you choose on the printer the output will be the same this is deliberate. The chosen orientation is only used for the preview window and shows how the pages will be printed.
All native Purebasic commands used throughout just need a little help getting the printer info for all operating systems, Windows is done.
The code and test programme can be found here:-https://github.com/collectordave/PureBa ... nd-Preview
If anyone can test and suggest improvements at this stage I will be gratefull.
I will be adding more commands as I go along and develop some little test programmes such as printing a text file, grids or photos.
Update: 6 Feb 2017
Courtesy of infratec there is now a single file which holds the module and a simple test programme so rather than visiting github to download it all you can download the single file from dropbox herehttps://www.dropbox.com/s/m42wkcmk0s7o3 ... er.pb?dl=0
Update: 10 Feb 2017
In some circumstances printing images could get a little confused depedant on the calling programme. All image printing routines now updated.
Small PDF manual now part of the download. Also available here :- https://www.dropbox.com/s/b3lbilsp10fd5 ... t.pdf?dl=0 If anyone can offer suggestions for improvement they will be gratefully recieved.
Kind Regards
cd