This technical tip shows how to convert PDF file to DOC or DOCX format. A conversion that many of our customers have requested is PDF to DOC: converting a PDF file to a Microsoft Word document. Customers want this because PDF files cannot easily be edited, whereas Word documents can. Some companies want their users to be able to manipulate text, tables and images in files that started as PDFs.
Terms of Agreement:
By using this article, you agree to the following terms...
You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
You may link to this article from another website, but ONLY if it is not wrapped in a frame.
You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
This technical tip shows how to convert PDF file to DOC or DOCX format. Aspose.Pdf for .NET is flexible and supports a wide variety of conversions. Converting pages from PDF documents to images, for example, is a very popular feature. A conversion that many of our customers have requested is PDF to DOC: converting a PDF file to a Microsoft Word document. Customers want this because PDF files cannot easily be edited, whereas Word documents can. Some companies want their users to be able to manipulate text, tables and images in files that started as PDFs. Keeping alive the tradition of making things simple and understandable, Aspose.Pdf for .NET provides few lines code to transform source PDF file into a DOC file. The DocSaveOptions class provides numerous properties that improve the process of converting PDF files to DOC format. Among these properties, Mode enables you to specify the recognition mode for PDF content. You can specify any value from the RecognitionMode enumeration for this property.
Converting PDF to DOC
[C#]
// Path of input PDF document
String filePath = @"d:\\Source.pdf";
// Instantiate the Document object
Aspose.Pdf.Document document = new Aspose.Pdf.Document(filePath);
// Create DocSaveOptions object
DocSaveOptions saveOptions = new DocSaveOptions();
// Set the recognition mode as Flow
saveOptions.Mode = DocSaveOptions.RecognitionMode.Flow;
// Set the Horizontal proximity as 2.5
saveOptions.RelativeHorizontalProximity = 2.5f;
// Enable the value to recognize bullets during conversion process
saveOptions.RecognizeBullets = true;
// Save the resultant DOC file
document.Save(@"d:\\Resultant.doc", saveOptions);
[VB.NET]
' Path of input PDF document
Dim filePath As String = "d:\\Source.pdf"
' Instantiate the Document object
Dim document As Aspose.Pdf.Document = New Aspose.Pdf.Document(filePath)
' Create DocSaveOptions object
Dim saveOptions As DocSaveOptions = New DocSaveOptions()
' Set the recognition mode as Flow
saveOptions.Mode = DocSaveOptions.RecognitionMode.Flow
' Set the Horizontal proximity as 2.5
saveOptions.RelativeHorizontalProximity = 2.5F
' Enable the value to recognize bullets during conversion process
saveOptions.RecognizeBullets = True
' save the resultnat DOC file
document.Save("d:\\Resultant.doc", saveOptions)
Converting PDF to Docx format
[C#]
//open pdf document
Document pdfDocument = new Document("source.pdf");
// instantiate DocSaveOptions object
DocSaveOptions saveOptions = new DocSaveOptions();
// specify the output format as DOCX
saveOptions.Format = DocSaveOptions.DocFormat.DocX;
//save document in docx format
pdfDocument.Save("output.docx", saveOptions);
[VB.NET]
'open pdf document
Dim pdfDocument As Document = New Document("source.pdf")
' instantiate DocSaveOptions object
Dim saveOptions As DocSaveOptions = New DocSaveOptions()
' specify the output format as DOCX
saveOptions.Format = DocSaveOptions.DocFormat.DocX
' save document in docx format
pdfDocument.Save("output.docx", saveOptions)
More about Aspose.Pdf for .NET
- Homepage of Aspose.Pdf for .NET: http://www.aspose.com/.net/pdf-component.aspx
- Read More about Working with Document Conversion: http://www.aspose.com/docs/display/pdfnet/Working+with+Document+Conversion
- Download Aspose.Pdf for .NET at: http://www.aspose.com/community/files/51/.net-components/aspose.pdf-for-.net/default.aspx
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)