SetMaximumImagePixels overrides SetJPGQuality?

We are converting PDFs to XOD in Linux using the PHP wrappers. Our documents are very text oriented, so we want the images that are rastered to be lossless.

If we set the format to PNG, then the thumbnails are jacked up and are totally useless to us.

If we set the format to JPG and quality to 100, then we get correct thumbnails with a lossless image, however if we also set the SetMaximumImagePixels to 3 MP, the jpeg quality is ignored and in the example we used the quality it uses when converting to JPG is 75.

We would be fine using PNG if the thumbnails worked (or if we could have JPG thumbnails and PNG regular size images), but absent that, we need both JPG Quality AND Maximum Image Pixel settings to work.

Is this a bug with the shared library, with the PHP wrappers, or is there some decision it is making in the background that is overriding our settings?

Hello Thomas,

If we set the format to PNG, then the thumbnails are jacked up and are totally useless to us.

Could you go into more detail — what was wrong with the PNGs? Perhaps you could forward the converted XOD to support@pdftron.com for explication.

if we also set the SetMaximumImagePixels to 3 MP, the jpeg quality is ignored and in the example we used the quality it uses when converting to JPG is 75.

As well, could you forward the files in question? It would also be helpful to know the other settings (flattening, element limit, etc.) that you’re using. Also, what version of the PDFNet SDK or DocPub are you using to convert to XOD? Thank you for your help.

Stepping back, why do you need such high-quality thumbnails? The thumbnail should be displayed prior to rendering only. Sometimes, if WebViewer hits an error, rendering stops and only the thumbnail is displayed. Is that happening in your environment?

Thanks for the quick reply.

The specific PDF we are working with is a blueprint with a lot of elements, so there is a lot of rasterization occurring, even including some of the text, which is why we need it to be lossless.

When we use PNG format, many elements don’t show on the thumbnail and some thumbnails have a black background etc. Because the thumbnail doesn’t match the full page, we abandoned that in favor of JPEG at 100 quality, but then found out that the quality wasn’t always 100 when we set the Maximum Pixels to 3 MP. We decided that 2 MP was too little to let us zoom in on this particular PDF, so we set it at 3 MP so it would still work on most tablets. If we don’t set the Maximum Pixels (and let it default to 2 MP), the JPG quality is set to 100, but it is 75 if we set maximum pixels to 3 MP.

Also, we don’t need high quality thumbnails - we just need them to look like the actual page, and they don’t when we use PNG format. We are displaying the thumbnail first while the canvas is drawing the full page.

We are using version 6.2.0 of PDFNet SDK. These are the only options we use on this file to convert it to JPG:

$options = new XODOutputOptions();

$options->SetDPI( 300 );
$options->SetMaximumImagePixels(3000000);
$options->setJPGQuality(100);

I will send the file to the support email address.