Article View: adobe.acrobat.sdk
Article #205Convert page size to pixels
From: Steve_J_Willis
Date: Fri, 03 Apr 2009 16:23
Date: Fri, 03 Apr 2009 16:23
19 lines
1945 bytes
1945 bytes
Two (possibly) related questions: (1) I am drawing the image of a page to an offscreen bitmap using PDPageDrawContentsToWindow. I need to allocate a correct height and width for the page in pixels for the resulting bitmap. What I want is an image that represents the size of the page at 100% zoom. This is what I've tried: ASFixedRect cropBox; PDPageGetCropBox(AVPageViewGetPage(pageView), &cropBox); AVDevRect pageRect; AVPageViewRectToDevice(pageView, &cropBox, &pageRect); double zoom = ASFixedToFloat(AVPageViewGetZoom(pageView)); int pageWidth = (int) (abs(pageRect.right - pageRect.left) / zoom); int pageHeight = (int) (abs(pageRect.bottom - pageRect.top) / zoom); The above width and height are too large for the image drawn to my bitmap by PDPageDrawContentsToWindow. (2) I notice that when I select File | Export | Image in Acrobat and save the page as a JPEG, the resulting image width and height are substantially larger than the width and height calculated in #1 (which are themselves too large for the PDPageDrawContentsToWindow function). How does Acrobat choose an optimal width/height to avoid aliasing? The size of my output image is arbitrary; I want to choose a width and height that are optimal to capture the image data of the original page, and understand how to scale the output of PDPageDrawContentsToWindow to those values. Thanks! Steve
Technical Details
Message-ID:
<59b88097.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: 10177e,bc087f948614e8ac,start X-Google-Attributes: gid10177e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Steve_J_Willis@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.acrobat.sdk Subject: Convert page size to pixels Message-ID: <59b88097.-1@webcrossing.la2eafNXanI> Date: Fri, 3 Apr 2009 09:23:28 -0700 Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit