Export FormData

PDF-XChange Editor SDK for Developers

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

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
mash_inc
User
Posts: 37
Joined: Tue Jan 25, 2011 3:11 pm
Location: Germany
Contact:

Export FormData

Post by mash_inc »

Hi,
I want to export all FormData of a PDF to an XML file. My approach is this:

Code: Select all

public void ExportFormData() {
      var form = (IPXC_AcroForm)Editor.Doc.CoreDoc.AcroForm;
      MessageBox.Show("Number of Fields:" + form.FieldsCount);

      PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Editor.Inst.GetExtension("AFS");
      PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName(@"d:\temp\PDFExport.xml"); //Converting string to name
    
      // This call leads to a NotImplementedException
      form.Export(destPath, "XML", null, true, (uint)PXC_ExportFormFlags.FormExport_Default);
    }
When calling form.Export(....) I get a NotImplementedException.

Thanks in advance,

Best regards
Tino
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Export FormData

Post by Sasha - Tracker Dev Team »

Hello Tino,

The Export method is not have been implemented yet. Use this operation instead:
https://sdkhelp.pdf-xchange.com/vi ... sAndFields

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
mash_inc
User
Posts: 37
Joined: Tue Jan 25, 2011 3:11 pm
Location: Germany
Contact:

Re: Export FormData

Post by mash_inc »

Hi Alex,
I tried the following, but with no success:

Code: Select all

public void ExportFormData() {
      try {
        var Op = GetOperation(IDS.op_document_exportCommentsAndFields);

        // See: https://sdkhelp.pdf-xchange.com/view/PXV:op_document_exportCommentsAndFields
        PDFXEdit.ICabNode output = Op.Params.Root["Output"];
        output.v = Editor.Inst.ActiveDoc;
        PDFXEdit.ICabNode options = Op.Params.Root["Options"];

        PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)Editor.Inst.GetExtension("AFS");
        PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName(@"d:\temp\ExportedFields.xml");

        options["DestFile"].v = destPath;
        options["Format"].v = "XML";
        options["ExportFields"].v = true;

         Op.Do();
      }
      catch (Exception ex) {
        MessageBox.Show(ex.ToString());
      }
    }
I get an ArgumentException when calling Op.Do();
Can you give a small sample on how to export Form-Data.

Thanks in advance.

Best regards
Tino
mash_inc
User
Posts: 37
Joined: Tue Jan 25, 2011 3:11 pm
Location: Germany
Contact:

Re: Export FormData

Post by mash_inc »

Some more information on this topic:
Because I had no success with the op_document_exportCommentsAndFields command so far, I also tried the cmd_forms_exportData command.
This command gets displayed if I look in the properties of the according UI Command. Unfortunately it is not possible to get an operation instance for that command (via Editor.Inst.CreateOp(...)).
Please see the images in the attached Zip File.

Best regards
Tino
Attachments
TrackerExportFormData.zip
(326.24 KiB) Downloaded 63 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Export FormData

Post by Sasha - Tracker Dev Team »

Hello Tino,

How do you expect this to work when you don't give an input document but give output document instead?

Code: Select all

PDFXEdit.ICabNode output = Op.Params.Root["Output"];
output.v = Editor.Inst.ActiveDoc;
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply