[ACCEPTED]-Saving Word DOCX files as PDF-docx
You could do this with Word automation. You 1 need to have word installed.
var TheDocument = TheWordApp.Documents.Open(docName);
TheDocument.ExportAsFixedFormat(
docName.Replace(".docx", ".pdf"),
Word.WdExportFormat.wdExportFormatPDF,
OptimizeFor: Word.WdExportOptimizeFor.wdExportOptimizeForOnScreen,
BitmapMissingFonts: true, DocStructureTags: false);
((Word._Document)TheDocument).Close();
To get from DocX -> PDF you need something 8 that can render a DocX file and provides 7 a PDF export/save capability. Needless 6 to say, there aren't that many tools that 5 can render DocX (Word, OpenOffice/LibreOffice 4 and some other licensed products mentioned 3 below). Depending on your runtime limitations/requirements, you 2 could try:
- to use MS Automation to get Word to load the docx and save as PDF.
- tools that sit on top of OpenOffice (JODConverter/Docmosis) to do the conversion.
- try embedding other document libraries (Aspose, Windward)
I'm not sure about the auto print 1 requirement sorry.
I've successfully used the Aspose suite of tools 2 for this in the past: https://stackoverflow.com/a/5513946/54762. It's not free, but 1 you can demo it before you buy it.
I have used this VBScript and it works well. It 4 works in the background (opens the docx 3 and saves as PDF using "Save/Export 2 as PDF" option). Check the system requirements 1 listed on the page.
We produce WordGlue .NET which is a generic 8 WP layout engine that can handle doc/docx.
It's 7 completely managed and can be used to export 6 to a variety of formats like image, XPS 5 or (with the help of a PDF library such 4 as ABCpdf) PDF.
I work on the ABCpdf .NET 3 software component so my replies may feature 2 concepts based around ABCpdf. It's just 1 what I know. :-)
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.