Page 1 of 1

Import XML into Indesign to convert to PDF

Posted: Mon Jun 29, 2020 11:59 am
by KenCratty
I'm trying to use a flow that will take the XML and create a document in Indesign. I have my XML file and the Indesign template. It looks like I need a script to open the Indesign file template and import the Indesign file. Can someone help me with this? I don't know scripting.

Re: Import XML into Indesign to convert to PDF

Posted: Mon Jun 29, 2020 12:13 pm
by jan_suhr
You need the following JavaScript in the InDesign configurator property Command
Then as Argument 1 you specify the name of the XML file.

The incoming jobb to InDesign is the InDesign template file and the XML is easiest picked up from a folder where Switch stored it.

Code: Select all

var NameOfFile = $arg1;
$doc.importXML( File(NameOfFile) );

Re: Import XML into Indesign to convert to PDF

Posted: Tue Jun 30, 2020 12:14 pm
by KenCratty
Thank you. I saw in another post you demo a simple business card flow using your csvXML tool. Can you share that flow?

Re: Import XML into Indesign to convert to PDF

Posted: Wed Jul 01, 2020 3:42 am
by KenCratty
Here is the document of the flow I built. I'm getting an error 'null is not an object'. Please let me know what I'm doing wrong.
The attachment flow25Doc.zip is no longer available
flow25Doc.zip
(20.81 KiB) Downloaded 548 times

Re: Import XML into Indesign to convert to PDF

Posted: Tue Jul 14, 2020 7:55 pm
by Liv
Silly question... how do you get the xml info into the InDesign file? How do you create the fields?

Re: Import XML into Indesign to convert to PDF

Posted: Tue Jul 14, 2020 8:02 pm
by jan_suhr
Google XML import to InDesign.

You have to set up the template document with text fields that is tagged to receive the XML.

Re: Import XML into Indesign to convert to PDF

Posted: Sat Dec 05, 2020 3:48 pm
by KenCratty
I have been using this script to import xml into Indesign:

Code: Select all

var NameOfFile = $arg1;
$doc.importXML( File(NameOfFile) );
It was working fine until someone updated to Indesign 2020. Now I get this error:
"Cannot handle the request because of a modal dialog or alert is active". Can you help me make the adjustment?

Re: Import XML into Indesign to convert to PDF

Posted: Mon Dec 07, 2020 3:28 pm
by laurentd
It looks like there is a warning dialog open in InDesign (missing links, fonts, etc).
Open your document manually on the Switch server, you should get the same error, then fix it.
For automation, the InDesign document should open without any error or warning.

Re: Import XML into Indesign to convert to PDF

Posted: Tue Dec 08, 2020 1:08 am
by KenCratty
I opened it and there are no missing fonts or graphics.

When we first built the flow, the version of Indesign did not have an additional menu after you select the XML import. The option were check boxes at the bottom of the election window. Now there is a popup menu for the selections. That is the window we need to resolve in the script.

Re: Import XML into Indesign to convert to PDF

Posted: Thu Dec 10, 2020 4:55 pm
by laurentd
When you manually import an xml in InDesign, you can disable "Show XML Import Options"
You can disable this option then save the InDesign template again.
On my side it works whether this options was checked or not, but who knows.
The first time I ran my flow (on Mac) I also got a dialog telling "osascript wants access to control Adobe InDesign 2020", just had to allow this.