Toolkit Standard

Alphabetical List
AddBookmarks
AddExternalLinkBookmark
AddInternalLinkBookmark
AddLaunchBookmark
AddRelatedQuery
AddTextBookmark
AddURLBookmark
Author
BBHeight
BBLeft
BBTop
BBWidth
ClearHeaderInfo
ClearQueries
CloseOutputFile
CopyForm
CreateDate
Creator
DBToForm
DoFormFormatting
DrawTo
EncryptFile
EncryptFile128
EncryptFileAES
FlattenRemainingFormFields
ForceColorReset
ForceHeaderColorReset
FormNumbering
GetBoundingBox
GetHeaderTextWidth
GetInputPageRotation
GetPDFInfo
GetTextWidth
GetUniqueFileName
GotoNextBookmarkLevel
GotoPreviousBookmarkLevel
GreyBar
ImageRotation
InputByteArray
InputByteStream
IsFileLinearized
JPEGToPDF
Keywords
LinearizeFile
LineWidth
LoadDBMapFile
MergeFile
ModDate
MoveTo
NewPage
NumPages
OpenInputFile
OpenOutputFile
OutputByteStream
OutputPageHeight
OutputPageWidth
PrintImage
PrintJPEG
PrintMultilineText
PrintText
PrintTIFF
Producer
ReadOnlyOnMerge
RelatedQuerySeparator
ResetFormFields
ResetHeaderTextColor
ResetHeaderTextTransparency
ResetTextColor
ResetTextTransparency
SaveMemoryToDisk
SetDBInputTemplate
SetDBMultiRowSeparator
SetDefaultDBMergeFlag
SetFont
SetFormFieldData
SetHeaderFont
SetHeaderGreyBar
SetHeaderHLine
SetHeaderImage
SetHeaderJPEG
SetHeaderMultilineText
SetHeaderRotation
SetHeaderText
SetHeaderTextBackground
SetHeaderTextColor
SetHeaderTextColorCMYK
SetHeaderTextFillMode
SetHeaderTextStrokeColor
SetHeaderTextStrokeColorCMYK
SetHeaderTextTransparency
SetHeaderTIFF
SetHeaderVLine
SetHeaderWPgNbr
SetInfo
SetInputBookmark
SetMasterQuery
SetOutputSecurity
SetOutputSecurity128
SetOutputSecurityAES
SetTextColor
SetTextColorCMYK
SetTextFillMode
SetTextRotation
SetTextStrokeColor
SetTextStrokeColorCMYK
SetTextTransparency
SetViewerPreferences
Subject
TIFFToPDF
Title
ToolkitVersion
XMLSetFormFieldData
Bookmarks
AddBookmarks
AddExternalLinkBookmark
AddInternalLinkBookmark
AddLaunchBookmark
AddTextBookmark
AddURLBookmark
GotoNextBookmarkLevel
GotoPreviousBookmarkLevel
SetInputBookmark
Convert to PDF
JPEGToPDF
TIFFToPDF
Database
AddRelatedQuery
ClearQueries
LoadDBMapFile
RelatedQuerySeparator
SetDBInputTemplate
SetDBMultiRowSeparator
SetDefaultDBMergeFlag
SetMasterQuery
Debug
ToolkitVersion
Drawing
DrawTo
GreyBar
LineWidth
MoveTo
SetHeaderGreyBar
SetHeaderHLine
SetHeaderVLine
Fields
DBToForm
DoFormFormatting
FlattenRemainingFormFields
FormNumbering
ResetFormFields
SetFormFieldData
XMLSetFormFieldData
File Input
OpenInputFile
File Output
CloseOutputFile
GetUniqueFileName
OpenOutputFile
Memory
InputByteArray
InputByteStream
OutputByteStream
SaveMemoryToDisk
Merging
MergeFile
ReadOnlyOnMerge
Metadata
Author
CreateDate
Creator
GetPDFInfo
Keywords
ModDate
Producer
SetInfo
Subject
Title
PDF Information
BBHeight
BBLeft
BBTop
BBWidth
GetBoundingBox
GetInputPageRotation
NumPages
Page Control
OutputPageHeight
OutputPageWidth
Pages
CopyForm
NewPage
Security (PDF)
EncryptFile
EncryptFile128
EncryptFileAES
SetOutputSecurity
SetOutputSecurity128
SetOutputSecurityAES
Stamping
ClearHeaderInfo
ForceColorReset
ForceHeaderColorReset
GetHeaderTextWidth
GetTextWidth
ImageRotation
PrintImage
PrintJPEG
PrintMultilineText
PrintText
PrintTIFF
ResetHeaderTextColor
ResetHeaderTextTransparency
ResetTextColor
ResetTextTransparency
SetFont
SetHeaderFont
SetHeaderImage
SetHeaderJPEG
SetHeaderMultilineText
SetHeaderRotation
SetHeaderText
SetHeaderTextBackground
SetHeaderTextColor
SetHeaderTextColorCMYK
SetHeaderTextFillMode
SetHeaderTextStrokeColor
SetHeaderTextStrokeColorCMYK
SetHeaderTextTransparency
SetHeaderTIFF
SetHeaderWPgNbr
SetTextColor
SetTextColorCMYK
SetTextFillMode
SetTextRotation
SetTextStrokeColor
SetTextStrokeColorCMYK
SetTextTransparency
View
SetViewerPreferences
Web View
IsFileLinearized
LinearizeFile

