c# code for menu command "Export Comments to Data File"

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

c# code for menu command "Export Comments to Data File"

Post by asamrith@gmail.com »

Can you please provide the c# code to do what the menu command "Export Comments to Data File"?
Can you please also provide a c# sample code of the menu command "Import Comments"?

I could not find the code in the Fulldemo sample. thanks
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: c# code for menu command "Export Comments to Data File"

Post by Sasha - Tracker Dev Team »

Hello asamrith@gmail.com,

Please search the help wiki for the appropriate operation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Erickc
User
Posts: 46
Joined: Tue Apr 12, 2016 2:36 pm

Re: c# code for menu command "Export Comments to Data File"

Post by Erickc »

Hello Alex,

Just like asamrith@gmail.com, we are also looking for a C# sample for exportCommentsAndFields.

Could it be possible for you to add one for this specific function on the wiki?

Thanks,

Eric
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: c# code for menu command "Export Comments to Data File"

Post by asamrith@gmail.com »

Search the sdk help on "op.document.exportCommentsAndFields" for explanation of the parameters.
https://sdkhelp.pdf-xchange.com/view/Main_Page
I hope this will help you...cheers

Code: Select all

			IOperation op = this.pdfCtl.Inst.CreateOp(this.pdfCtl.Inst.Str2ID("op.document.exportCommentsAndFields", false));
			op.Params.Root[(object)"Input"].v = (object)doc;
			ICabNode cabNode = (ICabNode)op.Params.Root[(object)"Options"];			
			cabNode[(object)"ExportAnnots"].v = (object)true;
			cabNode[(object)"ExportFields"].v = (object)true;
			cabNode[(object)"Format"].v = "FDF";
			IAFS_Name name = ((IAFS_Inst)this.pdfCtl.Inst.GetExtension("AFS")).DefaultFileSys.StringToName(fdfFilename, 0, (IAFS_Name)null);
			cabNode[(object)"DestFile"].v = (object)name;
			op.Do(0);
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: c# code for menu command "Export Comments to Data File"

Post by Sasha - Tracker Dev Team »

Thanks for the sample, asamrith@gmail.com :)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Erickc
User
Posts: 46
Joined: Tue Apr 12, 2016 2:36 pm

Re: c# code for menu command "Export Comments to Data File"

Post by Erickc »

Thank you asamrith@gmail.com !! :D
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: c# code for menu command "Export Comments to Data File"

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
dconner
User
Posts: 28
Joined: Fri Feb 07, 2014 10:27 pm

Re: c# code for menu command "Export Comments to Data File"

Post by dconner »

Hi All,

I couldn't seem to export fields (nor annotations) using this example. I tried exporting to various formats but got the same result.
When setting the export type to "XML" I get:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<fields xmlns:xfdf="http://ns.adobe.com/xfdf-transition/"
/>
This is the C# that I'm using:

Code: Select all

                IOperation Op = pdfx.Inst.CreateOp(pdfx.Inst.Str2ID("op.document.exportCommentsAndFields", false));
				PDFXEdit.ICabNode input = Op.Params.Root[(object)"Input"];
				input.v = (object)pdfx.Doc;
				PDFXEdit.ICabNode options = Op.Params.Root[(object)"Options"];

				PDFXEdit.IAFS_Inst fsInst = (PDFXEdit.IAFS_Inst)pdfx.Inst.GetExtension("AFS");
				PDFXEdit.IAFS_Name destPath = fsInst.DefaultFileSys.StringToName(targetFile, 0, (IAFS_Name)null);

				options[(object)"DestFile"].v = (object)destPath;
				options[(object)"Format"].v = "XML";
				options[(object)"ExportFields"].v = (object)true;
                options[(object)"ExportAnnots"].v = (object)true;
                options[(object)"IncludeEmptyFields"].v = (object)true;

                Op.Do();
I've attached an example PDF file which contains text content and a single text field.

How can I export all field information?


Most Sincerely
Attachments
fillable_example.pdf
text and a fillable field
(18.8 KiB) Downloaded 88 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: c# code for menu command "Export Comments to Data File"

Post by Sasha - Tracker Dev Team »

Hello dconner,

From what I see, the ExportCommentsOperation exports annotations only to the FDF and XFDF formats while the FormFields can be exported also into the Text/CSV and XML format. I've asked the developer who implemented this feature about this and will reply here once I have an answer.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply