ActivePDF
Shopping Cart My Account Help Contact Us
Request a Call
Search
Products Solutions Support Downloads Corporate
Submit an Issue
Knowledge Base
Server Product Support
Examples & How-Tos
Support Options
Support Policies
Annual Subscription
Extensions
Documentation
Resource Links
   
 
 
 
 

HomeSupportKnowledge Base
 
activePDF KB #11691 - Adding Bookmarks Using Server
activePDF KB #11691 - Adding Bookmarks Using Server
Information: Example Printer Version | Return to Search
Adding Bookmarks Using Server
 
Product Version Code Samples    
Server
3.5.2
3.8
VBS
VB.NET
C#
ASP
CF
PHP
 
Description
 
The following VBScript example demonstrates how Server can be used to add different types of bookmarks to a PDF file during conversion. This example uses the following Server Methods:
  • AddFileBookmark - Adds a bookmark that links to an external document.
  • AddLinkedPDFBookmark - Adds a bookmark that links to an external PDF.
  • AddPageBookmark - Adds a bookmark that links to a specified page within the PDF.
  • AddURLBookmark - Adds a bookmark that links to an external URL.
  • PSToPDF - Converts a PostScript® file to PDF.
These files are required:
  • example.pdf - The destination external PDF.
  • example.txt - The destination external file.
  • postscript.ps - The PostScript file to convert to PDF.
  • Bookmarks.vbs - Code detail provided below.

NOTE: This example is available for other programming environments. Please select from the Code Samples list above to display the download link for this example in the language appropriate to your environment.

Click here to download this example for VBScript (includes required files):




' Variables

' Current Path
arrayScr = Split(WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
strPath = strPath & arrayScr(i) & "\"

Next
strOutputDir = strPath

' Name of PS file to convert
strPSFileName = "postscript.ps"

' Name of PDF file to create
strPDFFileName = "ps.pdf"


' Instantiate activePDF Server Object
Set objSVR = CreateObject("APServer.Object")

' *Must call Bookmark methods prior to ImageToPDF, PSToPDF, or StartPrinting

' AddFileBookmark*
objSVR.AddFileBookmark "File (example.txt)", 1, strPath & "example.txt"
objSVR.AddFileBookmark "Sub File (example.txt)", 0, strPath & "example.txt"

' AddLinkedPDFBookmark*
objSVR.AddLinkedPDFBookmark "Linked PDF (example.pdf Page 1)", 1, strPath & "example.pdf", 1, "Fit"
objSVR.AddLinkedPDFBookmark "Sub Linked PDF (example.pdf Page 5)", 0, strPath & "example.pdf", 5, "Fit"

' AddPageBookmark*
objSVR.AddPageBookmark "Page Link (2)", 1, 2 ,"Fit"
objSVR.AddPageBookmark "Sub Page LInk (4)", 0, 4 ,"Fit"

' AddURLBookmark*
objSVR.AddURLBookmark "activePDF.com", 1, "http://www.activepdf.com"
objSVR.AddURLBookmark "Examples Page", 0, "http://www.activepdf.com/support/troubleshooting/"

' PSToPDF
lngRtn = objSVR.PSToPDF(strPSFileName, strPDFFileName)
If lngRtn = 0 Then
msgbox "Done!"

Else
errorRtn "PSToPDF", lngRtn

End If

' Release Object
Set objSVR = Nothing

' Error Return Handling
Sub errorRtn(strMethod, RtnCode)
msgbox strMethod & " error: " & RtnCode & VBCRLF & _
"http://www.activepdf.com/support/kb/?id=10549&tk=ts"

End Sub
 
Related Articles

  • 11040 - AddInternalLinkBookmark
    AddInternalLinkBookmark instructs Toolkit to create a bookmark in the current output file that connects to a specified internal designation in PDF.AddInter...


  • 11041 - AddLaunchBookmark
    AddLaunchBookmark instructs Toolkit to create a bookmark in the current output file that executes a command in the OS shell.AddLaunchBookmark


  • 11046 - AddTextBookmark
    AddTextBookmark instructs Toolkit to create a text-only bookmark in the current output file. This is useful for grouping multiple bookmarks on a similar topic or categorizing bookmarks into...


  • 11048 - AddURLBookmark
    AddURLBookmark instructs Toolkit to create a bookmark in the current output file that connects to an external URL. AddURLBookmark BookmarkT...


 
Keywords
 
AddFileBookmark, AddLinkedPDFBookmark, AddPageBookmark, AddURLBookmark, PSToPDF
 
Last Updated 2008-05-12 Printer Version | Return to Search
 
Knowledge Base Article Feedback*
*KB article feedback ONLY (submit support issues here)
Quality of this article?
  Poor Excellent 
1 2 3 4 5 6 7 8 9 10
Is this article helpful? Yes       No       Maybe
Comments (Optional)
Email Address (Optional)
Please enter the word "PDF"
(without quotes)
 
The information in this article is for the use of activePDF Customers and Evaluation Users Only. No part of this document may be transmitted or reproduced without the express written consent of activePDF.

Copyright © 2005, activePDF, Inc. All Rights Reserved
2003 activePDF Site Map Feedback Privacy Policy Legal