views:

5138

answers:

5

Hello there,

I understand iTextSharp can be used for converting a document to pdf.

But first we have to create a document from scratch using iTextSharp.text.Document and then adding elements to this document.

What if I have an existing doc file, is it possible to convert this document to pdf using iTextSharp.

Also, I want to use iTextSharp or any similar tool which can perform following on a doc file:

  1. manipulation of doc/docx/text files (like replacing some placeholders with DB values) as well as
  2. converts them to .pdf

Anyone having idea about this, please share.

Thank you!

A: 

For docx manipulation, you should use native Open XML method. Download Open XML SDK 2 from Microsoft.

And then you can convert docx files to pdf with this paid library: http://www.subsystems.com/dpw.htm . It's really great.

mucit
+1  A: 

The Aspose.Words component can do this reliably (I'm not affiliated or anything).

iTextSharp does not have the required feature set to load and process MS Word file formats.

Lucero
Thank you all for your help.For my current scenerio, I will be using Aspose library to do doc/docx manipulation and then finally converting the result document to pdf after mail merge. I have downloaded the free 30-days trial version and it seems to solve all my issues. I would suggest anyone going to use Aspose to have the trial version first and then making the decision.
inutan
A: 

iTextSharp is a little complicate and professional.it seems i should know C# language.My friend mentioned one Word to PDF tool to me once,it seems to called Simpo Word to PDF.you can search it in google. hope it can help you.

A: 

If you do not care about whether the formatting will be faithful to what Word would display, there is the impressive docx2tex which converts Word 2007 docx files to Latex documents. Once in Latex, you have a lot of power to programmitically reformat the document, and generate PDF from it.

Charles Stewart
+1  A: 

Aspose.Words is indeed a good solution, but it doesn't offer perfect fidelity. At the time of writing it has problems with non Roman languages, complex formatting such as floating elements and a number of other problems.

You may want to have a look at this PDF Conversion Web Service that can be used from any Web Services capable environment including Java and .NET.

Note that I worked on this project so the usual disclaimers apply.

Muhimbi
PDF Conversion Web Service just invokes Microsoft Word to convert documents to PDF. That is just Word Automation anyone can do that.
romeok
It does quite a bit more actually, but knowing who you are you are as biased as I am :-) Nice work on Aspose.Words, great product, I recommend it all the time.
Muhimbi