Annotations are used for interactive elements inside PDF files such as external hyperlinks, links to other pages, popups, text highlights, audio/video, or other types of mark up added to page content.
Annotations should not be considered part of the page content itself. Instead, they are elements that sit on top of the page. Many PDF viewers typically allow you add, modify or remove annotations.
Some types of annotations are interactive and may interact with the viewer itself, for example by navigating to another page in the document, changing the current zoom level, or by opening a popup.
In BuildVu, we have chosen to generate annotations inside a file called annotations.json. We see this as the most extensible solution, allowing you to choose which annotation types to support, define your own implementation, easily add or remove annotations, and build custom functionality around the converted content.
In a future release we may add a setting to hard-code some annotation types within the page content itself. This is a request we sometimes get from users looking for the simplest possible off-the-shelf solution. Please let us know if this interests you and we will let you know if/when this feature gets added.
Annotations are supported inside the IDRViewer as long as the document is loaded from a web server. For security reasons, web browsers prevent the
annotations.json file being loaded from the local file system. Learn more:
- Chromium Issue 40787: Local files doesn’t load with Ajax
- MDN Web Docs: Local File Security in Firefox 68
We provide a simple implementation for loading and displaying annotations which is used inside the IDRViewer. You are welcome to use this implementation as-provided, for inspiration, or as the basis of your own custom solution.
You can find more information about the structure of the annotations.json file here:
Please let us know if you have any questions and we will be happy to answer them.
Have more questions? Ask us on Discord