I need to create a link (annotation) creation tool on top of PDFTron
PDF viewer similar to the one in Acrobat Pro. Is this possible using
PDFTron PDFNet? Could you please provide some sample code?
Yes, using PDFNet you can implement interactive link creation tools and
other types of interactive tools available in Acrobat Professional.
The following is the sample project illustrating how you could
implement 'link creation tool' using the current PDFNet API:
sample can be used to create new link annotations (e.g. hyperlinks and
goto actions) in existing PDF documents and can be used as a template
for other types of extensions to the PDFView control.
Please note that this is not a completely finished application (e.g.
the link tool icon is a pencil which is not very intuitive. You may
also want to perform additional link validation, or to create
appearance streams, or to give links non-default appearances, etc.),
but it clearly shows how you could create new links and other
To test the sample please follow these steps:
- extract the archive in 'PDFNet/Samples' folder
- open the project located under 'PDFNet/Samples/PDFViewCreateLinks'
and run the project.
- open any PDF document
- select pencil tool to create new links
- draw a link rectangle and then release the mouse
- in link create box, enter the hyperlink (for URL links) or a page
number (for 'goto' actions). In case of 'goto' page links, please keep
in mind that page numbers start from 1.
- click Ok.
- repeat the above steps to add new links. The project could be
extended to keep the above links highlighted for further editing (e.g.
moving, resizing, etc), but for now the old link will be hidden.
- Save the PDF document.
- Open the new PDF document in Acrobat. You will notice that new link
annotations are present and active.