Printing Units

Just starting out? Need help? Post your questions and find answers here.
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Printing Units

Post 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
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Printing Units

Post 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
ClueLess
Enthusiast
Enthusiast
Posts: 360
Joined: Sun Jan 11, 2009 1:04 am

Re: Printing Units

Post by ClueLess »

Did not see much help in the post. But... Where Can I get the Printerb Lib mentioned? Do you know?

Thanks
User avatar
blueb
Addict
Addict
Posts: 1125
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Printing Units

Post 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/
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Printing Units

Post 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.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
Lothar Schirm
User
User
Posts: 54
Joined: Mon Nov 26, 2012 4:57 pm

Re: Printing Units

Post 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.
User avatar
blueb
Addict
Addict
Posts: 1125
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Printing Units

Post by blueb »

Thanks Lothar
Thanks for the procedure, it seems very handy, I will check it out. :)
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Printing Units

Post by davido »

Hi Lothar,

Excellent!
Very nice. Thank you very much for sharing. :D
DE AA EB
Post Reply