开发者

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

开发者 https://www.devze.com 2023-01-10 11:15 出处:网络
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.

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

精彩评论

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

关注公众号