I have extracted the pdf page as an image by using the below code snippet,but on changing the size of the bitmap the text content in the image is not sharp, it is blurry Can you suggest a solution for improving the quality of the rendered image.
var data = bitmapImage.LockBits(
new Rectangle(0, 0, Width, Height),
ImageLockMode.ReadWrite,
bitmapImage.PixelFormat
);
int bytes = Math.Abs(data.Stride) * bitmapImage.Height;
var createdpages = PdfiumViewer.FPDFBitmap_CreateEx(
Width,
Height,
4,
data.Scan0,
bitmapImage.Width * 4
);
PdfiumViewer.FPDFBitmap_FillRect(
createdpages, 0, 0,
Width,
Height,
0xFFFFFFFF
);
PdfiumViewer.FPDF_RenderPageBitmap(
createdpages,
pages, 0, 0,
Width,
Height, 0, 0
);
Kindly provide a solution for rendering the image with shapness
pdfium renders the page at 300 dpi. If the image is blurry, it's most likely the image in the pdf has low dpi.
You could try reducing the height and width of the output to make the image less blurry, to reduce the amount of zooming to fit the small image in the rendered bitmap.
User contributions licensed under CC BY-SA 3.0