Bookmarks/Outlines

  • Hi,

    I am currently evaluating the WPPDF component, and need to make sure it will do a few things before we buy.

    For this example I am extending the WPToolswPDF demo, as we already have WPTools and would like to use it where possible.

    I am simply trying to add Outlines to the document, and have tried the following but to no avail: [code placed in TForm1.FormCreate]

    WPPDFExport.SetOutline('My Bookmark!', 'BOOK0', 0, 0);
    WPPDFExport.SetOutline('My Bookmark 2', '', 0, 0);
    WPPDFExport.SetOutline('My Bookmark 3', '', 0, 0);

    where Book0 is defined in the WPTools rich text editor being exported.

    Note that I always get 0 back as a return value from SetOutline.

    I read the examples in the help, but the outlines are added on events - can't they be added as the document is constructed?

    I presume that I am missing something obvious - could anyone give me some sample code for adding outlines?

    Thanks in advance,
    Duncan

    • Offizieller Beitrag

    Hi,

    You can use SetOutline only when a PDF document is open. For example after WPPDFExport.BeginDoc;
    To use this with WPTools you can do:

    WPPDFExport.BeginDoc;
    WPPDFExport.SetOutline ...
    WPPDFExport.Print;
    WPPDFExport.EndDoc;

    Some example code:

    for example

    WPPDFExport.SetOutline('Bookmark C', 'TOC01',0,
    WPPDFExport.SetOutline('Bookmark B ', 'TOC01',0,
    WPPDFExport.SetOutline('Bookmark A', 'TOC01',0,0)));

    Which creates:
    Bookmark A
    Bookmark B / 1. level
    Bookmark C / 2. level

    You can also switch property CreateOutlines to true - then all lines will become outlines which have the flag 'OutlineMode' set. (CurrAttr.OutlineMode := TRUE)
    But levels are not created this way.

    I hope this helps,

    Julian Ziersch