Page 1 of 1

Will TRichViewEdit.TableOfContents links work when converted to a PDF?

Posted: Mon Oct 02, 2023 2:00 am
by jimmaguire
I use IIPDFLib to create PDF's and wonder if internal links (bookmarks?) will work in a PDF?

Re: Will TRichViewEdit.TableOfContents links work when converted to a PDF?

Posted: Mon Oct 02, 2023 9:49 am
by Sergey Tkachenko
Yes, they work.

The demo in <TRichView Dir>\ThirdParty\Export\LLPDFLib\Demos\RV2PDF\ includes code to export external links.

The process is the following.
RVPrint1DrawCheckpoint is called when a checkpointed item is drawn. In this event, we store coordinates of a checkpoint.
RVPrint1DrawHyperlink is called when a hyperlink is drawn. In this event, if this is a link to a checkpoint, we store coordinates of a link.
At the end of PDF generation, the method SaveLinksToCheckpoints is called. It uses stored coordinates of internal links and checkpoints to add these links to PDF.

Besides, there is an advanced demo: https://www.trichview.com/forums/viewtopic.php?t=11002
It adds a table of contents to PDF (not inside a document, but as PDF outline tree (that can be displayed at the left side).

Re: Will TRichViewEdit.TableOfContents links work when converted to a PDF?

Posted: Tue Oct 03, 2023 10:45 pm
by jimmaguire
Just what I wanted! Thanks!