简体   繁体   中英

How to create an internal link in ReportLab Python?

I want to create a button inside a PDF with 20 pages, in such way that, if I click on the button in page 5, the PDF goes to page 8. I can't find this reference or code examples at the ReportLab documentation.

Reportlab support internal paragraph markups, such as

<link destination="end" >Go to the end (go to document internal destination)</link>
<link destination="start" color="cyan">Go to the beginning</link>

<setLink destination="start" color="magenta">This is the document start
  (define document destination inside paragraph, color is optional)</setLink>

For the graphical elements, you may find this post useful, this is the best I could find. There are support for Form elements with canvas.acroform.checkbox within which you can find Field Flag Tokens and values with the value 'pushButton' but I cannot find how to link this with internal destination. It seems you need to draw the buttons yourself.

In addition to above, you have of course the TOC functionality but that is linked content collected together.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM