C#.NET PDF to Word Library
How to convert PDF file to Word .docx document programmatically without interop using c#.NET code in ASP.NET
Online C#.NET Source Code for fast Converting PDF pages to Word (.doc/ .docx) Document programmatically with .NET XDoc.PDF Library on C# class, ASP.NET web forms (aspx), ajax, Azure, Sharepoint, WinForms
In this tutorial, you will learn how to convert Adobe PDF file to Microsoft Word (.dox) documents programmatically using C# in .NET Windows, ASP.NET web applications.
- Convert PDF to Word document
- Convert scanned PDF to editable Word document
- No 3rd party software installed. Not using interop.
- Batch conversion in ASP.NET web app optimized
How to Convert a PDF file to Word programmatically using C#
- Best C#.NET PDF to Microsoft Office Word converter SDK for exporting PDF to Word in Visual Studio .NET
- Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
- High quality Library for converting PDF to Word in both .NET WinForms and ASP.NET application using C# programming language
- Free .NET conversion control easy to be embedded to any .NET framework on Windows 32-bit and 64-bit without registration key
- Quick to remove watermark and save PDF text, image, table, hyperlinks (url links), fillable forms and bookmark to Word without losing formatting
- Powerful components for batch converting PDF documents in C#.NET program
- Convert large PDF file size (larger than 10mb) to MS Office Word formats such as .doc and .docx, like Adobe Acrobat Pro
-
PDF library also provides:
c# convert csv to pdf,
c# code to convert tiff to pdf,
convert pdf to image in asp.net c#,
convert pdf to tiff using c#,
convert images to pdf c#,
sharepoint convert word to pdf c#,
c# export excel sheet to pdf.
- Working with OCR SDK, you can extract formatted text content from scanned PDF files in C#
- Free online full trial download package to create editable Word file online or offline
- Password protected PDF file can be printed to Word for mail merge
- C# source code is available for copying and using in .NET Class
RasterEdge Visual C# .NET PDF to Word (DOC/DOCX) converter library control (XDoc.PDF) is a mature and effective PDF document converting utility.
Using this PDF to Word converting library control, .NET developers can quickly convert PDF document to Word file using Visual C# code.
This C#.NET PDF to Word(DOC/DOCX) conversion library can help developers convert multi-page PDF document to multi-page Word file
or convert each PDF document page to separate Word file.
The most outstanding feature of this PDF to Word converting toolkit is its industry-leading converting accuracy.
The Word file, converted by RasterEdge PDF to Word converter toolkit, preserves the structure & layout of target PDF document,
keeps the elements (like images, tables and chats) of original PDF file and maintains the original text style (including font, size, color, links and boldness).
Why do we need this PDF to Word converting library? In the daily-life applications, you often need to use and edit PDF document content for certain purpose.
But without licensed third-party software, you can hardly edit PDF document. Under this situation, you need to convert PDF document to
some easily editable files like Word document.
RasterEdge XDoc.PDF empowers your C#.NET application with advanced PDF to Word conversion functionality. Microsoft Office Word 2003, 2007
and later versions are compatible with this product.
How to convert PDF to Word (.docx) document programmatically without interop using C#
Below are the steps and C# sample source code to convert an existing PDF file to Word document using C#.
- Create a new PDFDocument object from an existing PDF file
- Call method ConvertToDocument to convert PDFDocument object to Word document and output to a file.
- Call method ConvertToDocument to convert PDFDocument object to Word document and output to a Strem object.
// file path to file path
String inputPath = @"C:\demo.pdf";
String outputPath = @"C:\output.docx";
PDFDocument doc = new PDFDocument(inputPath);
doc.ConvertToDocument(DocumentType.DOCX, outputPath);
// stream to stream
String inputPath = @"";
byte[] arr = File.ReadAllBytes(inputPath);
Stream inputStream = new MemoryStream(arr);
PDFDocument doc = new PDFDocument(inputStream);
Stream outputStream = new MemoryStream();
doc.ConvertToDocument(DocumentType.DOCX, outputStream);
Convert scanned PDF to Word (.docx) using C#
Add the following C# example source code will show how to convert scanned pdf document into Microsoft Word document (.docx)
Note: the following code need XImage.OCR SDK.
String inputFilePath = @"C:\demo_1.pdf";
String tempFilePath = @"C:\output.pdf";
String outputFilePath = @"C:\output.docx";
// The folder that contains '.traineddata' files.
OCRHandler.SetTrainResourcePath(@"C:\Source");
PDFDocument doc = new PDFDocument(inputFilePath);
int pageCount = doc.GetPageCount();
MemoryStream[] streams = new MemoryStream[pageCount];
for (int i = 0; i < doc.GetPageCount(); i++)
{
streams[i] = new MemoryStream();
OCRPage page = OCRHandler.Import(doc.GetPage(i));
page.Recognize();
page.SaveTo(MIMEType.PDF, streams[i]);
}
PDFDocument.CombineDocument(streams, tempFilePath);
PDFDocument doc1 = new PDFDocument(tempFilePath);
doc1.ConvertToDocument(DocumentType.DOCX, outputFilePath);
C# convert two or multiple editable PDF files to Word documents (batch converter)
String inputDirectory = "C:\input\";
String outputDirectory = "C:\output\";
String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
foreach (String filePath in files)
{
int startIdx = filePath.LastIndexOf("\\");
int endIdx = filePath.LastIndexOf(".");
String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
PDFDocument doc = new PDFDocument(filePath);
doc.ConvertToDocument(DocumentType.DOCX, outputDirectory + docName + ".docx");
}
C# creating word document from multiple pdf files combined, merged in asp.net
String inputDirectory = @"C:\input\";
String outputDirectory = @"C:\output\";
String[] files = Directory.GetFiles(inputDirectory, "*.pdf");
List<ConversionArgs> args = new List<ConversionArgs>();
foreach (String filePath in files)
{
int startIdx = filePath.LastIndexOf("\\");
int endIdx = filePath.LastIndexOf(".");
String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
ConversionArgs arg = new ConversionArgs(filePath, outputDirectory + docName + ".docx");
args.Add(arg);
}
List<Thread> threads = new List<Thread>();
foreach (ConversionArgs arg in args)
{
Thread thread = new Thread(pdfToWordThread);
thread.Start(arg);
}
foreach (Thread thread in threads)
{
thread.Join();
}