views:

179

answers:

1

For a project I need to automate creation of business cards. Now, they have a InDesign file for each business card template. They insert the info of alle the people in the indesign file and then generate a pdf of it.

Now, entering the information of customers in a web application is no problem, but how will I generate a pdf and how will I alter the indesign file at runtime?

I think that altering the indesign file will be not possible programmatically?

Could I generate a pdf from the indesign with one card template in it. At runtime I would copy the card in the pdf x number of times. Then I would need to inject the information of the people (name, address, ...)?

What's possible here?

The final pdf is used by a machine that automatically creates the business cards, cuts them, ...

+1  A: 

You can automate pretty much anything using the built-in scripting support in InDesign. In the InDesign GUI you can assign script labels to various elements, such as text frames, in your InDesign documentIf you, for instance, would like to replace some text in a text frame you can apply something like this in Javascript:

var document = app.open(File("path to your InDesign file"), false);
var textFrame = document.pageItems.item("your script label");
var story = textFrame.parentStory;
story.contents = "your new content"

To create a PDF you do something like this:

var pdfFile = new File("path to your pdf");
document.exportFile(ExportFormat.PDF_TYPE, pdfFile);

This was just a few examples of what you can do, I hope that was somewhat helpful. If you don't know how to install and run scripts in InDesign, this blog post explains the process. You can find a good online scripting reference here. As I understand it you would like to run your scripts as a batch process. If that is the case I recommend that you take a look at InDesign Server. It is basically the desktop version of InDesign but without the GUI and with a simple Web Service interface. It is also running as a Windows service (or the equivalent on other platforms).

Petter Wigle
Is opening a InDesign file also possible in C#? Or is the InDesign file basically xml?
Lieven Cardoen
At least in InDesign CS3 it is a proprietary binary format. Don't know if CS4 or CS5 uses a xml format, but I doubt that. In theory you could of course modify the files from C# without InDesign, but then you have to reverse-engineer the file format.A better option is to use the Web Service API provided to send Javascript scripts to InDesign Server from your C# application.
Petter Wigle
CS4 and CS5 also uses a binary format. It's possible to save the InDesign files as .idml which is an xml format, but even if you could change this there is no easy way to convert those files to PDF without using InDesign.
MatsT