[reportlab-users] PDFPageLabels; not quite a patch yet, but getting there...

Robin Becker robin at reportlab.com
Tue Oct 9 11:11:05 EDT 2007


Thanks for the patch


Christian Jacobsen wrote:

> Hi,

>

> I needed to change the page numbering displayed by PDF viewers to

> match the 'physical' numbering used in my generated documents (which

> include roman numerals and have missing pages). This requires the use

> of PDFPageLabels which, when I wrote this code at least, was not

> supported by Reportlab. The attached code (which I believe I wrote

> against the PDF 1.4 spec), introduces the ability to use

> PDFPagelabels. More work would be required for it to become a properly

> integrated part of Reportlab, as it is currently a rather low level

> interface, and not what end users should really be using.


Sounds entirely reasonable.


>

> The code as it stands does work and can be used without patching a

> Reportlab install, ie put the attached code in with your own files,

> 'from PageLabels import *', and following the example code in the

> attachment should do the trick. A real patch would create some kind of

> interface (possibly) in PDFgen and (possibly) somewhere in platypus,

> which is easier to use than the PDFCatalogs. I haven't done this yet

> as I have not been using Reportlab for long, so I'm not sure how best

> to integrate this functionality. Any helpful suggestions would be

> welcome.

>


I'll take a look to see what this means. It seems kind of strange to allow
anything other than a low level interface set this kind of page label though.
Since we already have the physical page number, would some kind of call back be
usable so we get the possibility to set the page label based on the page number?


> Running the attachment ('python PageLabels.py') should produce a

> 'output.pdf' file which will demonstrate the effect of using

> PDFPageLabels.

>

>

>

> Finally a technical question. Is there a way to stop PDFCatalogs and

> PDFArrays from using references? The PDFPageLabels do not need to use

> references and can all be specified inline (this would save some space

> in the PDF, and make it easier to look at the generated output and

> compare it to examples in the PDF spec). It looks to me as if there is

> currently no way to specify that things should be done inline as

> opposed to using references? is that correct?

>

> Cheers,

........ I'm fairly sure you're right here. Many of the contents are dynamic and
only know after the event so I suspect the easy way out was taken and the
generic assumption of everything being delayed was taken.
--
Robin Becker


More information about the reportlab-users mailing list