-----Original Message-----
From: Grzegorz Adam Hankiewicz [mailto:ghankiewicz@rastertech.es]
Sent: Wednesday, January 23, 2008 4:57 AM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] The preview print is not really
previewing what I get
Robin Dunn escribió:
> I think if you approach it a little differently, it might
work better
> for you. Instead of basing the drawing on the font size on each
> device, determine a scaling factor based on font size for just one
> device, and then base your drawing on that scaling factor
on both preview and print.
> Does that make sense?
Yes, as in the preview will never be what you print and maybe
I should rewrite everything with reportlab.
--
Rastertech España S.A.
Grzegorz Adam Hankiewicz
/Jefe de Producto TeraVial/
C/ Perfumería 21. Nave I. Polígono industrial La Mina 28770
Colmenar Viejo. Madrid (España)
Tel. +34 918 467 390 (Ext.17) *·* Fax +34
918 457 889
ghankiewicz@rastertech.es *·* www.rastertech.es
<http://www.rastertech.es/>
Reportlab rocks, but it's a pain to print a PDF with Python...at least on
Windows. However, it seems like you have to hack it no matter which
platform you're on.
What do you mean by “PDF printer”? If you mean something like PDFCreator - that installs like a regular Windows printer driver and creates a PDF out of whatever you print - then I can tell you it doesn’t solve any problems. In fact, in my experience the output to a PDF printer is as far different from printing straight-to-paper as the print preview is. If you mean some programmatic way to turn a PDF into ink-on-paper without opening Adobe or Foxit, please do tell!
Reportlab is by far the easiest, most consistent way (that I’ve found) to generate PDFs. I often need to print Avery labels or pre-printed forms, so I need to control exactly where each character goes on the page. I did it once (for one particular form) using the wx printing system… and unless I suddenly learn that I was missing something major, that’s a hassle I never want to go through again. In Reportlab you can build a table of absolute coordinates (like, for instance, the top left corner of each label on a page) and JUST FREAKIN’ PRINT! Same place every time! Change fonts if you want, the text doesn’t move! The one hassle is that the PDF then needs to be opened and printed in some other program; also, both Adobe and Foxit Readers default to “shrink to fit”, which needs to be turned off before printing. (
I.e., I already accounted for margins, but Adobe/Foxit assume that I printed all the way to the edge of the page.)
If I need to print some text and pictures on plain paper, I would use the wx printing system in a heartbeat. But if that text, or those pictures, had to be in the same spot on the page regardless of printer model or font, Reportlab is the way I’d go. I realize that I may be being unfair to wx; there may be tips and tricks I missed, and if so I’d love to hear them.
By the way, something I’ve wondered about for some time now - why is the page setup dialog in millimeters only, when nothing else in the printing system is? Is there some historical background there? It’s simple enough to divide by 25.4, but it’s always struck me as odd. I’m not asking for a change, just curious about the reason.
···
On Jan 23, 2008 7:19 AM, Stef Mientki s.mientki@ru.nl wrote:
Reportlab rocks, but it’s a pain to print a PDF with Python…at least on
Windows.
> Reportlab rocks, but it's a pain to print a PDF with Python...at
least on
> Windows.
So why not install a pdf printer ?
What do you mean by "PDF printer"? If you mean something like PDFCreator - that installs like a regular Windows printer driver and creates a PDF out of whatever you print - then I can tell you it doesn't solve any problems.
That's what I mean, I've quit good experience with it (outside Python),
but I see you need much higher accuracy than I expected.
cheers,
Stef
···
On Jan 23, 2008 7:19 AM, Stef Mientki <s.mientki@ru.nl > <mailto:s.mientki@ru.nl>> wrote:
In fact, in my experience the output to a PDF printer is as far different from printing straight-to-paper as the print preview is. If you mean some programmatic way to turn a PDF into ink-on-paper without opening Adobe or Foxit, please do tell!
Reportlab is by far the easiest, most _consistent_ way (that I've found) to generate PDFs. I often need to print Avery labels or pre-printed forms, so I need to control exactly where each character goes on the page. I did it once (for one particular form) using the wx printing system... and unless I suddenly learn that I was missing something major, that's a hassle I never want to go through again. In Reportlab you can build a table of _absolute_ coordinates (like, for instance, the top left corner of each label on a page) and JUST FREAKIN' PRINT! Same place every time! Change fonts if you want, the text doesn't move! The one hassle is that the PDF then needs to be opened and printed in some other program; also, both Adobe and Foxit Readers default to "shrink to fit", which needs to be turned off before printing. ( I.e., I already accounted for margins, but Adobe/Foxit assume that I printed all the way to the edge of the page.)
If I need to print some text and pictures on plain paper, I would use the wx printing system in a heartbeat. But if that text, or those pictures, had to be in the same spot on the page regardless of printer model or font, Reportlab is the way I'd go. I realize that I may be being unfair to wx; there may be tips and tricks I missed, and if so I'd love to hear them.
By the way, something I've wondered about for some time now - why is the page setup dialog in millimeters only, when nothing else in the printing system is? Is there some historical background there? It's simple enough to divide by 25.4, but it's always struck me as odd. I'm not asking for a change, just curious about the reason.
Don’t get me wrong - I love PDFCreator and use it all the time - printing receipts, invoices, etc. However, printing through the wx framework depends on which printer you’re using, and - behind the scenes - PDFCreator printing to letter-size PDF apparently “looks” very different than a physical printer actually printing on letter-size paper. At least that’s how I explain it to myself… anyway, if I get it lined up on paper it looks like hell in PDFCreator, and vice versa. Whereas printing through Reportlab gives reproducible results, because I’m printing to precise coordinates on the Platonic ideal of a sheet of letter-size paper…
To be fair, Reportlab ignores the messy business of dealing with real-life printers - that’s “somebody else’s problem”, in other words Adobe or Foxit. And I also understand that to wx, a printer is just an odd case of a device context; it’s not specialized for printing forms. That’s why it’s good to have more than one tool in the box.
···
On Jan 23, 2008 12:27 PM, Stef Mientki s.mientki@ru.nl wrote:
That’s what I mean, I’ve quit good experience with it (outside Python),
but I see you need much higher accuracy than I expected.
By the way, something I've wondered about for some time now - why is the page setup dialog in millimeters only, when nothing else in the printing system is? Is there some historical background there? It's simple enough to divide by 25.4, but it's always struck me as odd. I'm not asking for a change, just curious about the reason.
Probably simply because wx was born in Europe. There should be a way to switch it to inches, but I noticed a while back that it doesn't seem to work.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!