Adding page numbers to the text of links that lead to other parts of the PDF.

4 views
Skip to first unread message

Robert Rollins

unread,
Aug 24, 2022, 9:07:36 PMAug 24
to reportlab-users
I'm writing a program that builds the course catalog PDF for a large university. It clocks in at around 800 pages, so it's very hefty and complex as heck. And I now need to implement a feature that I'm not quite sure how to do.

This PDF is being generated from our new web-based Catalog, which has links from some pages to other pages. I've already developed a way to make those links clickable and lead to the targeted section of the PDF, but now I need to make these "references" usable for the printed PDF.

That means I need to add something like "(see Page 304)" to links that lead to anchors on Page 304, but I don't know which Page the link's target actually leads to in the PDF, at least not until the PDF has already been rendered. But adding those text bits could potentially make the PDF longer, and change those page numbers.

I know that the TableOfContents is designed to do this kind of thing, and I already use it. It's great, but it doesn't quite do this. It writes custom content into a specific part of the PDF, rather than editing various spots throughout the PDF.

Is there an existing plugin for ReportLab that will do something like this? If not, I should be able to develop something from scratch, but I just don't know if it's actually possible to do this "edit existing flowables as part of an IndexingFlowable processor" thing.

Do you folks have any advice?
Reply all
Reply to author
Forward
0 new messages