Best way to generate PDF in c# using Word or InDesign?

时间:2015-07-28 23:58:25

标签: c# ms-word adobe-indesign aspose.pdf

I'm comfortable generating Word documents using Aspose.Word (which can also save as a PDF) but I've recently been asked to do the same thing using a PDF as the starter template. We recently bought Aspose.Total and whilst Aspose.Pdf looks like it can do some manipulations it doesn't look to be all that flexible/easy (like adding a big line of text and getting it to wrap, and shifting other content down the page if it takes up more space).

What would be the best way of using a PDF as a template for what is basically a bit like a mail merge from a database? Should I turn it into a PDF form and merge it from an XML data source? Is this even viable or would such a form still have a limitation on spacing (so that longer lines/paragraphs of text won't reflow the document where necessary)?

From what I can tell it doesn't look like InDesign can be manipulated in c# even via a COM object (which would be nasty on a web server anyway).

If I recreated the InDesign/PDF as a Word document I'm sure I could work wonders, but you know what these publishing types are like, who think Word documents are the tool of the devil. These PDFs are never going to a professional printer anyway; they're just brochures for a client to download from a web page (based on information in a database) for printing/use at home.

1 个答案:

答案 0 :(得分:1)

你确实有很多这样的网络打印项目的解决方案。选择一个是预算,要求和用户数量的问题。放置动态内容可以使用可填充xml数据的PDF表单以最简单的方式完成。

另一方面,您可以使用InDesign Server并根据InDesign模板输出PDF。当大量用户需要并行获取丰富的pdf文件时,这通常是一个不错的选择。但成本很高。

您还可以设想一个pitstop服务器或Callas PDFToolBox服务器根据您提供的变量放置动态文本。这里的好处是你在这里不需要太多编码。这些应用程序已经可以使用了。

您最后可以考虑命令行工具。其中一些可能有一些有用的命令,如pdfTk或cPdf来合并文本。