[reportlab-users] Emailing Corrupting reportlab PDFs follow up

Matej Pivoluska reportlab-users@reportlab.com
Wed, 26 May 2004 11:39:24 +0200


D=F2a Utorok 25 M=E1j 2004 14:20 postmaster@binarystar.org nap=EDsal(a):
> Hi Robin,
>
> thank you for taking the time to follow this up ... here are the facts so
> far.
>
> a. Using python 2.3 and reportlab 1.19, windows
>
> b. When generating a PDF file and sending it as an attachment in outlook (
> both manually attaching the file and using outlooks COM interface, the
> recipients PDF reader ( most likely Adobe ) claims the document is
> corrupt. This does not seem to affect PDF files generated from other
> programs
>
> c. It seems to affect only people who use a web based mail client or lotus
> notes etc ie. other outlook recipients seem not to be affected
>

In corrupt_file.pdf are lines ended just with LF. In working_file.pdf they =
are=20
ended with CR LF. And these files are "Plain-text" and not comprimmed by=20
default (I do not know any other program/library for generating pdf files=20
that do this by default).

The lineends could be converted at web-mail clients... It is easy to say wh=
ere=20
is the bug. (damaged xref table -- xpdf can reconstruct it and open=20
corrupted_file.pdf correctly)=20

But it is harder to say how to correct this bug. Do you set correct mime-ty=
pe=20
for pdf -- application/pdf? Do you open the pdf file with "binary" flag?

Try to enable compression in reportlab as workaround, or send it as a zip=20
archive.

> d. There seems to be a small discrepency between file sizes ... I have run
> diff in JEdit but can not see the discrepency at this stage
>
> e. If I open the corrupt file in wordpad ( windows ) and then resave it it
> then opens fine

WordPad probably converts line ends back to Windows CR LF.

> I have attached the files for you to examine
>
> hopefully I have provided enough information
>
>
> thanks again
>
> Ben Catanzariti


mP
=2D-=20
http://pivoluska.matfyz.cz/weblog