[reportlab-users] deterministic output?

Andy Robinson andy at reportlab.com
Thu Nov 1 03:31:34 EDT 2018


It's designed for exactly what you want; we added it so we could write
regression tests many years ago.

The PDF file structure contains, among other things, the time the
document was created.  It can also contains hashes and encodings of
various parts of the content, and tables with byte offsets to other
structures in the file.   So, if you run the same 'hello world' script
twice, you can end up with significant differences between the files.
  In 'invariant' mode we turn these things off and use a dummy
constant timestamp, so the same script should produce identical files.

- Andy

On 1 November 2018 at 01:43, Chris Jerdonek <chris.jerdonek at gmail.com> wrote:
> Thanks, Robin. I tried a PDF with tables, and it doesn't seem to be
> deterministic unless I use RL_invariant=1. What does this variable do,
> and does it affect anything else?
>
> --Chris
> On Wed, Oct 31, 2018 at 10:09 AM Robin Becker <robin at reportlab.com> wrote:
>>
>>
>> We have done quite a lot of work to make the output deterministic, but probably you need to test the effect of environment
>> variable RL_invariant=1. However I think there has been a recent change to python 3.x to make dictionaries more random which might
>> make things harder.
>>
>>
>> On 31/10/2018 16:43, Chris Jerdonek wrote:
>> > Hi,
>> >
>> > I'm planning to write some tests of code that uses ReportLab to
>> > generate some PDFs. My question is--
>> >
>> > To what extent is ReportLab's PDF generation deterministic? For
>> > example, will the output files be the same byte-for-byte if I generate
>> > the PDF's on different platforms -- provided that the version of
>> > ReportLab is the same? Are there any known gotchas?
>> >
>> > Thanks,
>> > --Chris
>> > _______________________________________________
>> > reportlab-users mailing list
>> > reportlab-users at lists2.reportlab.com
>> > https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>> >
>>
>>
>> --
>> Robin Becker
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users



-- 
Andy Robinson
Managing Director, ReportLab
Wimbletech Zone 2
35 Wimbledon Hill Road
London SW19 7NB, UK
Tel +44-20-8191-7277


More information about the reportlab-users mailing list