Site logo

Export to PDF using Data Merge

The script is used for creating 7 language versions of a catalogue. It exports multiple pdf files using Data Merge feature: each record corresponds to a specific language.

The output

The problem is that for the last language in the chain — Hungarian — it should execute another script (via doScript) which runs a few find-change queries. (Both scripts should be located in the same folder.) But before that I should activate the record 3 (for Hungarian).

Manually, I just turn the Preview check box on and select record 3, but I can’t find the scripting equivalent for these two steps.

Here I posted both scripts and test file so, if interested, you can play with it.

The correct result for Hungarian should look like so:

instead of this (missing 'ft')

Below is the scenario for the script:

Basically, it needs to do the following for each of the languages:

1. CZ:
a) Switch data merge to "1" (Czech language)
b) Export the PDF using export preset for Online.
c) Export the PDF using export preset for Print.

2. EN:
a) Switch data merge to "2" (English language).
b) Export the PDF using export preset for Online.
c) Export the PDF using export preset for Print.

3. LT:
a) Switch data merge to "4" (Lithuanian language).
b) Export the PDF using export preset for Online.
c) Export the PDF using export preset for Print.

4. LV:
a) Switch data merge to "5" (Latvian language).
b) Export the PDF using export preset for Online.
c) Export the PDF using export preset for Print.

5. RO:
a) Switch data merge to "6" (Romanian language).
b) Export the PDF using export preset for Online.
c) Export the PDF using export preset for Print.

6. SK:
a) Switch data merge to "7" (Slovakian language).
b) Export the PDF using export preset for Online.
c) Export the PDF using export preset for Print.

7. HU
a) Switch data merge "3" (Hungarian language) 
b) Then it needs to run a script "Hungarian prices
"
c) Export the PDF using export preset for Online.
d) Export the PDF using export preset for Print.

Each file needs to be saved into a defined folder, and have a name that looks like this: {indd-file-name}_{lang}_{print/online}.pdf