0

I am not quite sure how to pose this question right, so I will try to describe the solution I am looking for, and I then hope someone can help me frame the question / solution in the right way.

I have a pdf looking like this: http://thomasabcd.site44.com/topdf/279928-triangle.pdf which is based on an indesign-file.

I would like to change the text and QR-code based on data in my database and output a new pdf for printing without having to manually edit the original indesign-file. I have the original layout in indesign (which can be found here http://thomasabcd.site44.com/topdf/279928-triangle.indd), and my thought was to export it to HTML, which would then allow me to replace the text and QR-code and then generate the HTML-file as a pdf. But this doesn't seem to work, as the HTML outputted from indesign doesn't seem to be pixel perfect and the dimensions don't look right and also the resulting html looks blurred. So I don't know whether I am going down the wrong path by converting the indesign-file to html and then to pdf, or whether I should do something completely different.

So I guess the core of my question is how I best generate a pdf based on my indesign-file.

thanks

Thomas

ThomasD
  • 2,464
  • 6
  • 40
  • 56
  • Look into InDesign's native Data Merge options to quickly generate documents straight out of a database. – Jongware Apr 29 '14 at 20:09

3 Answers3

1

Are you the sole user of this InDesign customization path? If so, InDesign has some great scripting options that are relatively easy to use and can be built cross-platform. Even if you have a limited number of users, as long as they have InDesign you can share these scripts.

If you want something a little more powerful, InDesign also exposes a COM object that you can talk to in .Net. The documentation pretty much follows the scripting guide. They also expose an Applescript dictionary for the Mac. Both allow you to launch InDesign silently or interactively and do pretty much anything that you can do with a mouse and keyboard.

You can further enhance the COM path above by installing InDesign on a server and as long as you are licensed appropriately you can call it from a server-side language like .Net or PHP.

Adobe also has a dedicated server version of InDesign available but last time I looked into it it was cost-prohibitive.

If you don't want dependence upon InDesign then your next best bet is a PDF library. This really depends on the language/platform that you want to target. iText is a great Java library that has been ported feature-for-feature to .Net as iTextSharp. There are dozens of other great libraries out there, too, it just depends on your circumstances. Going down this path you'd create your PDF in InDesign and then use that PDF as a template for customization. You can't (easily) replace text in a PDF so you'd just have to figure out X,Y coordinates as well as font information but its pretty straightforward.

If you just had text only you could do something really simple which is just make your variable text into form fields that look exactly like the normal text. Then you could just fill in the blanks with Adobe Acrobat or even Adobe Reader. This runs into a little bit of a problem because of font embedding licenses, however.

I've spent over a decade doing all of these things so I can elaborate on any or all more if you want.

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
  • Thanks! I would prefer a solution not depending on inDesign, so I will first try to do something using pdf. I guess placing the QR-code would be quite straight forward using iText or iTextsharp if I just get the X,Y coordinates. Regarding placing the text, is the issue that the text might span several lines, so I don't know where to break the line , or is it possible to define a textarea using iTextsharp which the text has to stay within ? – ThomasD Apr 29 '14 at 21:30
  • iText actually has a QR Code helper in case you need it: http://itextpdf.com/examples/iia.php?id=297. Wrapping of text is built-in for new PDFs but for existing PDFs you are a little bit limited. For that you'll probably want to use a `ColumnText` object as show here: http://stackoverflow.com/a/2762518/231316 – Chris Haas Apr 29 '14 at 21:40
0

I don't know indesign but my guess is that you won't be able to make it work like that.

For me you have two possibilities: 1. You generate your pdf server side 2. you generate your pdf client side

What kind of server / language / infra do you have ? you work with php? java? for 100% client side I know this lib that works well http://parall.ax/products/jspdf

But I think the best approach here is to dynamically generate your pdf in your server and let your client download it. I am a Java guy so I would tell you to use Jasper but any pdf generator would do

David Roon
  • 23
  • 2
0

A shift of the problem would be to place fields (Text for text, Button for the QR code), and use iText to fill those fields. With that you definitely won't have to care about where to place, because the fields contain that information.

Max Wyss
  • 3,549
  • 2
  • 20
  • 26