How to create PDF in .Net? Use Word power! E-mail

We often forgot that Microsoft Word has ability to work with big number of file formats.
But when we want to add PDF output for our desktop application, probably the simplest way to do it is to use Microsoft Word power.

The main requirement for client environment here is:

Presence of [Microsoft Word 2010] or [Microsoft Word 2007 + 2007 Microsoft Office Add-in: Microsoft Save as PDF (free)].

Steps to implement PDF output are:

  1. Add AWordReport to your project. It will be used to render Word document based on .DOC/.DOCX/* template.
  2. Generate document with AWordReport and save it as PDF.

That’s all.

To make quick test just open any demo project from AWordReport package and replace this line:

aWordReport1.RenderToScreen(GetTemplateFileName());

with this code:

aWordReport1.RenderToFile(GetTemplateFileName(), @"c:\a.pdf", WdSaveFormat.wdFormatPDF); //Render & save document as .PDF

Of course such way you can export Word document to any format supported by Microsoft Word – .HTML, .PDF,  .RTF, .TXT  e.t.c.

 

 

Newsflash

.PDF output in .Net application
details..