We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to convert PDF document to Word document?

The PDF document can be converted to Word document by exporting the PDF document pages as images using PDF library and then the exported images can be added to the WordDocument using the DocIO Library. Please find the code snippet and sample for the same from below link,

 

Code Snippet:

 

//Creates a new Word document.

WordDocument m_wordDocument = new WordDocument();

 

//Adds new section to the document.

IWSection section = m_wordDocument.AddSection();

 

//Sets the page margins to zero.

section.PageSetup.Margins.All = 0;

 

//Adds new paragraph to the section.

IWParagraph firstParagraph = section.AddParagraph();

 

SizeF defaultPageSize = new SizeF(m_wordDocument.LastSection.PageSetup.PageSize.Width, m_wordDocument.LastSection.PageSetup.PageSize.Height);

 

//Loads the PDF document from the given file path.

using (PdfLoadedDocument m_loadedDocument = new PdfLoadedDocument(m_filePath))

{

        for (int i = 0; I < m_loadedDocument.Pages.Count ; i++)

        {

              //Exports the PDF document page as image with the given size.

              using (Image image = m_loadedDocument.ExportAsImage(i, defaultPageSize,false))

              {

                   //Adds image to the paragraph

                   IWPicture picture = firstParagraph.AppendPicture(image);

 

                  //Sets width and height for the image.

                  picture.Width = image.Width;

                  picture.Height = image.Height;

              }

         }

};

 

//Saves the Word document

m_wordDocument.Save("Save.docx");

 

//Close the document.

m_wordDocument.Dispose();

 

 

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/PDFToWordSample-1317895491.zip

 

Note: Since we have achieved the PDF document to Word document by exporting the images from the PDF document, we cannot edit the converted Word document.

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
8084 11/15/2017 11/15/2017 WinForms PDF 4.5.1
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon