DynaPDF Manual - Page 668

Previous Page 667   Index   Next Page 669

Function Reference
Page 668 of 860
Example:
Frame rectangle filled with an
Without the frame rectangle there
arbitrary color.
is no way to determine where the
page contents starts or ends.
Page area
Page area
Whether a frame rectangle should be drawn or not depends on the way how a page is rendered into
the destination window. If the viewer processes mainly simple PDF files then it is possible to render
pages simply on demand. The page can then directly be scaled into the destination image and in this
case it is usually best to draw the page into a frame rectangle.
However, scrolling and zooming becomes too slow when more complex pages must be rendered. To
achieve optimal processing speed as well as smoth and flicker free scrolling the viewer should
render the page into an image in the size of the scaled page format so that the finish image can be
scrolled. The background or the frame rectangle must be drawn by the viewer application in this
case.
To calculate the required image size in pixels the rendering engine provides helper functions to
access the page's bounding boxes as well as the page orientation fast as possible (see GetPageBBox()
and GetPageOrientation()).
The image size can be calculated as follows (C++):
UI32 w = 0, h = 0;
UI32 fw = 2540, fh = 1440; // Size of output rectangle in pixels
// Get a pointer of the page object to enable fast access to the page
// properties.
IPGE* pagePtr = pdfGetPageObject(m_PDF, pageNum);
// CalcPagePixelSize() returns the height of the image in this example.
// RenderPage() calculates the image size in the exact same way when
// called with the same parameters.
rasCalcPagePixelSize(pagePtr,psFitWidth,1.0f,fw,fh,rfDefault,&w,&h);
 

Previous topic: Blending Color Spaces, Rendering PDF Pages

Next topic: The Transformation Matrix