[reportlab-users] PDFs generated by ReportLab not printing

King Simon-NFHD78 simon.king at motorola.com
Fri May 22 09:55:20 EDT 2009

> -----Original Message-----

> From: reportlab-users-bounces at reportlab.com

> [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of

> King Simon-NFHD78

> Sent: 22 May 2009 13:22

> To: Support list for users of Reportlab software

> Subject: Re: [reportlab-users] PDFs generated by ReportLab

> not printing


> I think I've got closer anyway - I stripped out everything except the

> document headers and footers and the disclaimer, and the problem still

> occurred. Then I changed one of the fonts from "Arial Unicode MS" to

> "Times-Roman", and the problem went away. So now it looks like the

> problem is related to the embedding of that font.


> Hopefully with that knowledge I can make a standalone test script that

> demonstrates the problem.


OK - the following script generates a PDF file that (for me at least)
does not print on my Postscript printer:

from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
pdfmetrics.registerFont(TTFont('Arial Unicode MS', 'ARIALUNI.ttf'))

c = canvas.Canvas('arialtest.pdf')
c.setFont('Arial Unicode MS', 32)
c.drawString(10, 150, u"Some text in Arial Unicode MS")

I'm still not completely sure what the problem is. If I try to convert
the PDF file to PostScript using acroread -toPostScript on Linux,
nothing gets generated and there is no error message. If I use Acrobat
Reader on Windows and Print to file, it displays an error message ("The
document could not be printed", sometimes followed by "A drawing error
occurred"), but it does generate a postscript file. If I then try to
convert that postscript file to PDF using ps2pdf, I get the following
error message:

%%[ ProductName: GNU Ghostscript ]%%
%%[Page: 1]%%
%%[ Error: invalidrestore; OffendingCommand: restore ]%%
GNU Ghostscript 7.05: Unrecoverable error, exit code 1

However, I have a feeling that the postscript file that I am processing
at that point is not really my original document, but a different
document displaying the original error message. If I look at the
Postscript file, it contains the following lines:

userdict begin/PrtVMMsg{vmstatus exch sub exch pop gt{[^M
(This job requires more memory than is available in this printer.)100
(Try one or more of the following, and then print again:)100 485^M
(For the output format, choose Optimize For Portability.)115 470^M
(In the Device Settings page, make sure the Available PostScript Memory
is accurate.)^M
115 455(Reduce the number of fonts in the document.)115 440^M
(Print the document in parts.)115 425 12/Times-Roman showpage^M
(%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def
version cvi 2016 ge{/VM?{pop}bind def}{/VM? userdict/PrtVMMsg get
105000 VM?^M

Not knowing anything about Postscript, I'm not sure whether those are
generic error messages, or whether they are actually an accurate
description of the problem with the PDF file.

I also don't know whether the problems are related to the printer driver
itself (I'm using an HP Colour LaserJet 8500 PS, printing to a samba
print queue).

I'm not sure where I should be looking next to get this to work. Any
suggestions would be much appreciated.

Thanks again,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: arialtest.pdf
Type: application/octet-stream
Size: 50066 bytes
Desc: arialtest.pdf
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20090522/a7e9fbf6/attachment-0001.obj>

More information about the reportlab-users mailing list