Skip to content

926838 - Add Readme file for PDFPagetoImage sample #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions PDF-to-image/.NET/PDFPage-to-Image/PDFPage-to-Image/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Create or Generate images from PDF in .NET application

This Syncfusion® PDF to image converter library allows converting PDF documents to images without opening the document.Plaese refer [PdfToImageConverter](https://help.syncfusion.com/document-processing/pdf/conversions/pdf-to-image/net/convert-pdf-to-image) documentation.

## Steps to create images from PDF in .NET application

Step 1: Create a new .NET Console application.

Step 2: Install the [Syncfusion.PdfToImageConverter.Net](https://www.nuget.org/packages/Syncfusion.PdfToImageConverter.Net/) [NuGet package]

Step 3: Add the Data folder and Output folder parallel to the Program.cs file.Data folder will hold the PDF files that you want to convert.Output Folder will store the resulting image files after conversion.

Step 4: Add the following namespaces and code in application Programe.cs file.

```
using Syncfusion.PdfToImageConverter;
using System.IO;

//Initialize PDF to Image converter.
PdfToImageConverter imageConverter = new PdfToImageConverter();

//Load the PDF document as a stream
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.ReadWrite);

imageConverter.Load(inputStream);

//Convert PDF to Image.
Stream outputStream = imageConverter.Convert(0, false, false);

//Rewind the stream position to the beginning before copying.
outputStream.Position = 0;

//Create file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.jpeg"), FileMode.Create, FileAccess.ReadWrite))
{
//Save the image to file stream.
outputStream.CopyTo(outputFileStream);
}
//Dispose the imageConverter
imageConverter.Dispose();
```
Step 5 : Run the application, and the images will be saved in the Output folder.

You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/WPF-PDFViewer-Examples/tree/master/PDF-to-image/.NET/PDFPage-to-Image)
Loading