Export\Import annotations

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

costea
User
Posts: 14
Joined: Mon Sep 09, 2013 6:51 am

Export\Import annotations

Post by costea »

Hello,
Tell me please if it is possible to export/import annotations programmatically without dialog (ExportAnnots function). If not in ActiveX SDK (C#), maybe it is possible to do this in SDK PRO or Simple SDK?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Export\Import annotations

Post by Stefan - PDF-XChange »

Hello costea,

You should be able to achieve this using the exportAsFDF, exportAsXFDF JS methods to export the annotations data, and then use the respective importAnFDF, importAnXFDF methods to load the same annotation data in another file.

Regards,
Stefan
costea
User
Posts: 14
Joined: Mon Sep 09, 2013 6:51 am

Re: Export\Import annotations

Post by costea »

Hello,

Thank you for the response. I have another question, is it possible to remove all annotations from a document from the code behind?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Export\Import annotations

Post by Stefan - PDF-XChange »

Hi costea,

Yes once again - using JS.
Here's a sample code that removes all FreeText annotations from the first page of a file:

Code: Select all

var annots = this.getAnnots({ nPage:0 }); 
for (var i = 0; i < annots.length; i++) 
  if (annots[i].type == "FreeText") annots[i].destroy();
Regards,
Stefan
costea
User
Posts: 14
Joined: Mon Sep 09, 2013 6:51 am

Re: Export\Import annotations

Post by costea »

Thank you Stefan, it works.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Export\Import annotations

Post by Stefan - PDF-XChange »

You are welcome costea! :)

Cheers,
Stefan