Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

Thumbnails for PDF pages are distorted

More
10 years 4 months ago #9739 by deepaksharma
If asked for a thumbnail image with small width and height, the image generated seems quite distorted with single lines appearing choppy though the original PDF page is very clear.
We have tried to get thumbnail with width 100 and height 80.
If asked for a thumbnail with higher width and height, the image generated is quite clear.

We are using the below code to get thumbnail previews for PDF pages

PDF_DIB m_dib = NULL;
PDF_DIB bmp = Global_dibGet(m_dib, imageWidth, imageHeight);
float ratiox = imageWidth/w;
float ratioy = imageHeight/h;

if (ratiox>ratioy) {
ratiox = ratioy;
}
ratiox = ratiox * 1.0;
PDF_MATRIX mat = Matrix_createScale(ratiox, -ratiox, 0, h * ratioy);
Page_renderPrepare(page.handle, bmp);
Page_render(page.handle, bmp, mat, false, 1);
Matrix_destroy(mat);
page = nil;

void *data = Global_dibGetData(bmp);
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, data, imageWidth * imageHeight * 4, NULL);
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
CGImageRef imgRef = CGImageCreate(imageWidth, imageHeight, 8, 32, imageWidth<<2, cs, kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, provider, NULL, FALSE, kCGRenderingIntentDefault);
CGColorSpaceRelease(cs);
CGDataProviderRelease(provider);

UIImage *imgDef = [UIImage imageWithCGImage:imgRef];
More
10 years 4 months ago #9742 by emanuele
Hi,

can you share the pdf used for this test?
also a screenshot could help to better understand your issue.
Time to create page: 0.383 seconds
Powered by Kunena Forum