• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Exporting an Illustrator file as multiple PDF pages, using data from a CSV file

Community Beginner ,
May 30, 2017 May 30, 2017

Copy link to clipboard

Copied

Hello all,

I am very new to scripting and I'm not having much luck at finding any solutions online so far, but if you think this would be easier in InDesign or anything else please let me know. I have a bit of experience with JavaScript, so it's a plus, but still hasn't helped me so far unfortunately.

I'm currently trying to figure out the best approach at writing a script which will generate multiple PDFs from reading a CSV file, which would use the 2 pages in Illustrator as a template, create 2 pages inside a PDF with an imported serial number which will be placed into a text box at the bottom of the second page. This process may continue up to 100 pages, so every 2 pages the serial number would change for each serial number found within the CSV.

This is a 6 digit number, so maybe a script that detects every 6 number digit within the CSV, then stores it within an array that then counts the total and creates 2 pages within a PDF for every serial number found.

Any help or links to useful topics will be fantastic, as I can't seem to find anything at the moment!

Cheers guys!

Charlie

TOPICS
Scripting

Views

1.3K

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

Valorous Hero , May 31, 2017 May 31, 2017

You use Indesign's built-in Data Merge feature to do all of this, no scripting required. If you need all of them in a single PDF, then you wouldn't need any export scripts to generate individual pages, so you're good to go.

Votes

Translate

Translate
Adobe
Community Expert ,
May 30, 2017 May 30, 2017

Copy link to clipboard

Copied

Do you have an example file (the ai template file as well as a sample csv with the kind of data you'll expect to have) you can share? Do you have any code written that you want to ask specific questions about or that we can help debug?

It's tough to know where to start when all we have is a brief snapshot.

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
Valorous Hero ,
May 30, 2017 May 30, 2017

Copy link to clipboard

Copied

A great challenge for Illustrator scripting, but hands-down Indesign outperforms with both user options and script extensibility.

It would for example be relatively easy to use ID's data-merge to create the entire CSV-based document with just the user functions, and then a small script could export all the PDFs into separate documents. However, if Illustrator is the preferred method for one reason or another, William can solve it!

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 Beginner ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

Thank you for your responses guys

I don't actually have any code written up, I've had a play with some plugins importing text data from a CSV but that's about it.

The CSV itself is very basic, a single column with the header 'Serial numbers' and below in a list are the numbers '123456', etc. I imagine it would be easier in InDesign, this way you can create the pages within InDesign with the script once the CSV has been imported then just export it manually, as I need it to all be in the same PDF. Would it be possible to create a loop to count the data within the CSV, and then produce the same amount of pages using the master pages as a template? The serial number would need to be inserted into a text box at the bottom of every 2nd page.

Thanks again!

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 Beginner ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

Ah, think I may have found the solution - Simple InDesign script to load content from a CSV file and create a page for each record.The content...

But can't seem to get it working, I think it may be out dated

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, 2017 May 31, 2017

Copy link to clipboard

Copied

Unfortunately, it seems that Adobe values ID more than AI. The InDesign API is much more robust than the Illustrator API.. =(

There are a few issues regarding using that script in Illustrator..

  • csvToJson() function is not native to Illustrator.
  • page is not available in the illustrator API
  • masterPageItems is a property of page, see above

This script could likely be reworked for Illustrator, but like i said before, we need to know more about the file you're working with and what you expect the output to be. Can you share the template you're working with as well as a file that represents what the file should look like before it's exported?

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
Valorous Hero ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

You use Indesign's built-in Data Merge feature to do all of this, no scripting required. If you need all of them in a single PDF, then you wouldn't need any export scripts to generate individual pages, so you're good to go.

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 Beginner ,
May 31, 2017 May 31, 2017

Copy link to clipboard

Copied

LATEST

Yeah I think I was overthinking it, seems to work fine with the Data Merge feature.

Thanks for the help

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