I can't seem to get a simple SET JSO statement working consistently in Access Visual Basic.It was working. It looped through PDF bookmarks and split pages based on bookmarks. Bob
The following is my code:
Public Function SplitByBookmarks(strPathFile As String)
'THIS COULD BE THE BIG ONE!!!
Dim AVDoc As Acrobat.AcroAVDoc
Dim PDDoc As New Acrobat.AcroPDDoc
Dim NewPDDoc As Acrobat.AcroPDDoc
Dim AVPageView As Acrobat.AcroAVPageView
Dim PDBookmark As AcroPDBookmark
Dim strFile As String, strPath As String, x As Integer, i As Integer
Dim JSO As Object, BookmarkRoot As Object, Bookmarks As Object
Dim PageIndex As Long, PDFFilePath As String, BMArray(50) As String
'It gets the bookmarked page!
'Get PDF path and file name (this will eventually work like the bookmark selection below)
'Set PDF document variables
Set AcroApp = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set PDDoc = CreateObject("AcroExch.PDDoc")
Set NewPDDoc = CreateObject("AcroExch.PDDoc")
Set PDBookmark = CreateObject("AcroExch.PDBookmark")
AVDoc.Open strFile, vbNull
Set AVPageView = AVDoc.GetAVPageView
AcroApp.Show
'***********************************
'SETUP, FIND AND CONVERT BOOKMARKS
Set PDDoc = AVDoc.GetPDDoc
Set JSO = PDDoc.GetJSObject
Set BookmarkRoot = JSO.BookmarkRoot
Bookmarks = JSO.BookmarkRoot.Children
For Each child In Bookmarks
NewPDDoc.Create
PDBookmark.GetByTitle PDDoc, child.Name
PDBookmark.Perform AVDoc
'PageIndex is zero based
PageIndex = AVPageView.GetPageNum
NewPDDoc.InsertPages -1, PDDoc, PageIndex, 1, 0
PDFFilePath = strPath & child.Name & ".pdf"
NewPDDoc.Save Acrobat.PDSaveFull, PDFFilePath
ConvertPDF (PDFFilePath)
x = x + 1
BMArray(x) = PDFFilePath
Set NewPDDoc = Nothing
Next
Set PDDoc = Nothing
For i = 1 To x
Kill BMArray(i)
Next
Set BookmarkRoot = Nothing
Set JSO = Nothing
PDDoc.Close
End Function
