Convert PDF to PCL using C#
Converting a PDF to PCL (Printer Command Language) in C# can be an essential task for developers working with printing solutions. PCL is a well-established page description language used by many laser printers, and converting documents into this format allows for more efficient and accurate printing.
In this article, we will explore the process of converting PDFs to PCL format in C# using Spire.PDF for .NET, including batch conversion for processing multiple files efficiently.
- • Install Spire.PDF for .NET
- • How to Convert PDF to PCL in C#
- • Batch Conversion of PDF to PCL using C#
Install Spire.PDF for .NET
To get started, you’ll need to install the Spire.PDF for .NET library in your project. The easiest way to do this is via NuGet.
- 1.Open “NuGet Package Manager” in Visual Studio.
- 2.Search for “Spire.PDF” and install the package.
Alternatively, you can run the following command in the Package Manager Console:
PM> Install-Package Spire.PDF
How to Convert PDF to PCL in C#
Once the Spire.PDF library is installed, you're ready to start converting PDF documents into PCL. The classes and methods used for conversion are explained below:
- PdfDocument: This class represents the PDF document you're working with.
- LoadFromFile(): This method loads the PDF file into the PdfDocument object.
- SaveToFile(): This method saves the loaded PDF document in the specified format (PCL in this case).
Code Example:
- C#
using Spire.Pdf;
namespace PDFtoPCL
{
class Program
{
static void Main(string[] args)
{
// Create a PdfDocument instance
PdfDocument pdf = new PdfDocument();
// Load a PDF file
pdf.LoadFromFile("Input1.pdf");
// Save to PCL format
pdf.SaveToFile("PdfToPcl.pcl", FileFormat.PCL);
pdf.Close();
}
}
}

Batch Conversion of PDF to PCL using C#
If you need to convert a large number of PDF files in a folder, you can perform batch conversion by following the below steps and code:
- 1. Get all PDF files in a specified folder using the Directory.GetFiles() method.
- 2. Use foreach loop to iterate over each PDF file.
- 3. Load each PDF file into the PdfDocument object.
- 4. Generate the output PCL file path, and then convert the PDF to PCL.
Code Example:
- C#
using Spire.Pdf;
using System.IO;
namespace PDFtoPCL
{
class Program
{
static void Main(string[] args)
{
string pdfFolder = @"F:\PDFs\";
string pclFolder = @"F:\PCLs\";
// Get all PDF files in a folder
string[] pdfFiles = Directory.GetFiles(pdfFolder, "*.pdf");
// Iterate through each PDF file
foreach (string pdfFile in pdfFiles)
{
// Load the PDF file into the PdfDocument object
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(pdfFile);
// Define the file path and file name of the output PCL file
string outputFile = Path.Combine(pclFolder, Path.GetFileNameWithoutExtension(pdfFile) + ".pcl");
// Save PDF as PCL file
pdf.SaveToFile(outputFile, FileFormat.PCL);
pdf.Close();
}
}
}
}

