#include “BlackIceDEVMODE.h”
DWORD SetFormattedBookmarkEx (HDC hDC, DWORD dwParent, LPCTSTR szTitle, DWORD dwPage, int iFit, int iLeft, int iBottom, int iRight, int iTop, double dZoom, BYTE bRed, BYTE bGreen, BYTE bBlue, BOOL bBold, BOOL bItalic);
Description
Adds a formatted bookmark to the specified location 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. The function must be called between the StartPage and EndPage GDI calls.
Parameters
HDC hDC |
- Handle to the device context used for printing. Returned by the CreateDC Windows API function or the Graphics.GetHdc() .NET method. |
|
DWORD dwParent |
- Identifier of the parent bookmark returned by a previous call to SetBookmark, or 0 for top-level bookmarks. |
|
LPCTSTR szTitle |
- The title of the bookmark |
|
DWORD dwPage |
- 0-based index of the page where the bookmark will point to |
|
int iFit |
- Specifies how the page is displayed when clicking on the bookmark. Please note the description of these values is from the PDF reference. Actual implementation depends on the PDF viewer application. Some PDF viewers may not implement all display modes. The following values are available: |
|
|
|
BIBookmark_XYZ (0) - Display the page designated by dwPage, with the coordinates (iLeft, iTop) positioned at the upper-left corner of the window and the contents of the page magnified by the factor dZoom. |
|
|
BIBookmark_Fit (1) - Display the page designated by dwPage, with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension. |
|
|
BIBookmark_FitH (2) - Display the page designated by dwPage, with the vertical coordinate iTop positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window. |
|
|
BIBookmark_FitV (3) - Display the page designated by dwPage, with the horizontal coordinate iLeft positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window. |
|
|
BIBookmark_FitR (4) - Display the page designated by dwPage, with its contents magnified just enough to fit the rectangle specified by the coordinates iLeft, iBottom, iRight, and iTop entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension. |
|
|
BIBookmark_FitB (5) - Display the page designated by dwPage, with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension. |
|
|
BIBookmark_FitBH (6) - Display the page designated by dwPage, with the vertical coordinate iTop positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. |
|
|
BIBookmark_FitBV (7) - Display the page designated by page, with the horizontal coordinate left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window. |
int iLeft, iBottom, iRight, iTop |
- See the description of iFit. Specified in Points (1/72 inches) from the top left corner of the page. |
|
double dZoom |
- The zoom factor used for the BIBookmark_XYZ fit mode. E.g.: 1.0 means 100%, 2.0 means 200%. 0.0 means the zoom value should not be changed. |
|
BYTE bRed, bGreen, bBlue |
- The color of the bookmark. The values must be between 0 and 255 |
|
BOOL bBold |
- Set it to TRUE for bold text. |
|
BOOL bItalic |
- Set it to TRUE for italic text. |
Return value
The function returns the identifier of the created bookmark, or 0 on failure.
Programming Notes
None
Code Example
if (StartPage(hDC) > 0)
{
…
// Create a bookmark that points to the 100:100 coordinates (in Points) of the 5. Page.
// Uses bold yellow text.
SetFormattedBookmarkEx(hDC, 0, _T("Bookmark 1"), 4, BIBookmark_XYZ, 100, 0, 0, 100, 0.0, 255, 255, 0, TRUE, FALSE);
…
// Ending the page
EndPage(hDC);
}