Convert from Word to PDF

0
danvonfeldt posted this 07 October 2017

Does the library have an ability to convert a word document to pdf? I'm able to generate the pdf from the template and save as pdf, but i'm wondering if I can just take a non templated word document and just convert it to pdf using the library?

24 Posts
24 Points
3 Comments
Order By: Standard | Newest | Votes
0
danvonfeldt posted this 07 October 2017

I think I got it.

        Document doc = Document.Load(inputFilePath);
        using (Stream reportDocumentStream = File.Create(outputFilePath))
        {
            doc.Save(reportDocumentStream, Docentric.Documents.ObjectModel.SaveOptions.Pdf);
        }

24 Posts
24 Points
1
jles posted this 07 October 2017

Hi,

Yes, you are correct. Your snippet is the right way to convert a MS Word document to PDF. Note that Docentric Toolkit consists of two parts:

  • Reporting (Docentric.Documents.Reporting): Allows you to create a Word document acting as a template and then populated with date from within an application.
  • Document Object Model (Docentric.Documents.ObjectModel): Provides DOM and general purpose document processing APIs to parse, convert, merge, split, find/replace, extract images, print documents, ...

Regards, Jure Leskovec

115 Posts
241 Points
0
danvonfeldt posted this 08 October 2017

ooh print documents! I'll need that as well, great.

24 Posts
24 Points

Our 4817 members have posted 264 times in 78 discussions