[reportlab-users] [PATCH] Optional use of A85 encoding

Robin Becker robin at reportlab.com
Tue Apr 6 08:47:09 EDT 2010


On 01/04/2010 21:01, Yoann Roman wrote:

> This is a follow-up to the following thread:

> http://two.pairlist.net/pipermail/reportlab-users/2009-May/008239.html

>

> Please find attached a patch that optionally disables the use of A85

> encoding. By default, the option is set so that RL behaves exactly as

> it does now. However, when the use of A85 encoding is disabled by

> setting rl_config.useA85 to 0, streams aren't passed through that

> encoding throughout the code. This resolves the issue I was having with

> PDFs not being "binary enough" to trigger Outlook's base64 encoding,

> resulting in mangled PDFs by misbehaving MTAs.

>

> I ran the full tests prior to the patch and compared the results with

> those after the patch was applied with A85 encoding still enabled. I

> didn't see any differences, but I can't claim I did an exhaustive

> comparison since a lot of the tests include instance IDs or random text

> blocks.

>

> I also ran the full tests with A85 encoding disabled, and they all

> passed. I then checked that all 3 documentation PDFs opened correctly

> in Acrobat 9, looked "identical" to the pre-patch versions, and didn't

> contain any A85 filter references.

>

> One area I'm not certain about is image caching. I never got it to kick

> off, even with rl_config.defaultImageCaching set to 1. Looking at the

> code, I see that gets copied to Canvas's imageCaching attribute, but

> that attribute never gets used. Is the caching code still used? Is it

> covered by the tests? To be save, when A85 encoding is disabled, I

> opt'ed to output cached files unencoded and with a .bin extension.

>

> Any chance this could be included in trunk relatively quickly?

>

> Thanks,

>

..........

I've put this in pretty much as is. I think I switched out some places where
conditional expressions were used as they might be too modern for some.

The image caching was really all about a long time ago when it was useful to be
able to create images in a85 format up front and then deploy to machines which
might not have PIL etc etc. Also not sure about using the .bin extension (if
that code ever gets used). Probably we ought to abandon the idea of using caching.

It seems to run for me in both modes as well, but faster without a85.
--
Robin Becker


More information about the reportlab-users mailing list