Print2eDoc SDK
SDK for document conversion to PDF, PNG, JPEG, TIFF...
Compatibility
VB VB.NET VC++ C# Delphi

Adding Bookmarks and Notes When Printing To PDF

Learn how to add bookmarks and note annotations (comments) when you programmatically convert your documents to PDF using Print2eDoc SDK.
By Mallika K.

Last month, we saw how to add hyperlinks when printing to PDF using Print2eDoc SDK. This month, we will see how to add bookmarks and note annotations.

To add notes and bookmarks, use the following methods of IgtPrint2eDoc interface.

Adding a PDF Note (note annotation)

Notes in a PDF document are analogous to comments in a Microsoft® Office™ document. To add a note, specify text displayed by the note, coordinates of the area where the note is anchored, color of the note's popup window, and whether the note's popup window needs to be kept open by default.

Delphi C# VB.NET
// Uncomment next command to remove any existing
// notes in the output PDF document
// PrinterObj.ClearPDFElements(peNotes);

// Add a blue note on page 1 over area with
// coordinates (10,10,50,50)
PrinterObj.AddPDFNote(
  'Gnostice Information Technologies',  // note text
  True, // whether note's popup window needs to be open
  10,   // x-coordinate of top-left corner
  10,   // y-coordinate of top-left corner
  50,   // x-coordinate of bottom-right corner
  50,   // y-coordinate of bottom-right corner
  1,    // page number where note should be added
  RGB(0,0,255) );  // color of the note's popup window

Adding a Bookmark

To add a bookmark, specify the text used to display the bookmark in the bookmark panel of a viewer application such as Adobe® Reader, level of the bookmark in the bookmark tree, the page number that the bookmark links to, and how far down the linked page that the top edge of the PDF viewer area should be placed when the bookmark is selected by the user.

Delphi C# VB.NET
// Uncomment this command to remove any existing
// bookmarks in the output PDF document
// PrinterObj.ClearPDFElements(peBookmarks);

// Add a top-level bookmark to page 1
PrinterObj.AddPDFBookmark(
   'Section-1', // boomkark text
   1,           // bookmark level
   50,          // viewer top edge at 50 points down page 1
   1);          // number of the linked page

// Add a bookmark one level deeper than previous bookmark
PrinterObj.AddPDFBookmark('Section-1.1', 2, 200, 1);
// Add a top-level bookmark below the first bookmark
PrinterObj.AddPDFBookmark('Section-2', 1, 400, 1);
// Add a bookmark one level deeper than
// the second top-level bookmark
PrinterObj.AddPDFBookmark('Section-2.1', 2, 550, 1);
// Add a bookmark one level deeper than previous bookmark
PrinterObj.AddPDFBookmark('Section-2.1.1', 3, 750, 1);

After specifying the settings for adding notes and bookmarks, generate the output document.

Delphi C# VB.NET
PrinterObj.OutputDocumentFormat := PDF;
PrinterObj.ShowPreview := False;
PrinterObj.ShowSaveDialog := False;
PrinterObj.ShowSettingsDialog := False;
PrinterObj.ViewGeneratedDocuments := True;
PrinterObj.OutputDocumentName := 'Output';

// Print the document
PrinterObj.PrintDocument('Input.doc');
Privacy | Legal | Feedback | Newsletter © 2002-2010 Gnostice Information Technologies Private Limited. All rights reserved.

This site is best viewed on a screen with minimum resolution of 1152 x 864 pixels. Windows users are advised to use Microsoft ClearType Tuning for optimal experience. Linux and other users can enable font smoothing, as supported by their OS. Also, please use the latest version of a standards-compliant browser such as Opera, FireFox, Chrome or Safari.