🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.acrobat.sdk
3 messages
3 total messages Started by Steve_J_Willis Fri, 03 Apr 2009 16:23
Convert page size to pixels
#205
Author: Steve_J_Willis
Date: Fri, 03 Apr 2009 16:23
19 lines
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
Re: Convert page size to pixels
#208
Author: Leonard_Rosenthol
Date: Fri, 03 Apr 2009 17:30
5 lines
754 bytes
You don't need to deal with the AV stuff here - just the page size...

BUT you need to remember to multiply by the resolution...

Leonard
Re: Convert page size to pixels
#210
Author: Steve_J_Willis
Date: Fri, 03 Apr 2009 18:14
7 lines
1169 bytes
Could you give me a more concrete example? I don't understand how to get the page size without dealing with the AV stuff.

My question is probably simpler than I stated above: PDPageDrawContentsToWindow will draw the page to a bitmap of some size, measured in pixels. I need to know what that size is in advance so I can create a correctly sized bitmap for it to draw on to hold the entire page. How do I determine the width and height of the page image PDPageDrawContentsToWindow will draw in pixels?

Your help is appreciated!

Steve
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads