SetBookmark

 

 

Adds a bookmark that points to the last printed line in the document. Can only be used with the Compact PDF, PDF, and PDF/A output file formats. Cannot be used with the PDF Image or other output file formats.

 

SetBookmark (hDC As Long, dwParent As Integer, szTitle As String) As Integer

 

Parameters

 

hDC           

-          Handle to the device context used for printing. Returned by the CreateDC Windows API function or the Graphics.GetHdc() .NET method.

dwParent   

-          Identifier of the parent bookmark returned by a previous call to SetBookmark, or 0 for top-level bookmarks.

szTitle        

-          The title of the bookmark

 

Return value

 

The function returns the identifier of the created bookmark, or 0 on failure.

 

Code Example

 

private static void PrintDocument1_PrintPage(object sender, PrintPageEventArgs ev)

{

 

// Print a line

ev.Graphics.DrawString("Black Ice test page.", font, Brushes.Black, 100, 100);

 

// Call SetBookmark to create a bookmark that points to the first line

int bookmark1 = BlackIceDEVMODE.SetBookmark((long)ev.Graphics.GetHdc(), 0, "Bookmark 1");

ev.Graphics.ReleaseHdc();

     

// Print another line

ev.Graphics.DrawString("Another line of the test page.", font, Brushes.Black, 100, 200);

 

// Call SetBookmark to create a bookmark that points to the second line that is also the children of the first bookmark

BlackIceDEVMODE.SetBookmark((long)ev.Graphics.GetHdc(), bookmark1, _T("Bookmark 2"));

ev.Graphics.ReleaseHdc();

 

}

 

NOTE: For 32-bit applications , use pBlackIceDEVMODE as Integer, instead of Long.