Conclusion
With Spire.PDF for .NET, converting PDFs to PCL in C# becomes straightforward, whether you're handling individual files or bulk operations. Its robust API makes it an excellent choice for automating printing workflows or integrating conversion features into applications.
Get a Free License
To fully experience the capabilities of Spire.PDF for .NET without any evaluation limitations, you can request a free 30-day trial license.
Convert the PDF to word, HTML, SVG, XPS and save them to stream
This article we will demonstrate how to convert the PDF pages to HTML, Word, SVG, XPS, PDF and save them to stream by calling the method PdfDocument.SaveToStream() offered by Spire.PDF. And starts from Spire.PDF version 4.3, it newly supports to convert the defined range of PDF pages and save them to stream.
Save the PDF to stream
Step 1: Create a new PdfDocument instance and load the sample document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
Step 2: Save the document to stream.
MemoryStream ms=new MemoryStream (); pdf.SaveToStream(ms);
Save the PDF to stream and defined the file format to HTML, Word, SVG, XPS and PDF
Step 1: Create a new PdfDocument instance and load the sample document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
Step 2: Save the document to stream and use FileFormat format to define the format.
MemoryStream ms=new MemoryStream (); pdf.SaveToStream(ms, FileFormat.HTML);
Convert the defined range of PDF pages to HTML, word, SVG, XPS and save them to stream
Step 1: Create a new PdfDocument instance and load the sample document from file.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
Step 2: Only save some PDF pages to stream by using pdf.SaveToStream(int startIndex, int endIndex, FileFormat format) method; and FileFormat.PDF is not supported.
pdf.SaveToStream(1, 2, FileFormat.SVG);
Full codes of save PDF to stream:
using Spire.Pdf;
using System.IO;
namespace SavePDFToStream
{
class Program
{
static void Main(string[] args)
{
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
MemoryStream ms = new MemoryStream();
pdf.SaveToStream(ms);
pdf.SaveToStream(ms, FileFormat.HTML);
pdf.SaveToStream(1, 2, FileFormat.SVG);
}
}
}
Convert PDF to SVG with Custom Width and Height in C#, VB.NET
We've have demonstrated how to convert PDF page to SVG file format in the previous post. This guidance shows you how we can specify the width and height of output file using the latest version of Spire.PDF with C# and VB.NET.
Step 1: Load a sample PDF document to PdfDocument instance.
PdfDocument document = new PdfDocument();
document.LoadFromFile("pdf-sample.pdf");
Step 2: Specify the output file size through ConvertOptions.SetPdfToSvgOptions() method.
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
Step 3: Save PDF to SVG file format.
document.SaveToFile("result.svg", FileFormat.SVG);
Output:

Full Code:
using Spire.Pdf;
namespace ConvertPDFtoSVG
{
class Program
{
static void Main(string[] args)
{
PdfDocument document = new PdfDocument();
document.LoadFromFile("pdf-sample.pdf");
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
document.SaveToFile("result.svg", FileFormat.SVG);
}
}
}
Imports Spire.Pdf
Namespace ConvertPDFtoSVG
Class Program
Private Shared Sub Main(args As String())
Dim document As New PdfDocument()
document.LoadFromFile("pdf-sample.pdf")
document.ConvertOptions.SetPdfToSvgOptions(800F, 1200F)
document.SaveToFile("result.svg", FileFormat.SVG)
End Sub
End Class
End Namespace
C#: Convert PDF to HTML
PDF documents have been a popular choice for sharing information due to their cross-platform compatibility and ability to preserve the original layout and formatting. However, as the web continues to evolve, there is an increasing demand for content that can be easily integrated into websites and other online platforms. In this context, converting PDF to HTML format has become highly valuable. By converting PDF files to more flexible and accessible HTML, users gain the ability to better utilize, share, and reuse PDF-based information within the web environment. In this article, we will demonstrate how to convert PDF files to HTML format in C# using Spire.PDF for .NET.
- Convert PDF to HTML in C#
- Set Conversion Options When Converting PDF to HTML in C#
- Convert PDF to HTML Stream in C#
Install Spire.PDF for .NET
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Convert PDF to HTML in C#
To convert a PDF document to HTML format, you can use the PdfDocument.SaveToFile(string fileName, FileFormat.HTML) method provided by Spire.PDF for .NET. The detailed steps are as follows.
- Create an instance of the PdfDocument class.
- Load a PDF document using the PdfDocument.LoadFromFile(string fileName) method.
- Save the PDF document to HTML format using the PdfDocument.SaveToFile(string fileName, FileFormat.HTML) method.
- C#
using Spire.Pdf;
namespace ConvertPdfToHtml
{
internal class Program
{
static void Main(string[] args)
{
// Create an instance of the PdfDocument class
PdfDocument doc = new PdfDocument();
// Load a PDF document
doc.LoadFromFile("Sample.pdf");
// Save the PDF document to HTML format
doc.SaveToFile("PdfToHtml.html", FileFormat.HTML);
doc.Close();
}
}
}

