DynaPDF Manual - Page 654
Previous Page 653 Index Next Page 655
Function Reference
Page 654 of 839
bd.Stride,
DynaPDF.TPDFPixFormat.pxfBGRA);
TPDFRasterImage img = new DynaPDF.TPDFRasterImage();
img.StructSize
= System.Runtime.InteropServices.Marshal.SizeOf(img);
img.InitWhite
= 1;
img.DefScale
= TPDFPageScale.psFitBest;
// A 32 bit image has a transparent background. The flag rfCompositeWhite makes sure that the
// image gets pre-blended with a white background.
img.Flags
= TRasterFlags.rfInitBlack | TRasterFlags.rfCompositeWhite;
img.Matrix.a
= 1.0; // Identity matrix
img.Matrix.d
= 1.0; // Identity matrix
// Render the page
m_PDF.RenderPage(pagePtr, ras, ref img);
bmp.UnlockBits(bd);
pictureBox1.Image
= bmp;
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
m_PDF.DeleteRasterizer(ref ras);
m_PDF.FreePDF();
}
RenderPageEx (Rendering Engine)
Syntax:
LBOOL pdfRenderPageEx(
const PPDF* IPDF,
// PDF Instance pointer
const void* DC,
// Handle of a device context (HDC)
SI32* DestX,
// Destination x-coordinate to blend the image
SI32* DestY,
// Destination y-coordinate to blend the image
IPGE* PagePtr,
// Page pointer
IRAS* RasPtr,
// Pointer oft he rasterizer
TPDFRasterImage* Img) // see RenderPage()
The function renders a PDF page into an image buffer in the same way as RenderPage(), but instead
of using a callback function to update the destination window, the function blends the image
directly into a device context. This function is mainly provided for programming languages in
which the usage of callback functions is too complicated or too slow, e.g. C#, VB .Net, VB 6, FoxPro
and so on.
The function calls internally the system function SetDIBitsToDevice() to copy the image buffer into
the device context. This function depends on the correct creation of the image buffer. Therefore, the
rendering engine provides additional helper functions to allocate and resize the image buffer if
necessary as well as to redraw the bitmap arbitrary often:
• CreateRasterizerEx() creates the rasterizer and a corresponding DIB Section that is
compatible to the device context. The function supports the pixel formats pxf1Bit, pxfGray,
pxfBGR, and pxfBGRA. The default pixel format on Windows is pxfBGR. The rasterizer is
the owner of the image buffer; it will be released when the rasterizer will be deleted.
Previous topic: How to save the image on disk?
Next topic: RenderPageToImage (Rendering Engine)