Home
Suggestion or Comment?

PDFDoc Scout

PDFDoc Scout screenshot (click to enlarge)


Subscribe to Our Bi-Monthly Newsletter (tips, new releases, specials):
 Subscribe in a reader
 PRODUCTS  |  DOWNLOAD  |  PURCHASE  |  SUPPORT  |  TESTIMONIALS   |  NEWS  | 

PDFDoc Scout library - Sample

Download Free Trial See Licensing Options More Information

How to add outlines (bookmarks) with sub-topics bookmarks in PDF document using PDFDoc Scout library

Download the source code of this example (VBScript) here: pdfdocscout_outlines.zip 
Download the source code of this example (VB.NET) here: pdfdocscout_outlines_vb_net.zip 

This example demonstrates how to generate bookmarks tree in PDF document using PDFDoc Scout library

Generated PDF document (screenshot):

Sample EMF metafile with text, vector and raster images converted into PDF document using PDFDoc Scout library

or view generated PDF document online: pdfdocscout_Outlines.pdf

Source code:

Set PDFDoc = CreateObject("PDFDocScout.PDFDocument") ' create PDFDoc object
PDFDoc.InitLibrary "demo", "demo" ' initialize library

PDFDoc.OutputFileName = "Outlines.pdf" ' set output filename for PDF document
PDFDoc.AutoOpenGeneratedPDF = true ' automatically open generated PDF document in default PDF viewer application

PDFDoc.ViewerOptions_PageMode = 1 ' 1=pmUseOutlines so PDF document will be opened with visible outlines tree by default

PDFDoc.BeginDocument ' starts PDF document generation

' add root outline node
Set actGotoPage = PDFDoc.AddGoToPageAction(0, 0) ' page #0 and top offset = 0 for the very first outline
Set outlineRoot = PDFDoc.Outlines.AddChild (nothing, "PDFDoc Scout Demo", actGotoPage, 0)
outlineRoot.Expanded = true ' root outline is expanded by default

PDFDoc.Page.AddText "This is a main page for this demo", 100, 10, 0

For i = 1 to 10

PDFDoc.AddPage

' add text to a page
PDFDoc.Page.AddText "This is a page #" & CStr(i), 100, 10, 0

' create outline for this page
Set actGotoPage = PDFDoc.AddGoToPageAction(i, 0) ' i = page number, 0 is Y top offset
Set outlinePage = PDFDoc.Outlines.AddChild (outlineRoot, "Page " +Cstr(i), actGotoPage, 0)

' now we add 5 sub-topics on the same page and then create sub-outlines for each sub-topic
for j=1 to 5

' add text for sub-topic
PDFDoc.Page.AddText "Sub-topic #" & Cstr(J+1) & " on page #" & CStr(i), 100, 100 + j*50, 0

' add sub-outline for sub-topic
Set actGotoSubTopicOnPage = PDFDoc.AddGoToPageAction(i, 100 + j*50) ' i = page number, 100 + j*50 is Y top offset for sub-topic
Set outlineSubTopic = PDFDoc.Outlines.AddChild (outlinePage, "Sub-topic #" +Cstr(j), actGotoSubTopicOnPage, 0)

Next

Next

PDFDoc.EndDocument ' close pdf document generation

' disconnect from library
Set PDFDoc = Nothing

Download the source code of this example (VBScript) here: pdfdocscout_outlines.zip 
Download the source code of this example (VB.NET) here: pdfdocscout_outlines_vb_net.zip 

Download Free Trial See Licensing Options More Information


See also: Bytescout.PDF - native .NET library to write/read/sign/
modify/merge/split PDF documents (but no HTML2PDF support)



On-line documentation (HTML format)


"Hello, World!" quick start step-by-step tutorials:


HOME  |  CONTACT US

Copyright © ByteScout, 2003-2010. Privacy Statement
Microsoft®, Windows®, Windows 2000®, Windows Server®, Windows Vista®, Internet Explorer®, .NET Framework®, ActiveX®, Visual Basic®, Visual C#®, ASP®, ASP.NET®, Excel®, PowerPoint®, are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Adobe®, Flash® and Acrobat® are registered trademarks of Adobe Systems, Incorporated. Mozilla®, Firefox® and the Mozilla and Firefox Logos are registered trademarks of the Mozilla Foundation. Other product names or brandnames used herein are for identification purposes only and might be trademarks or registered trademarks of their respective companies. We disclaim any and all rights to those marks.