Set Conversion Options When Converting PDF to HTML in C#
The PdfConvertOptions.SetPdfToHtmlOptions() method allows you to customize the conversion options when transforming PDF files to HTML. This method takes several parameters that you can use to configure the conversion process, such as:
- useEmbeddedSvg (bool): Indicates whether to embed SVG in the resulting HTML file.
- useEmbeddedImg (bool): Indicates whether to embed images in the resulting HTML file. This option is applicable only when useEmbeddedSvg is set to false.
- maxPageOneFile (int): Specifies the maximum number of pages to be included per HTML file. This option is applicable only when useEmbeddedSvg is set to false.
- useHighQualityEmbeddedSvg (bool): Indicates whether to use high-quality embedded SVG in the resulting HTML file. This option is applicable when useEmbeddedSvg is set to true.
The following steps explain how to customize the conversion options when transforming a PDF to HTML using Spire.PDF for .NET.
- Create an instance of the PdfDocument class.
- Load a PDF document using the PdfDocument.LoadFromFile(string fileName) method.
- Get the PdfConvertOptions object using the PdfDocument.ConvertOptions property.
- Set the PDF to HTML conversion options using PdfConvertOptions.SetPdfToHtmlOptions(bool useEmbeddedSvg, bool useEmbeddedImg, int maxPageOneFile, bool useHighQualityEmbeddedSvg) method.
- Save the PDF document to HTML format using PdfDocument.SaveToFile(string fileName, FileFormat.HTML) method.
- C#
using Spire.Pdf;
namespace ConvertPdfToHtmlWithCustomOptions
{
internal class Program
{
static void Main(string[] args)
{
// Create an instance of the PdfDocument class
PdfDocument doc = new PdfDocument();
// Load a PDF document
doc.LoadFromFile("Sample.pdf");
// Set the conversion options to embed images in the resulting HTML and limit one page per HTML file
PdfConvertOptions pdfToHtmlOptions = doc.ConvertOptions;
pdfToHtmlOptions.SetPdfToHtmlOptions(false, true, 1, false);
// Save the PDF document to HTML format
doc.SaveToFile("PdfToHtmlWithCustomOptions.html", FileFormat.HTML);
doc.Close();
}
}
}
Convert PDF to HTML Stream in C#
Instead of saving a PDF document to an HTML file, you can save it to an HTML stream by using the PdfDocument.SaveToStream(Stream stream, FileFormat.HTML) method. The detailed steps are as follows.
- Create an instance of the PdfDocument class.
- Load a PDF document using the PdfDocument.LoadFromFile(string fileName) method.
- Create an instance of the MemoryStream class.
- Save the PDF document to an HTML stream using the PdfDocument.SaveToStream(Stream stream, FileFormat.HTML) method.
- C#
using Spire.Pdf;
using System.IO;
namespace ConvertPdfToHtmlStream
{
internal class Program
{
static void Main(string[] args)
{
// Create an instance of the PdfDocument class
PdfDocument doc = new PdfDocument();
// Load a PDF document
doc.LoadFromFile("Sample.pdf");
// Save the PDF document to HTML stream
using (var fileStream = new MemoryStream())
{
doc.SaveToStream(fileStream, FileFormat.HTML);
// You can now do something with the HTML stream, such as Write it to a file
using (var outputFile = new FileStream("PdfToHtmlStream.html", FileMode.Create))
{
fileStream.Seek(0, SeekOrigin.Begin);
fileStream.CopyTo(outputFile);
}
}
doc.Close();
}
}
}
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Convert PDF Page to SVG in C#/VB.NET
Spire.PDF allows us to convert a PDF document, a single page or a range of pages in a PDF document to SVG file format. We have introduced how to convert a PDF document to SVG, in this tutorial, we are going to demonstrate how to convert a PDF page to SVG.
Below is the source PDF file we used in this example:

