Saving Word DOCX Files in PDF

I use openxml to create Word DOCX files. I would like to save these documents as soon as they are created as PDF files. Is there any way to do this in openxml? I assume the answer is no. If this is not the case, is there a recommended library or tool that I can use to save / print DOCX files in PDF format (programmatically, in .NET)? I looked at sharpPDF (PDFSharp) and it seems that this library is only for creating PDF files from scratch, and not for saving DOCX in PDF format.

Is there any way to fully print on an installed PDF printer, either Cute PDF, or a PDF printer built into Windows 7?

Update: the search is free with a non-virus license and, preferably, does not require additional installations.

+8
c # pdf openxml docx
source share
5 answers

You can do this with Word Automation. You need to set the word.

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(); 
+9
source share

To get from DocX → PDF you need something that can display the DocX file and provide the ability to export / save PDF. Needless to say, there are not many tools that DocX can display (Word, OpenOffice / LibreOffice and some other licensed products mentioned below). Depending on the constraints / runtime requirements, you might try:

  • use MS Automation to force Word to download docx and save as PDF.
  • tools that sit on top of OpenOffice (JODConverter / Docmosis) to perform the conversion.
  • try to implement other document libraries (Aspose, Windward)

I'm not sure if automatic printing is necessary.

+2
source share

I have successfully used the Aspose toolkit for this in the past: stack overflow It is not free, but you can demo before you buy it.

+1
source share

I used this VBScript and it works well. It works in the background (opens docx and saves in PDF format using the option "Save / export as PDF"). Check the system requirements listed on the page.

0
source share

We are creating WordGlue.NET, which is a universal WP layout engine that can handle doc / docx.

It is fully managed and can be used to export to various formats such as image, XPS or (using a PDF library such as ABCpdf) PDF.

I am working on the ABCpdf.NET software component, so my answers may contain concepts based on ABCpdf. This is what I know. :-)

0
source share

All Articles