Skip to main content
Participating Frequently
May 28, 2021
Answered

From a PDF to an XML file

  • May 28, 2021
  • 1 reply
  • 7420 views

Hello everybody, I need your help. I have a pdf file with different object inside and I have to export it to an XML file with a fixed structure like 

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Export>
<TAG>
<TAG1_VALUE>object1.Text</TAG1_VALUE>
<TAGN_VALUE>objectN.Text</TAGN_VALUE>
</TAG>

</Export>

Is possible to do it from a button inside of the document and a JavaScript function behind?

or what do you suggest me to do it?

Tanks a lot

This topic has been closed for replies.
Correct answer Thom Parker

I'm testing the first choice using this command:
this.exportXFAData({
bXDP: false,
aPackets: ["*"]
})

 

But in Adobe Reader it doesn't run.


My bad,  Ignore option #1 😞   The export string operations work in Reader, but not the export to file functions. The export rights are not included in the Save As Extended feature in Acrobat Pro. 

 

So your only option for Reader operation is to submit data to a server. 

 

 

 

 

1 reply

Legend
May 28, 2021

What makes you believe that a PDF can be converted to such a representation? For example, do you know of software which does this exact thing?  What do you mean by "different object inside" and what is the "this" you want to export?

Participating Frequently
May 28, 2021

I don't know if it is possible using Adobe DC Pro and before to develop a software which does this exact things I'm looking for a possibility to do it from the pdf options. Is there anything like action guide or someone can help me to find the right procedure to take a value from a text box or combobox or radio button and save this information in a new file with XML extension?

Thanks

Thom Parker
Community Expert
Community Expert
May 28, 2021

Yes, so you want to export Form data to XML. This is very different from converting a PDF to XML.  

 

You can export to an XML format form the "Export Data" option on the "More" menu in Prepare forms mode. Or you can use the Javascript - 

 

doc.exportAsXFDF()

 

or 

 

doc.exportXFAData()

 

There are 3 different XML formats to choose from, Plain XML (Tags are the field names and contents are field values), XFDF (FDF format in XML), XDP ( LiveCycle form data format)

 

You can read more about scripting this type of operation here:

https://www.pdfscripting.com/public/Form-Data-Handling.cfm

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often