Code snippets:
Step 1: Instantiate an object of PdfDocument class and load the PDF document.
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("Test.pdf");
Step 2: Convert the first page of the PDF document to SVG using the SaveToFile(string filename, int startIndex, int endIndex, FileFormat fileFormat) method.
doc.SaveToFile("Result.svg", 0, 0, FileFormat.SVG);
The resultant SVG file looks as follows:

Full code:
using Spire.Pdf;
namespace PDF_Page_to_SVG
{
class Program
{
static void Main(string[] args)
{
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("Test.pdf");
doc.SaveToFile("Result.svg", 0, 0, FileFormat.SVG);
}
}
}
Imports Spire.Pdf
Namespace PDF_Page_to_SVG
Class Program
Private Shared Sub Main(args As String())
Dim doc As New PdfDocument()
doc.LoadFromFile("Test.pdf")
doc.SaveToFile("Result.svg", 0, 0, FileFormat.SVG)
End Sub
End Class
End Namespace
How to keep high quality image when convert XPS to PDF in C#
We have already had an article of showing how to convert the XPS files into PDF file. Starts from Spire.PDF V3.8.68, it newly supports to keep the high quality image on the resulted PDF file from the XPS document. Spire.PDF offers a property of pdf.UseHighQualityImage to set the image quality before loading the original XPS file. This article will focus on demonstrate how to save image with high quality for the conversion from XPS to PDF.
Here comes to the code snippets:
Step 1: Create a PDF instance.
PdfDocument pdf = new PdfDocument();
Step 2: Set the value of UseHighQualityImage as true to use the high quality image when convert XPS to PDF.
pdf.UseHighQualityImage = true;
Step 3: Load the XPS document by use either the method of pdf.LoadFromFile() or pdf.LoadFromXPS().
pdf.LoadFromFile("Sample.xps",FileFormat.XPS);
Step 4: Save the document to file.
pdf.SaveToFile("result.pdf");
Effective screenshot of the high quality image after saving XPS as PDF file format:

Full codes:
using Spire.Pdf;
namespace ConvertXPStoPDF
{
class Program
{
static void Main(string[] args)
{
PdfDocument pdf = new PdfDocument();
pdf.UseHighQualityImage = true;
pdf.LoadFromFile("Sample.xps", FileFormat.XPS);
//pdf.LoadFromXPS("Sample.xps");
pdf.SaveToFile("result.pdf", FileFormat.PDF);
}
}
}
C#/VB.NET: Convert PDF to SVG
SVG (Scalable Vector Graphics) is an image file format used for rendering two-dimensional images on the web. Comparing with other image file formats, SVG has many advantages such as supporting interactivity and animation, allowing users to search, index, script, and compress/enlarge images without losing quality. Occasionally, you may need to convert PDF files to SVG file format, and this article will demonstrate how to accomplish this task using Spire.PDF for .NET.
- Convert a PDF File to SVG in C#/VB.NET
- Convert Selected PDF Pages to SVG in C#/VB.NET
- Convert a PDF File to SVG with Custom Width and Height in C#/VB.NET
Install Spire.PDF for .NET
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Convert a PDF File to SVG in C#/VB.NET
Spire.PDF for .NET offers the PdfDocument.SaveToFile(String, FileFormat) method to convert each page in a PDF file to a single SVG file. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Convert the PDF file to SVG using PdfDocument.SaveToFile(String, FileFormat) method.
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Convert PDF to SVG
document.SaveToFile("PDFtoSVG.svg", FileFormat.SVG);
}
}
}

Convert Selected PDF Pages to SVG in C#/VB.NET
The PdfDocument.SaveToFile(String, Int32, Int32, FileFormat) method allows you to convert the specified pages in a PDF file to SVG files. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Convert selected PDF pages to SVG using PdfDocument.SaveToFile(String, Int32, Int32, FileFormat) method.
- C#
- VB.NET
using Spire.Pdf;
namespace PDFPagetoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a sample PDF file
doc.LoadFromFile("input.pdf");
//Convert selected PDF pages to SVG
doc.SaveToFile("PDFPagetoSVG.svg", 1, 2, FileFormat.SVG);
}
}
}

