External Button for Saving Annotations

94 views
Skip to first unread message

Matt Parizeau

unread,
Jul 30, 2013, 3:37:57 PM7/30/13
to pdfnet-w...@googlegroups.com
Q:

I would like to add a button outside the viewer and when the user clicks on it the annotations should be exported to xfdf.

A:

To add a button outside the viewer you could do something like the following in html:
<div>
    
<label>Annotations:</label>
    
<input type="button" id="exportAnnotationsButton" value="Export Annotations (as XFDF)"/>
</div>

And then in JavaScript have:
$('#exportAnnotationsButton').click(function() {
    
var iframeWindow = $('#viewer').find('iframe')[0].contentWindow;
    
// if you want to get the xfdf string yourself and do something with it then run this
    
var annotationManager = iframeWindow.readerControl.docViewer.GetAnnotationManager();
    
var xfdfString = annotationManager.SaveAnnotations();

    
// if you want to run the logic for saving annotations that is in ReaderControl then do this
    
// iframeWindow.readerControl.saveAnnotations();
});

Reply all
Reply to author
Forward
0 new messages