AVAILABLE NOW: Spring 2025 Release
By Apryse | 2025 Apr 08
7 min
Tags
docx
C#
java
pdf conversion
There are many reasons why you might want to convert to or from a PDF document. Perhaps you need to make a PDF editable or text searchable. Or maybe you would prefer a PDF to be a DOC or DOCX file, but you don't want to copy/paste the text or lose the original formatting. You might even need to batch convert a ton of PDFs in the same way. Good news! The Apryse SDK is an easy to integrate tool able to handle all of your document and image conversion needs.
Behind the scenes, the Apryse SDK uses artificial intelligence to select the right combination of Apryse Raster, SVG, and OCR technologies to convert images and documents with both speed and precision.
Over the next few weeks, we will demonstrate the versatility of our document conversion technology by showing you how to convert to and from specific formats. Today's blog focuses on how to convert PDFs to Word formats (DOC/DOCX).
Easily convert PDFs to Word (DOC/DOCX) documents with Apryse. The following example is in C#, but Apryse supports several other languages, including Java. First, download the Apryse SDK and then use this code to convert the files.
using pdftron;
using pdftron.Common;
using pdftron.PDF;
namespace Convert_Files_with_Document_Converter
{
class Program
{
static void Main(string[] args)
{
// The first step in every application using PDFNet is to initialize the
// library. The library is usually initialized only once, but calling
// Initialize() multiple times is also fine.
PDFNet.Initialize("Replace with your license key");
PDFNet.AddResourceSearchPath(@"path to structured output module lib");
if (!StructuredOutputModule.IsModuleAvailable())
{
Console.WriteLine();
Console.WriteLine("Unable to run the sample: Apryse SDK Structured Output module not available.");
Console.WriteLine("-----------------------------------------------------------------------------");
Console.WriteLine("The Structured Output module is an optional add-on, available for download");
Console.WriteLine("at https://docs.apryse.com/core/info/modules/. If you have already");
Console.WriteLine("downloaded this module, ensure that the SDK is able to find the required files");
Console.WriteLine("using the PDFNet::AddResourceSearchPath() function.");
Console.WriteLine();
return;
}
string inputPath = @"path to input PDF file";
string outputPath = @"path to output DOCX file";
try
{
// Convert PDF document to Word
Console.WriteLine("Converting PDF to Word");
pdftron.PDF.Convert.ToWord(inputPath, outputPath);
Console.WriteLine("Result saved in " + outputPath);
}
catch (PDFNetException e)
{
Console.WriteLine("Unable to convert PDF document to Word, error: " + e.Message);
}
catch (Exception e)
{
Console.WriteLine("Unknown Exception, error: ");
Console.WriteLine(e);
}
}
}
}
For more information on this example, check out our full tutorial on the Apryse SDK.
We can do the same conversion process using Java with the following code.
import com.pdftron.common.PDFNetException;
import com.pdftron.pdf.Convert;
import com.pdftron.pdf.PDFNet;
import com.pdftron.pdf.StructuredOutputModule;
public class PdfToDocx {
// Just a simple setup for the application
public static void main(String[] args) {
// PDFNet must always be initialized before any Apryse
// classes and methods can be used
PDFNet.initialize("Place your Apryse Key here");
PDFNet.addResourceSearchPath("path to structured output module");
try {
if (!StructuredOutputModule.isModuleAvailable()) {
System.out.println();
System.out.println("Unable to run the sample: Apryse SDK Structured Output module not available.");
System.out.println("-----------------------------------------------------------------------------");
System.out.println("The Structured Output module is an optional add-on, available for download");
System.out.println("at https://docs.apryse.com/core/info/modules/. If you have already");
System.out.println("downloaded this module, ensure that the SDK is able to find the required files");
System.out.println("using the PDFNet::AddResourceSearchPath() function.");
System.out.println();
return;
}
} catch (PDFNetException e) {
System.out.println(e);
return;
} catch (Exception e) {
System.out.println(e);
return;
}
String inputPath = "path to input PDF file";
String outputPath = "path to output DOCX file";
try {
// Convert PDF document to Word
System.out.print("Converting PDF to Word");
Convert.toWord(inputPath, outputPath);
System.out.print("Result saved in " + outputPath);
} catch (PDFNetException e) {
System.out.println(e);
e.getStackTrace();
}
PDFNet.terminate();
}
}
For more information on the Apryse SDK, check out our full tutorial on the Apryse SDK.
That’s all there is to converting files from PDF to Word formats, but why stop there? Check out all of the Apryse SDK supported formats.
Download the Apryse SDK for free. It’s fully functional and comes with free chat and email support.
Stay tuned for more conversion examples to see how Apryse will easily fit into any workflow converting PDF files into other document files or images and back again. Need help in the meantime? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team.
Tags
docx
C#
java
pdf conversion
Apryse
Share this post
PRODUCTS
Platform Integrations
End User Applications
Popular Content