Export/Save just form fields or annotations

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Export/Save just form fields or annotations

Post by coblejesse » Wed May 22, 2019 4:53 pm

Hi Tracker,

I'd like to run a scenario by you and see if this is possible. A user creates a document in Word or other text editor software that has all their annotations on it and that gets converted to pdf. That is then loaded into the PDF-XChange Editor SDK in our software by the user, and they add form fields to it. That then gets saved as a pdf blob in our db. Lets then say they want to change some of the annotations to that pdf back in their text editor software but they want to retain those form fields they had added to the pdf. The only way I know how they would be able to make changes to those annotations, would be to go back to their original text editor document, make changes to it, convert to pdf, then load into the SDK. But, they would lose all the form fields they had added on before.

My questions is, is there some way I can separate the annotations pdf that came from their text editor software, from the form fields they added to it, and save both to our db separately, and then merge them two whenever they open the document? And if they wanted to make changes to the annotations document, they would go back to the text editor, make changes, convert to pdf, and load that back up into the SDK, and then be able to load the separated form fields from the db, onto the new annotations pdf? This way they don't lose the form fields every time they make changes to the annotations pdf?

If I'm thinking about this wrong, or you have a better suggestion, that would be great as well!

This is my attempt at it, but to no avail.

Code: Select all

 PDFXEdit.IPXV_Inst ipxvInst = pdfCtl.Inst;

 int nID = ipxvInst.Str2ID("op.document.exportCommentsAndFields");
 PDFXEdit.IOperation pOp = ipxvInst.CreateOp(nID);


 PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
 input.v = pdfCtl.Doc;

 PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName(tDestToSave.Text);
 PDFXEdit.ICabNode output = pOp.Params.Root["Output"];
 output.v = destPath;
 PDFXEdit.ICabNode options = pOp.Params.Root["Options"];
 options["ExportAnnots"].v = false;
 options["ExportFields"].v = true;
 options["DestFile"].v = destPath;
 pOp.Do();
Thanks,
Jesse

User avatar
Sasha - Tracker Dev Team
User
Posts: 4211
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Export/Save just form fields or annotations

Post by Sasha - Tracker Dev Team » Thu May 23, 2019 2:42 pm

Hello Jesse,

The export/import fields and comments operation should work for you in this case. Whenever you are saving the document in the db, you will have to save the fields from it. When the document is changed from the Word and converted to the pdf, you can use your file from the db to import fields from it and update the document.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Re: Export/Save just form fields or annotations

Post by coblejesse » Fri May 24, 2019 8:26 pm

Hi Alex,

I just tried exporting the annotations separately from the form fields and it does work for taking off the form fields, leaving the annotations, but does not leave the form fields only when trying export those.

Here is an export done manually with form fields taken off and works fine:

Image

Image

And here is where it should be only form fields, but the annotations stay:

Image

Image

How do I get it so the form fields are exported only?

Thanks,
Jesse

User avatar
Sasha - Tracker Dev Team
User
Posts: 4211
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Export/Save just form fields or annotations

Post by Sasha - Tracker Dev Team » Mon May 27, 2019 7:26 am

Hello Jesse,

Sadly, I cannot see the attached images. Please attach them to the post so that we can assist further.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Re: Export/Save just form fields or annotations

Post by coblejesse » Mon May 27, 2019 12:47 pm

Sorry about that, here they are.
Attachments
2019-05-24 16_23_28-_Form_FieldsAndAnotaions.png
2019-05-24 16_23_28-_Form_FieldsAndAnotaions.png (9.16 KiB) Viewed 248 times
2019-05-24 16_22_55-_No_Form_Fields.png
2019-05-24 16_22_55-_No_Form_Fields.png (10.54 KiB) Viewed 248 times
2019-05-24 16_16_47-AnnotationsOnly.png
2019-05-24 16_12_27-FormFieldsOnly.png

User avatar
Sasha - Tracker Dev Team
User
Posts: 4211
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Export/Save just form fields or annotations

Post by Sasha - Tracker Dev Team » Tue May 28, 2019 6:22 am

Hello Jesse,

Just to clarify - the End-User Editor does everything correctly but you can't manage to do that via the code?

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Re: Export/Save just form fields or annotations

Post by coblejesse » Tue May 28, 2019 3:13 pm

Hi Alex,

Actually no, I can't get it to work correctly in the end user-editor. After thinking about this some more, maybe I'm wording some this incorrectly and don't actually know exactly what the annotations are, and am using these in the wrong context. I'll try to explain more fully. In the pictures I previously supplied, I show that I was using the Export pages screen. One shows that I had Comments: Do Not Copy, Form Fields: Copy, and Bookmarks: Do Not Copy selected. What I am trying to do with this is to Extract only the form fields and absolutely nothing else, but yet the text that was (behind the form fields) was also exported. The process was this, I opened a pdf that was created in word, in the end user-editor, added some form fields to it, then tried to do the Export Pages with Comments: Do Not Copy, Form Fields: Copy, and Bookmarks: Do Not Copy selected, and the form fields were exported, but so was the pdf that was created in word. I only want the form fields that were added on top of it, extracted. I hope this explains it a little better.

Thanks,
Jesse

User avatar
Sasha - Tracker Dev Team
User
Posts: 4211
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Export/Save just form fields or annotations

Post by Sasha - Tracker Dev Team » Wed May 29, 2019 2:36 pm

Hello Jesse,

Why are you using the Export Pages feature? What it does is exports the pages with their content and also with the additional options that you have included. What should be used instead is the Export Form Data command for form fields and Export Comments To Data File command for annotations. Try using them in the End-User Editor and if it does work for you, then we'll try doing that via the operation.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply