PDF to JPEG Converter
The Documentize PDF to JPEG Converter for .NET is a powerful tool that simplifies the conversion of PDF documents into high-quality JPEG images. This plugin is designed to make your content more accessible across platforms by transforming PDF pages into widely-used image formats.
Key Features:
- Convert PDF to JPEG: Effortlessly convert entire PDF documents or specific pages into JPEG images.
- Custom Resolution: Adjust the resolution (e.g., 300 dpi) for high-quality outputs.
- Page Range: Select specific pages or ranges for conversion.
- Batch Processing: Convert multiple PDF pages or entire documents at once.
- Quick Conversion: Fast and efficient process with minimal effort.
How to Convert PDF Pages to JPEG
To convert a PDF document into JPEG images, follow these steps:
- Create an instance of the
Jpeg
class. - Create an instance of
JpegOptions
to configure the conversion process. - Add the input PDF file using the
AddInput
method. - Specify the output file path for the JPEG images using the
AddOutput
method. - Run the
Process
method to convert the PDF pages into JPEG images.
1var converter = new Jpeg();
2var options = new JpegOptions();
3
4// Add the input PDF file
5options.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
6
7// Specify output directory for JPEG images
8options.AddOutput(new FileDataSource(@"C:\Samples\images"));
9
10// Process the PDF to JPEG conversion
11converter.Process(options);
Customizing PDF to JPEG Conversion
You can customize the conversion process by adjusting resolution, selecting page ranges, or setting image quality. Here’s how to convert the first page of a PDF at 300 dpi:
1var converter = new Jpeg();
2var options = new JpegOptions();
3
4// Set output resolution to 300 dpi and convert only the first page
5options.OutputResolution = 300;
6options.PageRange = new PageRange(1);
7
8// Add input and output paths
9options.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
10options.AddOutput(new FileDataSource(@"C:\Samples\output_page_1.jpg"));
11
12// Process the conversion
13converter.Process(options);
Batch Processing for PDF to JPEG Conversion
The PDF to JPEG Converter plugin supports batch processing, allowing you to convert multiple pages from a PDF into individual JPEG files.
1var converter = new Jpeg();
2var options = new JpegOptions();
3
4// Add input PDF file
5options.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
6
7// Set output paths for each page
8options.AddOutput(new FileDataSource(@"C:\Samples\output_page_1.jpg"));
9options.AddOutput(new FileDataSource(@"C:\Samples\output_page_2.jpg"));
10
11// Process the batch conversion
12converter.Process(options);
How to Handle Conversion Results
The Process method returns a ResultContainer
object that holds information about the conversion results. You can print the paths of the converted JPEG files as shown below:
1ResultContainer resultContainer = converter.Process(options);
2
3// Print the output paths of the JPEG images
4foreach (FileResult result in resultContainer.ResultCollection)
5{
6 Console.WriteLine(result.Data.ToString());
7}