• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

From a PDF to an XML file

New Here ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

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

TOPICS
Edit and convert PDFs , JavaScript

Views

5.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 01, 2021 Jun 01, 2021

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. 

 

 

 

 

Votes

Translate

Translate
LEGEND ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 29, 2021 May 29, 2021

Copy link to clipboard

Copied

Sorry for my original question, Thom has hit my request and on monday I will try following your link.

Thanks a lot to try67 too!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 31, 2021 May 31, 2021

Copy link to clipboard

Copied

I have exported my PDF to an XML document using this commands:

 

codiceRow1 = this.getField("CODICERow1").value.toString();

var namestring = "TEST.xml";
this.createDataObject({cName: namestring, cValue: codiceRow1});
this.exportDataObject({cName: namestring, nLaunch: 1});

 

but when I try to run it using Adobe Reader it not runs.

Can you help me please?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2021 May 31, 2021

Copy link to clipboard

Copied

For the use in Acrobat Reader the file requires special rights.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 31, 2021 May 31, 2021

Copy link to clipboard

Copied

I have found that if the file is attached into the pdf document, I can export it using Adobe Reader.

So my question is, can I modify the file attached before to export it? Do you think it is a good idea?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2021 May 31, 2021

Copy link to clipboard

Copied

As bernd stated, in Reader, a script cannot create or modify a file attachment unless it has special rights that have to be purchased from Adobe.  At least at this time. The whole reader rights things changes occasionally.

 

To export data from Reader, there are two choices. 

1) Use the File system export functions such as "exportXFAData()", with no file path specification. So the user has to select file save location.

2) Use a form submit action, so the data is sent to a web server. You'll need a server script to catch the data and do something with it.

 

 

 

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

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

 

But in Adobe Reader it doesn't run.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

That's correct. This function will not work in Reader, unless the file has a very special right applied to it, which can't be done in Acrobat.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

Which kind of special right it needs? How can I apply them?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

It's called Export Form Rights and you can apply them using Adobe LiveCycle Reader Extensions, or whatever it's called now (I can't keep track of these name changes Adobe does every so often).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2021 Jun 01, 2021

Copy link to clipboard

Copied

LATEST

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. 

 

 

 

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 28, 2021 May 28, 2021

Copy link to clipboard

Copied

I think your original question was not very clear. It seems you want to export PDF form data to XML, not the PDF file's contents themselves. That is certainly possible. There are a couple of built-in commands that do it (see Thom's reply), and it's also possible to write a custom-made script that does it if you want to use your own format for the output.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines