Print Page | Close Window

Problem using QuickPDFRenderPageToFile with PNG

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1796
Printed Date: 13 Jun 25 at 1:06PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem using QuickPDFRenderPageToFile with PNG
Posted By: PedroLamas
Subject: Problem using QuickPDFRenderPageToFile with PNG
Date Posted: 07 Apr 11 at 2:48PM
Greetings,

I'm new to your forum, but the company I work on has bought and been using QuickPDF for a while now, always with full success!! :)

But yesterday, I came up with a problem: I have a file that I need to output its pages to PNG at 150dpi, but this seems to throw an exception (I'm using .NET 4.0 with Interop to QuickPDF 0724)

If I use:

QuickPDFRenderPageToFile(instanceID, 150, 1, 5, fileName); //PNG at 150dpi

this will raise an exception, but the following commands will work ok:

QuickPDFRenderPageToFile(instanceID, 100, 1, 5, fileName); //PNG at 100dpi 
QuickPDFRenderPageToFile(instanceID, 150, 1, 0, fileName); //BMP at 150dpi
QuickPDFRenderPageToFile(instanceID, 150, 1, 1, fileName); //JPEG at 150dpi
QuickPDFRenderPageToFile(instanceID, 150, 1, 7, fileName); //TIFF at 150dpi

Can you help me with this one please? :)

You can get the file I'm using that gives this problem here:
http://cid-b26d27fb6d61bde4.office.live.com/self.aspx/Public/d5514f41-5d7f-400a-837e-129041f480ee_001.pdf - http://cid-b26d27fb6d61bde4.office.live.com/self.aspx/Public/d5514f41-5d7f-400a-837e-129041f480ee^_001.pdf

Best regards and please keep up with your good work!!!

Pedro Lamas



Replies:
Posted By: Ingo
Date Posted: 07 Apr 11 at 6:40PM
Hi Pedro!

The page size from your pdf is 4544 x 4064 pixels.
A "normal" page size is 842 x 595 means (in german DIN A4).
with 72 dpi the size will be the same - with 100 or 150 it will be larger.
Seems that the included png-routines are not made for images with a size about 1.4 x 1.6 meters ;-)
If you're the meaning that this is a bug you should post it at the official support pages.

Cheers, Ingo





Posted By: PedroLamas
Date Posted: 08 Apr 11 at 10:38AM
Greetings Ingo,

First of all, let me thank you for your reply! :)

I know the original page is 4544x4064, but I really need it at 150dpi because this page (and others a little less "noisy") will be used for OCR/ICR, and 150dpi is the minimum DPI's we need to get an accurate result!
The problem is that if I output it as a BMP at 150dpi, it creates a file bigger that 200Mb, as for PNG the file will be at max 10Mb!

I'll make a post for a bug in the official support pages (I thought this was it, though, sorry!!)

Regards, Pedro Lamas


Posted By: darkv
Date Posted: 08 Apr 11 at 11:14PM
Pedro,

Why don't you use a Windows DC to clip your image (or a part of), and then you "band" your image to reduce the size you have to deal with (as printer does when it process a big file)

When you create the DC you can define the resolution for your device.

My fear is memory consumption for such an image, but could be a workaround.

please find below part of a vb.net code i used.

Hope this helps

Rgds


 Dim bmp As New Bitmap(iPw, iPH, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
 gDisp = Graphics.FromImage(bmp)
 hDCd = gDisp.GetHdc
  '
 lRtn = zPdf.RenderPageToDC(72, 1, hDCd)   ' DPI settings

Ps : dont forget to ".release" and ".dispose" variables ;-)



Posted By: AndrewC
Date Posted: 11 Apr 11 at 9:08AM

I am guessing the PDF developer of this PDF file made a wrong assumption and used 4544 x 4064 as the width and height.  The image in this file is actually 4544 x 4064 pixels in size so I am pretty sure this is why the page dimensions are wrong and why the image is so big.

The pageWidth/pageHeight are normally measured in points (72 points = 1 inch) and so the 4544 x 4064 needed to be scaled to points. ie.  1090 x 975.  This image is 300 dpi so 4544 / 300 * 92 = 1090 and 4064 / 300 * 72 = 975.

Using QPL to Render this file with the invalid page size consumed a 1 GB of memory.  It did render ok on my 8GB machine.  So some of the other ideas to render large files would be useful.

Andrew.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk