How to convert PDF to high quality image in C#?

back to home  >  Tech FAQ  >  Convert PDF to high quality image in C#

Question:

Hi, support team.

Hi,support, I'm trying your .net PDF to image SDK, after I get the image files from the PDF, I need show them in a picture box with fixed size. But when I view the image in the picture box, I find the image is not clear, showing the graphs in blurry. Can you give me some advice to get the image in high quality or resolution?

---- Charles

Answer:

Hi, Charles.

In your case, the reason why image viewing blurry in the picture box may be you convert PDF page to a small size, such as 300X500. And the picture box size you defined is 600X900. While showing this image in the picture box, the image is stretched and enlarged, so that the image quality is decreased and become a little blurry.

Using .net PDF to image converter, there are two ways to resolve it. The first is changing the DPI property, the PDF converter always render the output image graphics depending on the input resolution. The higher DPI is setting, the higher resolution the converted images will have. The second is calling the API "ToImage(int pageIndex, int width, int height)". According to this method, you are able to define the output image's width and height. So you can convert PDF page to image with big size, no need be enlarged, and the image graphs will keep a clear view.

All the image formats, such as jpg, tiff, png, bmp and gif, except the multi-page tiff, support to the DPI property and the resizing api. The multiple pages tiff only support DPI property to change the image quality.

Here we give you some C# demo code for setting the DPI property in the PDFDocument class.

PDFDocument doc = new PDFDocument();
doc.LoadPDF("sample.pdf");

doc.DPI = 200;

Bitmap bmp = doc.ToImage(0);
bmp.Save("quality.jpg");

Hope the C# code can be helpful.

---- pqScan Support Team

Online Demo Download Trial Problem with converting PDF to image in Mac. How to use .NET PDF converter in Mono? Can .net PDF to image converter integrate to Windows7 or Windows8? Can I Get a Compression Jpeg Image from PDF ? How to convert PDF to high quality image in C#? How to get transparent background png from PDF document in C#? Support Converting specific pages from PDF to images in C# .NET ? Converting specific languagePDF to images is possible? Is convert special page size PDF to image possible? Converting specific style PDF to images is allowed?