开发者

How do I convert Word files to PDF using Word 2007 programmatically?

I used to convert Word documents to PDF via Word Automation: Enumerate the CommandBars until one containing "PDFmaker" was found, enumerating its controls and executing it.

With Word 2007 this no longer works - although the PdfMaker Com Addin is installed and accessible via 开发者_如何学JAVAthe Acrobat menu.

PDFmaker is required for quality reasons. Therefore I cannot use the Microsoft "Save as PDF" addin; so the SaveAs method described in another post here is not applicable.

Any ideas?


A common way to get a PDF out of Word is to print to a virtual PDF printer. I could bet you have one installed. Maybe you find the quality appropriate.

The code would be:

Application.ActivePrinter = "whatever PDF printer you've got"
ThisDocument.PrintOut OutputFileName:="c:\whatever.pdf", PrintToFile:=True
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