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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to convert PDF document to Word document?

Platform: WPF |
Control: PDF |
Published Date: November 15, 2017 |
Last Revised Date: April 16, 2019 |
.NET Framework: 4.5.1

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.

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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