Foxit PDF SDK for Web 6.2

How to save and manipulate your sound annotations in Foxit PDF SDK for Web

From Foxit PDF SDK for Web 6.2, we’ve provided you with the possibility of create sound recordings and annotate your PDF with them.

This article will show you how to easily get your sound annotation content and manipulate it as you like.

Understanding the Pattern subclass

We’ve created the ‘Pattern’ subclass within the Annot class so you are able to identify the annotation to retrieve its content. Specifically for the sound annotations, the first thing you need to do is get the value of “subType” within the pattern. You can do that by calling the subclass in the console as below:

You can see that the “SOUND” Pattern has a subType value “Sound”.

Retrieving the annotation using getAnnotsByType

Once a sound annotation is created, it is stored inside the browser’s session storage. We’ve created the getAnnotsByType function to allow you to select and get your annotations by type and choose a specific page if you wish to.

Function description:
WebPDF.ViewerInstance.getAnnotsByType(pattern, start, end)

pattern: The Pattern subclass, as we’ve explained in the ‘Understanding the Pattern subclass’ section

start: The first page to search for annotation

end: The last page to search for annotation

Retrieving sound data from pages

You may choose to omit the ‘start’ and ‘end’ parameters and get the annotations from all pages in the document. See the image below:

You can see that the function returns the amount of sound annotations in the document, and annotJSONData returns an ID and the binary object containing the data. You may copy the blob and paste into your URL to hear your annotation separately as seen below:

And that’s it, from now on you can choose what to do with your sound annotations: start a record label, write an audiobook, send notes to your students, colleagues. Have fun!

Updated on December 13, 2018

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: