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

Yoann Roman yroman-reportlab at altalang.com
Tue May 5 12:12:09 EDT 2009

> These are just comments, so I go with Robin's suggestion: if a

> slightly longer 8-bit comment at the top fixes it, that's a

> low-risk change we can adopt easily.

I tried this out, increasing the 8-bit comment so that the ratio of the
RL document was under Acrobat's 81%. Unfortunately, that didn't seem to
do anything. I did get Outlook to switch to base64 when the comment got
the 7-bit characters down to 76%, but it was ridiculously long at that

There seems to be more to Outlook's encoding decision than just the
ratio. I came up with 2 other possible approaches:

1. Add a flag to use just LF as LINEEND. Outlook decides to encode all
newlines when it doesn't see CR + LF. I *believe* the non-encoded
newlines are the problem in the first place.

2. Add a flag to disable Ascii 85 encoding. That causes the 7-bit ratio
to drop way below what Acrobat even had, partly because RL doesn't
have the XML metatdata at the end. As a side benefit, the file size
also drops.

I made a first pass at #2. It was pretty easy to implement and did the
trick for Outlook. Before I spend any more time on this, is there a
reason for the A85 encoding? If not, is there a patch already out there
to disable this?


Yoann Roman

More information about the reportlab-users mailing list