How to convert PDF to Word document in WinForms PDF library?
Code Snippe
//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();
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.
Conclusion
I hope you enjoyed learning about how to convert PDF to Word document in WinForms PDF library.
You can refer to our WinForms PDF feature tour page to know about its other groundbreaking feature representations and documentation, to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!