Page 1 of 1
Printing Units
Posted: Sat Sep 28, 2013 12:08 pm
by ClueLess
Hi
Couldn't find either in the manual nor the forums the indication of the units using to print:
Font Size
Text and Image Positioning
Image Size
Can some one tell me which are the units used for those three items?
ThankYou
Re: Printing Units
Posted: Sat Sep 28, 2013 4:37 pm
by Tenaja
The sad reality is that PB does not have printer support. You really have to be familiar with the API to do it properly. This will get you started if you use Windows:
http://www.purebasic.fr/english/viewtop ... 27&t=43348
Re: Printing Units
Posted: Sat Sep 28, 2013 5:56 pm
by ClueLess
Did not see much help in the post. But... Where Can I get the Printerb Lib mentioned? Do you know?
Thanks
Re: Printing Units
Posted: Sat Sep 28, 2013 6:05 pm
by blueb
ClueLess wrote:Did not see much help in the post. But... Where Can I get the Printerb Lib mentioned? Do you know?
Thanks
http://www.purebasicpower.de/
Re: Printing Units
Posted: Sat Sep 28, 2013 6:07 pm
by BorisTheOld
Tenaja wrote:The sad reality is that PB does not have printer support.
That's not entirely true.
Although not perfect, PB's printer support, in conjunction with the 2D library, is very versatile.
The only thing missing is a good interface with printer hardware. But this is easy to overcome without having to use OS API features.
@ClueLess
Pixels are the unit of choice.
Use the features of the 2D library to calculate text sizes and positions. But be aware of the dot pitch of the printers you are using. You will need to factor the dot pitch into the size and position calculations. This means that you will usually need a larger font size for printing compared to displaying text on a screen.
Run a few tests of different font sizes to see which fonts best suit your application.
Re: Printing Units
Posted: Sun Sep 29, 2013 3:33 pm
by Lothar Schirm
You can find an example how to print text or tables here:
http://forums.purebasic.com/german/view ... 352743646b
The example is written in pure PureBasic without WinAPI and should run on printers with any resolution. "PrintText(text)" prints a line of text and goes automatically to the next line and also to the next page, if the current page is full. If you use a font with fixed width (e.g. Courier New), you can easily print tables using RSet() or LSet() for substrings within the text line.
Re: Printing Units
Posted: Sun Sep 29, 2013 4:59 pm
by blueb
Thanks Lothar
Thanks for the procedure, it seems very handy, I will check it out.

Re: Printing Units
Posted: Sun Sep 29, 2013 9:10 pm
by davido
Hi Lothar,
Excellent!
Very nice. Thank you very much for sharing.
