Pdf Navigation from Table of contents

125

You can use Anchor and Link widgets from pdf/widgets.dart for internal navigation inside the generated PDF. Just create an Anchor on the page to which you want to navigate to. You need to provide a name parameter for it and it should be unique.

Anchor(name:'my_anchor', child: any_child_widget);

You can now refer to that anchor from another page using Link widget.

Link(destination:'my_anchor',child: any_child_widget);

You can enclose any child within the Anchor and Link widget.

Share:
125
Syam
Author by

Syam

Updated on December 28, 2022

Comments

  • Syam
    Syam over 1 year

    I am working on a flutter app which generates PDF files in flutter using pdf library.I need to create a pdf file which has a table of contents. They should be linked with the actual content and should navigate to their respective pages when clicked on it. I couldn't find any documentation online for doing this using the pdf library. The PDF is going to be written to a file so PDF Viewers in flutter are not useful for me either. Can someone please help me out

    can we use html code with dart like <a tag or something for internal navigation in PDF?