stephanrauh / ngx-extended-pdf-viewer

A full-blown PDF viewer for Angular 16, 17, and beyond
https://pdfviewer.net
Apache License 2.0
450 stars 167 forks source link

Export Annotation Object #2328

Closed balabk57 closed 1 month ago

balabk57 commented 1 month ago

I like to export the annotation object when user draws on the page. currently there is three events annotationLayerRendered, annotationEditorModeChanged, annotationEditorEvent where from that i am not able to export annotation, is it like am missing out or there is no possible way to export annotation object ?

stephanrauh commented 1 month ago

If you want to get the entire PDF file including the annotations, await this.pdfViewerService.getCurrentDocumentAsBlob() is your friend: https://pdfviewer.net/extended-pdf-viewer/export-file

If you want to get the raw editor annotations, use this.pdfViewerService.getSerializedAnnotations(). However, this is a low-level API of pdf.js. It may change at any point of time. That's why I've documented it so poorly. You can use it as long as you're aware of the risk.