PDF Converter
The Sheetize PDF Converter for .NET offers advanced functionality for converting documents to and from PDF format, making it ideal for archiving, sharing, and ensuring consistent document formatting across different devices.
Key Features
Convert Various Formats to PDF
Convert documents from multiple formats, such as DOCX, HTML, and images, to PDF for easy distribution and printability.
Convert PDF to Other Formats
Convert PDF documents into other formats, such as DOCX, HTML, and images, for easy editing or integration into other workflows.
Detailed Guide
Converting Documents to PDF
To convert a document to PDF:
- Initialize the Converter: Create an instance of
PdfConverter
. - Set Conversion Options: Use
DocumentToPdfOptions
to configure settings such as page layout and compression. - Define Input and Output Paths: Set the paths for the input document and output PDF.
- Execute the Conversion: Call the
Process
method to convert the document.
Example: Convert DOCX to PDF
// Step 1: Initialize the PDF Converter
var converter = new PdfConverter();
// Step 2: Configure options for document to PDF conversion
var options = new DocumentToPdfOptions();
options.PageLayoutOption = PageLayoutOption.Portrait;
options.CompressionLevel = CompressionLevel.High;
// Step 3: Set file paths
options.AddInput(new FileDataSource("input.docx"));
options.AddOutput(new FileDataSource("output.pdf"));
// Step 4: Run the conversion
converter.Process(options);
Available Options for Document to PDF Conversion
- PageLayoutOption: Define the page layout for the resulting PDF (
Portrait
,Landscape
). - CompressionLevel: Specify the compression level for reducing file size (
Low
,Medium
,High
).
Converting PDF to Other Formats
To convert a PDF document into another format:
- Initialize the Converter: Create an instance of
PdfConverter
. - Configure Conversion Options: Use
PdfToDocumentOptions
to specify the output format and any customization. - Specify Paths: Set the input PDF and output document file paths.
- Execute the Conversion: Call the
Process
method to complete the conversion.
Example: Convert PDF to DOCX
// Step 1: Initialize the PDF Converter
var converter = new PdfConverter();
// Step 2: Configure options for PDF to DOCX conversion
var options = new PdfToDocumentOptions(DocumentFormat.Docx);
// Step 3: Set file paths
options.AddInput(new FileDataSource("input.pdf"));
options.AddOutput(new FileDataSource("output.docx"));
// Step 4: Execute the conversion
converter.Process(options);
Additional Options for PDF to Other Formats
- DocumentFormat: Specify the desired output format (
Docx
,Html
,Png
, etc.). - TextExtractionMode: Define how text is extracted from the PDF (
PlainText
,FormattedText
).
The Sheetize PDF Converter is an essential tool for managing documents, whether you need to create universally shareable PDF files or convert PDFs back to editable formats. It provides flexibility in both directions, making it a powerful addition to any developer’s toolkit.