Programmatically Inserting Data into an InDesign Document - ruby

I have to use Adobe InDesign for creating documents. We basically need to have a couple variables throughout the document (company name, project name, etc) that need to be filled in.
I was wondering if there is a way to take an existing template and maybe programmatically fill these in using a language I'm comfortable with (Ruby, Python, etc). I have tried to open the Adobe InDesign file using a text editor - but when I make modifications using Notepad++ and then open the file in InDesign, it tells me the file is corrupted.
If you have any insight with programmatically building InDesign documents or know of any tutorials that would be much appreciated.
P.S. I tried to check out Adobe's ExtendScript but wasn't finding much documentation applying to InDesign.
Thanks for the help!

There is no (legal) way to do this in Ruby/Python. Theoretically it is possible to edit InDesign documents directly using any language but:
It's nowhere near as easy as just making some text modifications, you would have to figure out more about the format, and
It's in direct violation of the InDesign license agreement meaning you could face legal action if Adobe finds out.
ExtendScript is perfect for doing small things like this. If you open up ExtendScript Toolkit and set the target to InDesign you can browse and search the entire API easily. Doing search/replace for simple text variables is not hard at all.
An alternative would be exporting the documents to the .idml language which is easier and legal to edit outside of InDesign.

You can use the DataMerge-feature of Indesign --> https://helpx.adobe.com/indesign/using/data-merge.html
I think this is exactly what you are looking for.
Or you can use the Indesign API. Have a look at Extendscript-Toolkit especially the ObjectModell-Viewer.

You need to convert your .indd file to .idml and unzi it.
In /Stories/Story_*.idml you may found all text variables.
And no easy ways to change text variables in .indd without Adobe products.

Related

Can you change the theme of an existing powerpoint with Python-pptx?

I was wondering if there was any way I could change the theme of an existing PowerPoint using Python-pptx.
I realise that the easiest way of inserting a specific theme of a powerpoint, you just open a "template powerpoint" with the theme in it. However, I want to automize converting themes of existing PowerPoints, I'm not creating new PowerPoints from scratch.
You might say: just copy and paste slides into the PowerPoint with a specific theme. However, copy and pasting slides is extremely error-prone as well, seeing they work with slide indices which seem quite tricky. And I'm not even sure whether the pasted slides automatically assume the theme of the new document.
Therefore I was wondering if anyone knew of some kind of theme object I could call and change using Python-pptx?
Thanks in advance
The short answer is no. Implementing that would be a fairly big deal and there are no current plans to add it.
If you wanted to do that to several decks, you might explore using Visual Basic for Applications to do it in a Microsoft Windows environment. You might also explore using the win32com interface to control the PowerPoint application from Python, I think that also requires a Windows environment.

How to compare the layout of pdf files programmatically?

It is possible to rip the text from pdf and comapre it. And here i need to compare if the layout of the pdf with another pdf file. Is it possible programmatically? There are third party tools to do that, but is it available for testing using selenium or any programming language?
I have gone through google, but couldn't find a solid solution for this yet? Any help appreciated.
With PDF Box of apache you should be among other things be able to extract the text from existing PDF documents.
ps: you probably have to create a custom program in jave to extract and compare and invoke it from selinium.

Guide for Carrot2 in PDF

Could you please say if there is a pdf (or doc) version of the documentation? If yes, where can I find it?
If such does not exist, I guess it would be great to create such.
PDF allows reading the file in Mendeley Desktop program, underlining parts that are important for me and putting comments. THis would be a great advantage to compare with the html version of the guide.
If you're using Chrome, just go to the Carrot2 online help manual and choose "Print...". In the "Destination" box on the left-hand side change it to "Save as PDF" and click OK. This functionality is built-in to Chrome by default.
For other browsers I'm sure there are add-ins/plugins you can find or you can always use a third-party PDF driver like PrimoPDF.

What is the easiest way to customize PDF document with a serial number

I have several PDF documents. Users of my Windows application want to print these PDF files. An additional requirement is to add auto incremented serial number to each printed PDF. The serial number is used for accounting purposes, not for security reasons as someone asked here.
What is the easiest way to implement above functionally?
I know that I can buy commercial license of iText and edit PDF files. However I would like to know if there is a simpler solution. E.g. Add a form field to PDF document, distribute it to my users, and then use some Acrobat Reader command line option to fill in the form field with serial number generated by my application.
PDFTK (The PDF Toolkit) is a command-line app that allows you to edit PDFs with ease. For example, you could use the update_info command to change the meta-data, or apply a background (which isn't all that easy, as it requires another PDF to get the background from)...
Another option is to use the FREE Quick PDF Library Lite.
QP.LoadFromFile(Filename);
QP.SetOrigin(1); // set origin coordinate system to top right corner
QP.DrawText(10,10, mySerialNumber);
QP.SaveToFile(newFilename);
You can find more information at http://www.quickpdflibrary.com/free/lite.php
"Quick PDF Library Lite is available as an ActiveX component and works with C, C++, C#, Delphi, PHP, Visual Basic, VB.NET, ASP, PowerBASIC, Pascal or any other language that supports ActiveX."
Disclaimer : I do consulting work for the QuickPDF products.

Access Text Boxes (in a Keynote slide) in AppleScript

Need some help to figure out how to access Text Boxes inside a slide in Keynote with Applescript. I tried to use ASDictionary but I couldn't find anything that would resemble a text box object. I fear that they are not scriptable in Keynote, but perhaps I can access them through Applescript Cocoa bridge? Any thoughts? Thanks!
If (and only if) Keynote doesn't provide access to objects on a slide via AppleScript, then you should do two things:
File an enhancement request at https://bugreport.apple.com/ .
Try examining the Keynote document directly by parsing its XML.
Keynote's XML document format is not documented, as far as I know, but at least you can access it. You just have to be careful about the format changing out from under you.

Resources