C#: Convert HTML to PDF using ChromeHtmlConverter
HTML is widely used to present content in web browsers, but preserving its exact layout when sharing or printing can be challenging. PDF, by contrast, is a universally accepted format that reliably maintains document layout across various devices and operating systems. Converting HTML to PDF is particularly useful in web development, especially when creating printable versions of web pages or generating reports from web data.
Spire.PDF for .NET now supports a streamlined method to convert HTML to PDF in C# using the ChromeHtmlConverter class. This tutorial provides step-by-step guidance on performing this conversion effectively.
- Convert HTML to PDF with ChromeHtmlConverter in C#
- Generate Output Logs During HTML to PDF Conversion 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 DLLs files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Install Google Chrome
This method requires Google Chrome to perform the conversion. If Chrome is not already installed, you can download it from this link and install it.
Convert HTML to PDF using ChromeHtmlConverter in C#
You can utilize the ChromeHtmlConverter.ConvertToPdf() method to convert an HTML file to a PDF using the Chrome plugin. This method accepts 3 parameters, including the input HTML file path, output PDF file path, and ConvertOptions which allows customization of conversion settings like conversion timeout, PDF paper size and page margins. The detailed steps are as follows.
- Create an instance of the ChromeHtmlConverter class and provide the path to the Chrome plugin (chrome.exe) as a parameter in the class constructor.
- Create an instance of the ConvertOptions class.
- Customize the conversion settings, such as the conversion timeout, the paper size and page margins of the converted PDF through the properties of the ConvertOptions class.
- Convert an HTML file to PDF using the ChromeHtmlConverter.ConvertToPdf() method.
- C#
using Spire.Additions.Chrome; namespace ConvertHtmlToPdfUsingChrome { internal class Program { static void Main(string[] args) { //Specify the input URL and output PDF file path string inputUrl = @"https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/C-/VB.NET-Convert-Image-to-PDF.html"; string outputFile = @"HtmlToPDF.pdf"; //Specify the path to the Chrome plugin string chromeLocation = @"C:\Program Files\Google\Chrome\Application\chrome.exe"; //Create an instance of the ChromeHtmlConverter class ChromeHtmlConverter converter = new ChromeHtmlConverter(chromeLocation); // Create an instance of the ConvertOptions class ConvertOptions options = new ConvertOptions(); //Set conversion timeout options.Timeout = 10 * 3000; //Set paper size and page margins of the converted PDF options.PageSettings = new PageSettings() { PaperWidth = 8.27, PaperHeight = 11.69, MarginTop = 0, MarginLeft = 0, MarginRight = 0, MarginBottom = 0 }; //Convert the URL to PDF converter.ConvertToPdf(inputUrl, outputFile, options); } } }
The converted PDF file maintains the same appearance as if the HTML file were printed to PDF directly through the Chrome browser:
Generate Output Logs During HTML to PDF Conversion in C#
Spire.PDF for .NET enables you to generate output logs during HTML to PDF conversion using the Logger class. The detailed steps are as follows.
- Create an instance of the ChromeHtmlConverter class and provide the path to the Chrome plugin (chrome.exe) as a parameter in the class constructor.
- Enable Logging by creating a Logger object and assigning it to the ChromeHtmlConverter.Logger property.
- Create an instance of the ConvertOptions class.
- Customize the conversion settings, such as the conversion timeout, the paper size and page margins of the converted PDF through the properties of the ConvertOptions class.
- Convert an HTML file to PDF using the ChromeHtmlConverter.ConvertToPdf() method.
- C#
using Spire.Additions.Chrome; namespace ConvertHtmlToPdfUsingChrome { internal class Program { static void Main(string[] args) { //Specify the input URL and output PDF file path string inputUrl = @"https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/C-/VB.NET-Convert-Image-to-PDF.html"; string outputFile = @"HtmlToPDF.pdf"; // Specify the log file path string logFilePath = @"Logs.txt"; //Specify the path to the Chrome plugin string chromeLocation = @"C:\Program Files\Google\Chrome\Application\chrome.exe"; //Create an instance of the ChromeHtmlConverter class ChromeHtmlConverter converter = new ChromeHtmlConverter(chromeLocation); //Enable logging converter.Logger = new Logger(logFilePath); //Create an instance of the ConvertOptions class ConvertOptions options = new ConvertOptions(); //Set conversion timeout options.Timeout = 10 * 3000; //Set paper size and page margins of the converted PDF options.PageSettings = new PageSettings() { PaperWidth = 8.27, PaperHeight = 11.69, MarginTop = 0, MarginLeft = 0, MarginRight = 0, MarginBottom = 0 }; //Convert the URL to PDF converter.ConvertToPdf(inputUrl, outputFile, options); } } }
Here is the screenshot of the output log file:
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#: Convert PDF to Markdown
The need to convert PDF documents into more flexible and editable formats, such as Markdown, has become a common task for developers and content creators. Converting PDFs to Markdown files facilitates easier editing and version control, and enhances content portability across different platforms and applications, making it particularly suitable for modern web publishing workflows. By utilizing Spire.PDF for .NET, developers can automate the conversion process, ensuring that the rich formatting and structure of the original PDFs are preserved in the resulting Markdown files.
This article will demonstrate how to use Spire.PDF for .NET to convert PDF documents to Markdown format with C# code.
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 Documents to Markdown Files
With the Spire.PDF for .NET library, developers can easily load any PDF file using the PdfDocument.LoadFromFile(string filename) method and then save the document in the desired format by calling the PdfDocument.SaveToFile(string filename, FileFormat fileFormat) method. To convert a PDF to Markdown format, simply specify the FileFormat.Markdown enumeration as a parameter when invoking the method.
The detailed steps for converting PDF documents to Markdown files are as follows:
- Create an instance of PdfDocument class.
- Load a PDF document using PdfDocument.LoadFromFile(string filename) method.
- Convert the document to a Markdown file using PdfDocument.SaveToFile(string filename, FileFormat.Markdown) method.
- C#
using Spire.Pdf; namespace PDFToMarkdown { class Program { static void Main(string[] args) { // Create an instance of PdfDocument class PdfDocument pdf = new PdfDocument(); // Load a PDF document pdf.LoadFromFile("Sample.pdf"); // Convert the document to Markdown file pdf.SaveToFile("output/PDFToMarkdown.md", FileFormat.Markdown); // Release resources pdf.Close(); } } }
The PDF Document:
The Result Markdown File:
Convert PDF to Markdown by Streams
In addition to directly reading files for manipulation, Spire.PDF for .NET also supports loading a PDF document from a stream using PdfDocument.LoadFromStream() method and converting it to a Markdown file stream using PdfDocument.SaveToStream() method. Using streams reduces memory usage, supports large files, enables real-time data transfer, and simplifies data exchange with other systems.
The detailed steps for converting PDF documents to Markdown files by streams are as follows:
- Create a Stream object of PDF documents by downloading from the web or reading from a file.
- Load the PDF document from the stream using PdfDocument.LoadFromStream(Stream stream) method.
- Create another Stream object to store the converted Markdown file.
- Convert the PDF document to a Markdown file stream using PdfDocument.SaveToStream(Stream stream, FileFormat.Markdown) method.
- C#
using Spire.Pdf; using System.IO; using System.Net.Http; namespace PDFToMarkdownByStream { class Program { static async Task Main(string[] args) { // Create an instance of PdfDocument class PdfDocument pdf = new PdfDocument(); // Download a PDF document from a url as bytes using (HttpClient client = new HttpClient()) { byte[] pdfBytes = await client.GetByteArrayAsync("http://example.com/Sample.pdf"); // Create a MemoryStream using the bytes using (MemoryStream inputStream = new MemoryStream(pdfBytes)) { // Load the PDF document from the stream pdf.LoadFromStream(inputStream); // Create another MemoryStream object to store the Markdown file using (MemoryStream outputStream = new MemoryStream()) { // Convert the PDF document to a Markdown file stream pdf.SaveToStream(outputStream, FileFormat.Markdown); outputStream.Position = 0; // Reset the position of the stream for subsequent reads // Upload the result stream or write it to a file await client.PostAsync("http://example.com/upload", new StreamContent(outputStream)); File.WriteAllBytes("output.md", outputStream.ToArray()); } } } // Release resources pdf.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.
C#/VB.NET: Convert Multiple Images into a Single PDF
If you have multiple images that you want to combine into one file for easier distribution or storage, converting them into a single PDF document is a great solution. This process not only saves space but also ensures that all your images are kept together in one file, making it convenient to share or transfer. In this article, you will learn how to combine several images into a single PDF document 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
Combine Multiple Images into a Single PDF in C# and VB.NET
In order to convert all the images in a folder to a PDF, we iterate through each image, add a new page to the PDF with the same size as the image, and then draw the image onto the new page. The following are the detailed steps.
- Create a PdfDocument object.
- Set the page margins to zero using PdfDocument.PageSettings.SetMargins() method.
- Get the folder where the images are stored.
- Iterate through each image file in the folder, and get the width and height of a specific image.
- Add a new page that has the same width and height as the image to the PDF document using PdfDocument.Pages.Add() method.
- Draw the image on the page using PdfPageBase.Canvas.DrawImage() method.
- Save the document using PdfDocument.SaveToFile() method.
- C#
- VB.NET
using Spire.Pdf; using Spire.Pdf.Graphics; using System.Drawing; namespace ConvertMultipleImagesIntoPdf { class Program { static void Main(string[] args) { //Create a PdfDocument object PdfDocument doc = new PdfDocument(); //Set the page margins to 0 doc.PageSettings.SetMargins(0); //Get the folder where the images are stored DirectoryInfo folder = new DirectoryInfo(@"C:\Users\Administrator\Desktop\Images"); //Iterate through the files in the folder foreach (FileInfo file in folder.GetFiles()) { //Load a particular image Image image = Image.FromFile(file.FullName); //Get the image width and height float width = image.PhysicalDimension.Width; float height = image.PhysicalDimension.Height; //Add a page that has the same size as the image PdfPageBase page = doc.Pages.Add(new SizeF(width, height)); //Create a PdfImage object based on the image PdfImage pdfImage = PdfImage.FromImage(image); //Draw image at (0, 0) of the page page.Canvas.DrawImage(pdfImage, 0, 0, pdfImage.Width, pdfImage.Height); } //Save to file doc.SaveToFile("CombinaImagesToPdf.pdf"); doc.Dispose(); } } }
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 PowerPoint
PDF files are great for presenting on different types of devices and sharing across platforms, but it has to admit that editing PDF is a bit challenging. When you receive a PDF file and need to prepare a presentation based on the content inside, it is recommended to convert the PDF file to a PowerPoint document to have a better presentation effect and also to ensure the content can be further edited. This article will demonstrate how to programmatically convert PDF to PowerPoint presentation 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 PowerPoint Presentation in C# and VB.NET
From Version 8.11.10, Spire.PDF for .NET supports converting PDF to PPTX using PdfDocument.SaveToFile() method. With this method, each page of your PDF file will be converted to a single slide in PowerPoint. Below are the steps to convert a PDF file to an editable PowerPoint document.
- Create a PdfDocument instance.
- Load a sample PDF document using PdfDocument.LoadFromFile() method.
- Save the document as a PowerPoint document using PdfDocument.SaveToFile(string filename, FileFormat.PPTX) method.
- C#
- VB.NET
using Spire.Pdf; namespace PDFtoPowerPoint { class Program { static void Main(string[] args) { //Create a PdfDocument instance PdfDocument pdf = new PdfDocument(); //Load a sample PDF document pdf.LoadFromFile(@"C:\Users\Administrator\Desktop\Sample.pdf"); //Convert the PDF to PPTX document pdf.SaveToFile("ConvertPDFtoPowerPoint.pptx", FileFormat.PPTX); } } }
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 Linearized
PDF linearization, also known as "Fast Web View", is a way of optimizing PDF files. Ordinarily, users can view a multipage PDF file online only when their web browsers have downloaded all pages from the server. However, if the PDF file is linearized, the browsers can display the first page very quickly even if the full download has not been completed. This article will demonstrate how to convert a PDF to linearized 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 DLLs files can be either downloaded from this link or installed via NuGet.
- Package Manager
PM> Install-Package Spire.PDF
Convert PDF to Linearized
The following are the steps to convert a PDF file to linearized:
- Load a PDF file using PdfToLinearizedPdfConverter class.
- Convert the file to linearized using PdfToLinearizedPdfConverter.ToLinearizedPdf() method.
- C#
- VB.NET
using Spire.Pdf.Conversion; namespace ConvertPdfToLinearized { class Program { static void Main(string[] args) { //Load a PDF file PdfToLinearizedPdfConverter converter = new PdfToLinearizedPdfConverter("Sample.pdf"); //Convert the file to a linearized PDF converter.ToLinearizedPdf("Linearized.pdf"); } } }
Imports Spire.Pdf.Conversion Namespace ConvertPdfToLinearized Friend Class Program Private Shared Sub Main(ByVal args As String()) 'Load a PDF file Dim converter As PdfToLinearizedPdfConverter = New PdfToLinearizedPdfConverter("Sample.pdf") 'Convert the file to a linearized PDF converter.ToLinearizedPdf("Linearized.pdf") End Sub End Class End Namespace
Open the result file in Adobe Acrobat and take a look at the document properties, you can see the value of “Fast Web View” is Yes which means the file is linearized.
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 Grayscale (Black and White)
Converting a PDF with color images to grayscale can help you reduce the file size and print the PDF in a more affordable mode without consuming colored ink. In this article, you will learn how to achieve the conversion programmatically 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 DLLs files can be either downloaded from this link or installed via NuGet.
- Package Manager
PM> Install-Package Spire.PDF
Convert PDF to Grayscale
The following are the steps to convert a color PDF to grayscale:
- Load a PDF file using PdfGrayConverter class.
- Convert the PDF to grayscale using PdfGrayConverter.ToGrayPdf() method.
- C#
- VB.NET
using Spire.Pdf.Conversion; namespace ConvertPdfToGrayscale { class Program { static void Main(string[] args) { //Create a PdfGrayConverter instance and load a PDF file PdfGrayConverter converter = new PdfGrayConverter(@"Sample.pdf"); //Convert the PDF to grayscale converter.ToGrayPdf("Grayscale.pdf"); converter.Dispose(); } } }
Imports Spire.Pdf.Conversion Namespace ConvertPdfToGrayscale Friend Class Program Private Shared Sub Main(ByVal args As String()) 'Create a PdfGrayConverter instance and load a PDF file Dim converter As PdfGrayConverter = New PdfGrayConverter("Sample.pdf") 'Convert the PDF to grayscale converter.ToGrayPdf("Grayscale.pdf") converter.Dispose() End Sub End Class End Namespace
The input PDF:
The output 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 Excel
PDF is a versatile file format, but it is difficult to edit. If you want to modify and calculate PDF data, converting PDF to Excel would be an ideal solution. In this article, you will learn how to convert PDF to Excel 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
Convert PDF to Excel in C# and VB.NET
The following are the steps to convert a PDF document to Excel:
- Initialize an instance of PdfDocument class.
- Load the PDF document using PdfDocument.LoadFromFile(filePath) method.
- Save the document to Excel using PdfDocument.SaveToFile(filePath, FileFormat.XLSX) method.
- C#
- VB.NET
using Spire.Pdf; using Spire.Pdf.Conversion; namespace ConvertPdfToExcel { class Program { static void Main(string[] args) { //Initialize an instance of PdfDocument class PdfDocument pdf = new PdfDocument(); //Load the PDF document pdf.LoadFromFile("Sample.pdf"); //Save the PDF document to XLSX pdf.SaveToFile("PdfToExcel.xlsx", FileFormat.XLSX); } } }
Convert a Multi-Page PDF to One Excel Worksheet in C# and VB.NET
The following are the steps to covert a multi-page PDF to one Excel worksheet:
- Initialize an instance of PdfDocument class.
- Load the PDF document using PdfDocument.LoadFromFile(filePath) method.
- Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false.
- Set PDF to XLSX convert options using PdfDocument.ConvertOptions.SetPdfToXlsxOptions(XlsxLineLayoutOptions) method.
- Save the document to Excel using PdfDocument.SaveToFile(filePath, FileFormat.XLSX) method.
- C#
- VB.NET
using Spire.Pdf; using Spire.Pdf.Conversion; namespace ConvertPdfToExcel { class Program { static void Main(string[] args) { //Initialize an instance of PdfDocument class PdfDocument pdf = new PdfDocument(); //Load the PDF document pdf.LoadFromFile("Sample1.pdf"); //Initialize an instance of XlsxLineLayoutOptions class, in the class constructor, setting the first parameter - convertToMultipleSheet as false. //The four parameters represent: convertToMultipleSheet, showRotatedText, splitCell, wrapText XlsxLineLayoutOptions options = new XlsxLineLayoutOptions(false, true, true, true); //Set PDF to XLSX convert options pdf.ConvertOptions.SetPdfToXlsxOptions(options); //Save the PDF document to XLSX pdf.SaveToFile("PdfToOneExcelSheet.xlsx", FileFormat.XLSX); } } }
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 SVG to PDF
SVG is a file format for vector graphics, used to create images that can be scaled without loss of quality. However, PDF is more suitable for sharing and printing due to its support for high-quality printing, encryption, digital signatures, and other features. Converting SVG to PDF ensures good image display on different devices and environments, and better protects intellectual property. In this tutorial, we will show you how to convert SVG to PDF and how to add a SVG image to PDF 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 DLLs files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Convert SVG to PDF in C# and VB.NET
Spire.PDF for .NET provides the PdfDocument.SaveToFile(String, FileFormat) method, which allows users to save an SVG file as a PDF. The detailed steps are as follows.
- Create a PdfDocument object.
- Load a sample SVG file using PdfDocument.LoadFromFile() method.
- Convert the SVG file to PDF using PdfDocument.SaveToFile(String, FileFormat) method.
- C#
- VB.NET
using Spire.Pdf; namespace SVGtoPDF { class Program { static void Main(string[] args) { //Create a PdfDocument object PdfDocument doc = new PdfDocument(); //Load a sample SVG file doc.LoadFromSvg("Sample.svg"); //Save result document doc.SaveToFile("Result.pdf", FileFormat.PDF); doc.Dispose(); } } }
Add SVG image to PDF in C# and VB.NET
In addition to converting SVG to PDF directly, it also supports adding SVG image files to the specified locations in PDF. Please check the steps as below:
- Create a PdfDocument object and load an SVG file using PdfDocument. LoadFromSvg() method.
- Create a template based on the content of the SVG file using PdfDocument. Pages[].CreateTemplate() method.
- Get the width and height of the template on the page.
- Create another PdfDocument object and load a PDF file using PdfDocument.LoadFromFile() method.
- Draw the template with a custom size at a specified location using PdfDocument.Pages[].Canvas.DrawTemplate() method.
- Save to PDF file using PdfDocument.SaveToFile(String, FileFormat) method.
- C#
- VB.NET
using Spire.Pdf; using Spire.Pdf.Graphics; using System.Drawing; namespace AddSVGImagetoPDF { class Program { static void Main(string[] args) { //Create a PdfDocument object PdfDocument doc1 = new PdfDocument(); //Load an SVG file doc1.LoadFromSvg("C:\\Users\\Administrator\\Desktop\\sample.svg"); //Create a template based on the content of the SVG file PdfTemplate template = doc1.Pages[0].CreateTemplate(); //Get the width and height of the template float width = template.Width; float height = template.Height; //Create another PdfDocument object PdfDocument doc2 = new PdfDocument(); //Load a PDF file doc2.LoadFromFile("C:\\Users\\Administrator\\Desktop\\sample.pdf"); //Draw the template with a custom size at a specified location doc2.Pages[0].Canvas.DrawTemplate(template, new PointF(0, 0), new SizeF(width * 0.8f, height * 0.8f)); //Save to PDF file doc2.SaveToFile("AddSvgToPdf.pdf", FileFormat.PDF); doc2.Dispose(); } } }
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 PostScript (PS)
PostScript was developed by Adobe Systems in the 1980s as a way of turning digital graphics or text files into a fixed format ready for printing. With the passage time, although the PostScript (PS) file format is no longer as popular as it once was, now it is still supported by most printers. In this article, you will learn how to how to programmatically convert a PDF file to a PostScript (PS) file 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
Convert PDF to PostScript in C# and VB.NET
Converting PDF to PS can improve the quality of the printed output. With Spire.PDF for .NET, you can complete the conversion with only three lines of code. The following are the detailed steps.
- Create a PdfDocument instance.
- Load a sample PDF file using PdfDocument.LoadFromFile() method.
- Save the PDF file as a PS file using PdfDocument.SaveToFile(string filename, FileFormat.POSTSCRIPT) method.
- C#
- VB.NET
using Spire.Pdf; namespace PDFtoPS { class Program { static void Main(string[] args) { //Create a PdfDocument instance PdfDocument document = new PdfDocument(); //Load a sample PDF file document.LoadFromFile("Test.pdf"); //Save the PDF file as a PS file document.SaveToFile("toPostScript.ps", FileFormat.POSTSCRIPT); } } }
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 to PCL in C#/VB.NET
A PCL file is a Printer Command Language document. Printer Command Language is a page description language developed by HP as a printer protocol and has been widely supported in many printers now. Start from version 5.2.3, Spire.PDF supports converting PDF file to PCL format. There are six major levels of PCL, the PCL here refers to PCL 6 (PCL 6 Enhanced or PCL XL).
Example code
using Spire.Pdf; namespace PDFtoPCL { class Program { static void Main(string[] args) { //Create a PdfDocument instance PdfDocument pdf = new PdfDocument(); //Load the PDF file pdf.LoadFromFile("Input.pdf"); //Save to PCL format pdf.SaveToFile("ToPCL.pcl", FileFormat.PCL); } } }
Imports Spire.Pdf Namespace PDFtoPCL Class Program Private Shared Sub Main(args As String()) Dim pdf As PdfDocument = New PdfDocument() pdf.LoadFromFile("Input.pdf") pdf.SaveToFile("ToPCL.pcl", FileFormat.PCL) End Sub End Class End Namespace