> Tech FAQ
> Convert PDF to high quality image in C#
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?
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.DPI = 200;
Bitmap bmp = doc.ToImage(0);
Hope the C# code can be helpful.
---- pqScan Support Team