Convert PDF to Word (DOCX) in C# and VB.NET
You can use PdfLoadType.HighFidelity
to load a PDF file that should be converted to another file format.
High-fidelity loading doesn't try to detect logical structure of the PDF document, instead it absolutely positions elements on the page. The saved DOCX file (or other file type) is then visually almost identical to the original PDF. You can read more about the various types of loading PDF and how to choose one in the PDF loading article.
The following example shows how you can convert a PDF file to DOCX with GemBox.Document using high-fidelity loading.
using GemBox.Document;
class Program
{
static void Main()
{
// If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
var document = DocumentModel.Load("%InputFileName%",
new PdfLoadOptions()
{
LoadType = PdfLoadType.HighFidelity
});
document.Save("ConvertedFromPdf.docx");
}
}
Imports GemBox.Document
Module Program
Sub Main()
' If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Dim document = DocumentModel.Load("%InputFileName%",
New PdfLoadOptions() With
{
.LoadType = PdfLoadType.HighFidelity
})
document.Save("ConvertedFromPdf.docx")
End Sub
End Module