Parameters
- pageNumber
- An integer value which represents the page to render.
- options
- A RenderOptions object which contains information about how to render the page.
Return Value
Returns either an unmanaged HGLOBAL or a HGDIOBJ handle.
When options.ProduceDibSection=false, HGLOBAL is created.
When options.ProduceDibSection=true, HGDIOBJ is created.
This method creates an unmanaged Windows DIB section or a global memory buffer containing a packed bitmap (DIB).
Note: The produced object must be deleted specifically, as the .NET runtime garbage collectors cannot clear up unmanaged resources.
- If a DIB Section is produced, then options.ProduceDibSection=true and clean up can be done via a call to the Windows
DeleteObjectfunction.
C# Signature:
[DllImport("gdi32.dll")]
static extern bool DeleteObject(IntPtr hObject);
VB.NET Signature:
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As IntPtr) As Boolean
A call would look like:
int DIB=document.RenderPageToDib(0);
DeleteObject(new System.IntPtr(DIB));
- If a packed bitmap inside a global memory buffer is produced, then options.ProduceDibSection=false and clean up can be done via a call to Windows
GlobalFree.
C# Signature:
[DllImport("kernel32.dll")]
static extern IntPtr GlobalFree(IntPtr hObject);
VB.NET Signature:
Public Declare GlobalFree Lib "kernel32" (ByVal hObject As IntPtr) As Boolean As System.IntPtr
A call would look like:
int DIB=document.RenderPageToDib(0);
GlobalFree(new System.IntPtr(DIB));
Copy protected rendering functionality is to be used only for viewing of copy protected PDF documents. This functionality should not be used to violate or bypass PDF file security measures which prevent copying or editing the PDF documents.