Convert a PDF File to SVG with Custom Width and Height in C#/VB.NET
The PdfConvertOptions.SetPdfToSvgOptions() method offered by Spire.PDF for .NET allows you to specify the width and height of output SVG file. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Set PDF convert options using PdfDocument.ConvertOptions property.
- Specify the width and height of output SVG file using PdfConvertOptions.SetPdfToSvgOptions() method.
- Convert the PDF file to SVG using PdfDocument.SaveToFile() method.
- C#
- VB.NET
using Spire.Pdf;
namespace PDFtoSVG
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Load a sample PDF file
document.LoadFromFile("input.pdf");
//Specify the width and height of output SVG file
document.ConvertOptions.SetPdfToSvgOptions(800f, 1200f);
//Convert PDF to SVG
document.SaveToFile("result.svg", FileFormat.SVG);
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Covert PDF to EMF image file format in C#
Spire.PDF supports to save the PDF files into different image file formats, such as BMP, JPG, PNG, GIF and TIFF. It also supports to save the PDF files as the Enhanced Metafile (EMF) image file format. This article will demonstrate how to save the PDF file as the EMF image file format in C#. With the help of Spire.PDF, we only need three lines of codes to finish the conversion function.
Note: Before Start, please download the latest version of Spire.PDF and add Spire.Pdf.dll in the bin folder as the reference of Visual Studio.
Here comes to the steps of how to export the PDF file to EMF in C#:
Step 1: Create a new PDF document and load from file.
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("sample.pdf");
Step 2: Call to use the SaveAsImage method to save all the PDF pages as System.Drawing.Imaging.ImageFormat.Emf file format.
for (int i = 0; i < doc.Pages.Count; i++)
{
String fileName = String.Format("Sample-img-{0}.emf", i);
using (Image image = doc.SaveAsImage(i, Spire.Pdf.Graphics.PdfImageType.Metafile, 300, 300))
{
image.Save(fileName, System.Drawing.Imaging.ImageFormat.Emf);
}
}
Effective screenshot:

