Adds a formatted bookmark that points to the last printed line in the document. Text formatting for bookmarks may not be available in all PDF viewers. 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.
SetFormattedBookmark (hDC As Long, dwParent As integer, szTitle As String, bRed As Short, bGreen As Short, bBlue As Short, bBold As Boolean, bItalic As Boolean) 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 |
bRed, bGreen, bBlue |
- The color of the bookmark. The values must be between 0 and 255 |
bBold |
- Set it to TRUE for bold text. |
bItalic |
- Set it to TRUE for italic text. |
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. Uses bold green text.
int bookmark1 = BlackIceDEVMODE.SetFormattedBookmark((long)ev.Graphics.GetHdc(), 0, "Bookmark 1", 0, 255, 0, true, false);
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 which is also the children of the first bookmark.
// Uses red italic text.
BlackIceDEVMODE.SetFormattedBookmark((long)ev.Graphics.GetHdc(), bookmark1, _T("Bookmark 2"), 255, 0, 0, false, true);
ev.Graphics.ReleaseHdc();
…
}
NOTE: For 32-bit applications , use pBlackIceDEVMODE as Integer, instead of Long.