从InDesign在运行时创建PDF [英] Create pdf from inDesign at runtime

查看:216
本文介绍了从InDesign在运行时创建PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一个项目,我需要自动化创作的名片。现在,他们有一个的InDesign文件中为每个名片模板。他们插入全部的信息的人在InDesign的文件,然后生成它的PDF格式。

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.

现在,进入客户信息在Web应用程序是没有问题的,但我怎么会生成一个PDF,我怎么会改变在运行时的InDesign文件?

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?

我想改变的InDesign文件将是不可能的编程方式?

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

我可以生成与它一卡模板在InDesign的PDF文件。在运行时,我就复制卡的时候的PDF x个。然后,我就需要注入的人(姓名,地址,...)?

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, ...)?

什么是可能的吗?

最终的PDF所使用的机器,可以自动创建名片,削减他们,...

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

推荐答案

您可以使用自动pretty的任何东西内置在InDesign脚本支持。在InDesign的图形用户界面,您可以指定脚本标签的各种元素,如文本框,在你的InDesign文档。如果,比如说,想更换文本框一些文字你可以申请这样的事情在Javascript(CS4及以下,见下面的注释):

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 document. If you, for instance, would like to replace some text in a text frame you can apply something like this in Javascript (CS4 and below, see note below):

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"

要创建一个PDF文档,你做这样的事情:

To create a PDF you do something like this:

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

这是你可以做的只是几个例子,我希望有点帮助。 如果你不知道如何安装和运行在InDesign脚本,这个博客帖子解释的过程。你可以在这里找到一个良好的网上脚本参考。 据我了解,你想作为一个批处理程序运行脚本。如果是这样的话,我建议你看一看的InDesign服务器。它基本上是和InDesign中,但没有GUI,其中包括一个简单的Web服务接口的桌面版本。它也运行作为Windows服务(或其他平台上的等价物)。

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).

请注意:与CS5开始,你再也不能识别的文本框其脚本标签,如上图所示。 有一些关于它的讨论,这里。最好的办法是使用,而不是项目itemByName(名称),与名称为在图层调板中的名称。这可以在GUI做href="http://indesignsecrets.com/hidden-gems-the-layers-panel-in-cs5.php" rel="nofollow">很慢双击<一个在图层调板中的项目。或者,此解决办法设置每个文本框的名字等于它的脚本标签。然后,所有你必须​​做些什么来改变文本框的内容是这样的:

NOTE: Starting with CS5, you can no longer identify a text frame by its script label, as shown above. There's some discussion about it here. The best alternative is to use itemByName(name) instead of item, with name being the name on the layers palette. This can be changed in the GUI by doing a really slow double click on the item in the layers palette. Or, this workaround sets each text frame's name to be equal to its script label. Then, all you have to do to change the text frame's contents is this:

document.textFrames.itemByName("shmullus").contents = "The Doctor";

这篇关于从InDesign在运行时创建PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