Merge PDF files and retain Bookmarks

' Copyright (c) 2014 ActivePDF, Inc.
' Example created 10/20/14

Dim FSO, strPath, intOpenOutputFile, intMergeFile

' Get current path
Set FSO = CreateObject("Scripting.FileSystemObject")
strPath = FSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\"
Set FSO = Nothing

' Instantiate Object
Set oTK = CreateObject("APToolkit.Object")

' Create the new PDF file
intOpenOutputFile = oTK.OpenOutputFile(strPath & "new.pdf")
If intOpenOutputFile <> 0 Then
  ErrorHandler "OpenOutputFile", intOpenOutputFile
End If

' Set whether the fields should be read only in the output PDF
' 0 mark all fields read-only, 1 leave fields as they are
' Fields set with SetFormFieldData will not be effected
oTK.ReadOnlyOnMerge = 1

' Set the bookmarks from original files to copy into new PDF
oTK.AddBookmarks = 1

' MergeFile is the equivalent of OpenInputFile and CopyForm

' Merge the cover page (0 for all pages) setting first level bookmark name
oTK.SetInputBookmark = "Cover Page"
intMergeFile = oTK.MergeFile(strPath & "cover.pdf", 0, 0)
If intMergeFile <> 1 Then
  ErrorHandler "MergeFile", intMergeFile
End If

' Set the first level bookmark name and merge the next PDF
oTK.SetInputBookmark = "Lorem Ipsum"
intMergeFile = oTK.MergeFile(strPath & "5pageLI.pdf", 0, 0)
If intMergeFile <> 1 Then
  ErrorHandler "MergeFile", intMergeFile
End If

' Set the first level bookmark name and merge the next PDF
oTK.SetInputBookmark = "Aliquam Adipiscing"
intMergeFile = oTK.MergeFile(strPath & "6pageAA.pdf", 0, 0)
If intMergeFile <> 1 Then
  ErrorHandler "MergeFile", intMergeFile
End If

' Close the new file to complete PDF creation
oTK.CloseOutputFile 

' Release Object
Set oTK = Nothing

' Process Complete
Wscript.Echo("Done!")

' Error Handling
Sub ErrorHandler(method, outputCode)
  Wscript.Echo("Error in " & method & ": " & outputCode)
End Sub

Copyright © 2014 ActivePDF, Inc