[reportlab-users] Reducing use of 7-bit characters

Robin Becker robin at reportlab.com
Tue May 5 09:05:48 EDT 2009


Yoann Roman wrote:

>>> This thread talks about optional tweaks to reduce RL's 7-bit use:

>>> http://tinyurl.com/cwea65

>>>

>> Switching between Ascii base 85 and Ascii base 64 probably wouldn't

>> matter much as both are ASCII. There are other encoding options but

>> also we might need to have less nice neat sub-80-character line

>> endings; we could fiddle forever.

>

> The base 85 streams aren't line wrapped in the output I'm getting. I actually

> tried playing with the line wrapping, and it didn't seem to do anything.

>

>> If we could determine exactly what causes the problem in a manner

>> ReportLab could reproduce in the lab, we could fiddle with things to

>> fix it. Do you know if it's just the attaching process (i.e. attach

>> then detach without even sending), if it needs an exchange server,

>> which Outlook versions demonstrate this etc?

>

> It depends on what you want to reproduce. I can reliably get Outlook 2003 to

> attach PDFs as quoted-printable, but I can't get the corruption to happen. The

>

> message definitely needs to be sent to get corrupted, and it only seems to be

> corrupt on the receiving end if (1) a mail server mangled the line endings

> or (2) the receiving end decodes with a different line ending than the

> original

> file had. The receiving end doesn't need to be an Exchange server (we don't

> use one and have a lot of problems with AOL recipients) nor does the recipient

>

> have to use Outlook (again, AOL users).

>

> I guess I'm just wondering how Acrobat encodes its streams differently to have

>

> a higher non-7-bit ratio and if there's an easy way to do the same thing in

> RL.

>

> Thanks,

>

We explicitly put some non-8 bit characters right at the front in a comment. eg

%PDF-1.3
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com

according to Andy that's some bit of shift-jis or something. I guess the ratio
here is pretty small.

Can you try an experiment and modify the code in pdfgen/pdfdoc.py (near line
853) that looks like

PDFHeader = (
"%PDF-1.3"+LINEEND+
"%\223\214\213\236 ReportLab Generated PDF document
http://www.reportlab.com"+LINEEND)

to increase the number of eight bit chars?
--
Robin Becker


More information about the reportlab-users mailing list