Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Problem using QuickPDFRenderPageToFile with PNG
  FAQ FAQ  Forum Search   Register Register  Login Login

Problem using QuickPDFRenderPageToFile with PNG

 Post Reply Post Reply
Author
Message Reverse Sort Order
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Topic: Problem using QuickPDFRenderPageToFile with PNG
    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.
Back to Top
darkv View Drop Down
Team Player
Team Player
Avatar

Joined: 17 Jan 11
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote darkv Quote  Post ReplyReply Direct Link To This Post 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 ;-)

Back to Top
PedroLamas View Drop Down
Beginner
Beginner


Joined: 07 Apr 11
Location: Portugal
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote PedroLamas Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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



Back to Top
PedroLamas View Drop Down
Beginner
Beginner


Joined: 07 Apr 11
Location: Portugal
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote PedroLamas Quote  Post ReplyReply Direct Link To This Post 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:

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

Pedro Lamas
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store