X
    Categories: PDF

Convert a Word Document to PDF

Following up on my last post, Convert an Image to Black & White PDF, I have updated the project to include a third method that converts document and vector formats to PDF. This conversion uses SVG as an intermediate format and does not require OCR, which results in perfect text accuracy.

Download the project

What it Does

This C# .NET 4 console application shows how to use LEADTOOLS to convert a Word Doc to document-based PDF, as well as convert an image to black & white raster-based and document-based PDF files.

Features Used

About 

Developer Advocate

    Find more about me on:
Gabriel Smith: Developer Advocate

View Comments

  • I'm interested in converting text and word formats to PDF in memory. Is your newly added method ExportPdfViaSvg? Can it be made to work on byte arrays instead of disk files?

    • Hi Star,The LoadSvg() method has an overload that can take a stream instead of a file on disk: LoadSvg DocumentationIf you would like to convert any file to be text in the resulting PDF instead of converting it to an image PDF, take a look at one of my later blog posts: https://www.leadtools.com/blog/document-imaging/convert-and-merge-to-pdf/To load a stream instead of a file from disk: Change this line of code to use the DocumentFactory.LoadFromStream() method instead of the DocumentFactory.LoadFromFile() method masterDocument.Pages.AddRange(DocumentFactory.LoadFromFile(inputFile, loadOptions).Pages);

    • Thank you for pointing that out! The link has been corrected. You may need to Ctrl-F5 the page.