Full codes:
using Spire.Pdf;
using System;
using System.Drawing;
namespace ConvertPDFtoEMF
{
class Program
{
static void Main(string[] args)
{
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("sample.pdf");
for (int i = 0; i < doc.Pages.Count; i++)
{
String fileName = String.Format("Sample-img-{0}.emf", i);
using (Image image = doc.SaveAsImage(i, Spire.Pdf.Graphics.PdfImageType.Metafile, 300, 300))
{
image.Save(fileName, System.Drawing.Imaging.ImageFormat.Emf);
}
}
}
}
}
C#/VB.NET: Convert PDF to PDF/A
PDF/A is an ISO-standardized version of PDF that supports archiving of files for future use. Documents in PDF/A format can be reproduced in exactly the same way regardless of the software used. Due to its advantages in long-term preservation of digital documents, it may sometimes be necessary to convert PDF to PDF/A. In this article, you will learn how to programmatically convert PDF to PDF/A-1A, 2A, 3A, 1B, 2B and 3B compliant PDF using Spire.PDF for .NET.
Install Spire.PDF for .NET
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Convert PDF to PDF/A
The detailed steps are as follows.
- Specify the input file path and output folder
- Create a PdfStandardsConverter instance and pass in the input file as a parameter.
- Convert the input file to PdfA1A conformance level using PdfStandardsConverter.ToPdfA1A() method.
- Convert the input file to PdfA1B conformance level using PdfStandardsConverter.ToPdfA1B() method.
- Convert the input file to PdfA2A conformance level using PdfStandardsConverter.ToPdfA2A() method.
- Convert the input file to PdfA2B conformance level using PdfStandardsConverter.ToPdfA2B() method.
- Convert the input file to PdfA3A conformance level using PdfStandardsConverter.ToPdfA3A() method.
- Convert the input file to PdfA3B conformance level using PdfStandardsConverter.ToPdfA3B() method.
- C#
- VB.NET
using System;
using Spire.Pdf.Conversion;
namespace ConvertPdf2Pdfa
{
class Program
{
static void Main(string[] args)
{
//Specify input file path
String inputFile = @"C:\Users\Administrator\Desktop\sample.pdf";
//Specify output folder
String outputFolder = @"C:\Users\Administrator\Desktop\Output\";
//Create a PdfStandardsConverter instance, passing in the input file as a parameter
PdfStandardsConverter converter = new PdfStandardsConverter(inputFile);
//Convert to PdfA1A
converter.ToPdfA1A(outputFolder + "ToPdfA1A.pdf");
//Convert to PdfA1B
converter.ToPdfA1B(outputFolder + "ToPdfA1B.pdf");
//Convert to PdfA2A
converter.ToPdfA2A(outputFolder + "ToPdfA2A.pdf");
//Convert to PdfA2B
converter.ToPdfA2B(outputFolder + "ToPdfA2B.pdf");
//Convert to PdfA3A
converter.ToPdfA3A(outputFolder + "ToPdfA3A.pdf");
//Convert to PdfA3B
converter.ToPdfA3B(outputFolder + "ToPdfA3B.pdf");
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
C#/VB.NET: Convert PDF to Word
PDF format is the best choice in many cases, but Word is more flexible when editing or modification is needed. PDF files are typically used for online sharing, printing and archiving, while Word documents are used for creating, editing and formatting documents. Converting a PDF to Word is a good option if you want to re-edit the PDF document. In this article, you will learn how to programmatically convert PDF to Word in C# and VB.NET using Spire.PDF for .NET.
Install Spire.PDF for .NET
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Background Knowledge
Spire.PDF for .NET provides two modes of conversion. The advantages and disadvantages of these two modes are as follows:
- Fixed Layout Mode: The fixed layout mode has fast conversion speed and is conducive to maintaining the original appearance of PDF files to the greatest extent. However, the editability of the resulting document will be limited since each line of text in PDF will be presented in a separate frame in the generated Word document.
- Flow Recognition Mode: The flow recognition mode is a full recognition mode. The converted content will not be presented in frames, and the structure of the resulting document is flowable. The generated Word document is easy to re-edit but may look different from the original PDF file.
Convert PDF to Fixed-Layout Doc/Docx in C#, VB.NET
By default, the PdfDcoument.SaveToFile() method will convert PDF to Word with fixed layout. The following are the detailed steps.
- Create a PdfDocument object.
- Load a PDF file using PdfDocument.LoadFromFile() method.
- Convert the PDF document to a Doc or Docx format file using PdfDocument.SaveToFile(String fileName, FileFormat fileFormat) method.
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFixedLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Convert PDF to Doc and save it to a specified path
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx and save it to a specified path
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Convert PDF to Flexible-Structured Doc/Docx in C#, VB.NET
In addition to the default conversion engine, Spire.PDF for .NET provides another engine called Ps mode, which works better with the flow recognition mode. To enable Ps conversion engine and flow recognition mode, pass (true, true) as the parameters of the PdfDocument.ConvertOptions.SetPdfToDocOptions(bool usePsMode, bool useFlowRecognitionMode) method. The entire steps are as follows.
- Create a PdfDocument object.
- Load a PDF file using PdfDocument.loadFromFile() method.
- Enable Ps conversion engine and flow recognition mode using PdfDocument.ConvertOptions.SetPdfToDocOptions(true, true) method.
- Convert the PDF document to a Doc or Docx format file using PdfDocument.SaveToFile() method.
- C#
- VB.NET
using Spire.Pdf;
namespace ConvertPdfToFlexibleLayoutWord
{
class Program
{
static void Main(string[] args)
{
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
//Load a PDF document
doc.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf");
//Specify the PDF to Word conversion options
doc.ConvertOptions.SetPdfToDocOptions(true, true);
//Convert PDF to Doc
doc.SaveToFile("output/ToDoc.doc", FileFormat.DOC);
//Convert PDF to Docx
doc.SaveToFile("output/ToDocx.docx", FileFormat.DOCX);
doc.Close();
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.