How to generate very high-quality thumbnails using PDFNet SDK?


How do I generate very high-quality thumbnails using PDFNet SDK?

I use anti-aliasing and built-in rasterizer but I would still need to
further improve the quality of the PDF page thumbnail.

If you call pdfdraw.SetAntiAliasing(true), PDFNet will use anti-
aliasing (smoothing) to remove appearance of jaggies. The problem is
that at small resolutions the page geometry is so small that this
smoothing effect can produce fuzzy thumbnail. To go around this you
could generate a bit larger bitmap (say twice the width) and then
scale it down using bilinear-interpolation (i.e. System.Drawing.
Bitmap.GetThumbnailImage(w/2, h/2)). Scaling-down from much larger
bitmap is also ok, however you will probably not see noticeable
improvements (of course if you already need to rasterize large image,
then you can also use it as the source image to create the thumbnail).

For example:

pdftron.PDF.PDFDraw pdfDraw = new pdftron.PDF.PDFDraw();
pdfDraw.SetImageSize(width*2, height*2);
Bitmap bitmap = pdfDraw.GetBitmap(page);

// Scale down from master image using bilinear interpolation
bitmap = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero));