Professional Web Applications Themes

How to create a "sub-bookmark" using VB.NET - Adobe Acrobat SDK

hello, my problem is that I don't know how to create a "sub-bookmark" with VB.net For example, with this code, i create 2 bookmarks (Topic 1 => Page 1, Topic 2 => Page 2) : it's ok. Dim gApp As Acrobat.CAcroApp Dim gPdDoc As Acrobat.CAcroPDDoc Dim gAvDoc As Acrobat.CAcroAVDoc Dim gPDBookmark As Acrobat.AcroPDBookmark gPDFPath = "C:\sample.pdf" 'Initialize Acrobat by creating App object gApp = CreateObject("AcroExch.App") gPDBookmark = CreateObject("AcroExch.PDBookmark") ' show Acrobat gApp.Show() 'Set AVDoc object 'gAvDoc = gApp.GetActiveDoc gAvDoc = CreateObject("AcroExch.AVDoc") ' open the PDF If gAvDoc.Open(gPDFPath, "") Then ' create bookmark on page 1 JSO = gPdDoc.GetJSObject BMR = ...

  1. #1

    Default How to create a "sub-bookmark" using VB.NET

    hello,
    my problem is that I don't know how to create a "sub-bookmark" with VB.net

    For example, with this code, i create 2 bookmarks
    (Topic 1 => Page 1, Topic 2 => Page 2) : it's ok.

    Dim gApp As Acrobat.CAcroApp
    Dim gPdDoc As Acrobat.CAcroPDDoc
    Dim gAvDoc As Acrobat.CAcroAVDoc
    Dim gPDBookmark As Acrobat.AcroPDBookmark

    gPDFPath = "C:\sample.pdf"

    'Initialize Acrobat by creating App object
    gApp = CreateObject("AcroExch.App")
    gPDBookmark = CreateObject("AcroExch.PDBookmark")

    ' show Acrobat
    gApp.Show()

    'Set AVDoc object
    'gAvDoc = gApp.GetActiveDoc
    gAvDoc = CreateObject("AcroExch.AVDoc")

    ' open the PDF
    If gAvDoc.Open(gPDFPath, "") Then

    ' create bookmark on page 1
    JSO = gPdDoc.GetJSObject
    BMR = JSO.BookmarkRoot
    BMR.createchild("First Topic", "this.pageNum= 0", 0)
    BMR.createchild("Second Topic", "this.pageNum= 1", 1)

    End If

    -----------
    But, if i want to have sub-bookmark like this

    First Topic
    |
    - Page 2
    - Page 3
    Second Topic
    |
    - Page 4
    - Page 5

    How can i do this ?
    Can you help me and give me the code .
    thanks for all.
    arnaud_castel@adobeforums.com Guest

  2. #2

    Default Re: How to create a "sub-bookmark" using VB.NET

    Use createChild on the bookmark of "First Topic" and so on.
    Bernd Alheit Guest

  3. #3

    Default Re: How to create a "sub-bookmark" using VB.NET

    yes, i understand that i should use createchild on the bookmark "First Topic", but what is the code to do that ?

    thanks !!
    arnaud_castel@adobeforums.com Guest

  4. #4

    Default Re: How to create a "sub-bookmark" using VB.NET

    You can access the children of the root bookmark. The first child is the bookmark "First Topic".
    Bernd Alheit Guest

  5. #5

    Default Re: How to create a "sub-bookmark" using VB.NET

    Loop through the bookmarks checking the name property to see if it is the root you are looking for. Once you find it, use it's createChild method instead of the roots createChild method.
    PDL@adobeforums.com Guest

  6. #6

    Default Re: How to create a "sub-bookmark" using VB.NET

    hi, i'm back again
    thanks for your help, but i think that i have problem with VB.net
    with this exemple :

    Dim BMR As Object
    Dim BMR2 As Object

    JSO = gPdDoc.GetJSObjec
    BMR = JSO.BookmarkRoot

    BMR.createchild("Topic 1", "this.pageNum= 0", 0)
    BMR.createchild("Topic 2", "this.pageNum= 2", 1)
    BMR2 = BMR(0).children
    BMR2.createchild("Topic 1.1", "this.pageNum= 0", 1)

    have an error with line : BMR2 = BMR(0).children WHY ?

    can you correct my code?
    thanks!!!
    I see on other forum that i'm not alone to have this problem...
    arnaud_castel@adobeforums.com Guest

  7. #7

    Default Re: How to create a "sub-bookmark" using VB.NET

    oups, i made an error

    JSO = gPdDoc.GetJSObjec
    BMR = JSO.BookmarkRoot
    BMR.createchild("Topic 1", "this.pageNum= 0", 0)
    BMR.createchild("Topic 2", "this.pageNum= 2", 1)
    BMR2 = BMR.children
    BMR2.createchild("Topic 1.1", "this.pageNum= 0", 1)

    But the problem still the same BMR2.createchild doesn't work..why

    if i display the name of BMR2 bookmark like this
    JSO = gPdDoc.GetJSObjec
    BMR = JSO.BookmarkRoot
    BMR.createchild("Topic 1", "this.pageNum= 0", 0)
    BMR.createchild("Topic 2", "this.pageNum= 2", 1)
    BMR2 = BMR.children
    MsgBox(BMR2(0).name)

    the result is good : "Topic 1"
    what is wrong in my code ???
    arnaud_castel@adobeforums.com Guest

  8. #8

    Default Re: How to create a "sub-bookmark" using VB.NET

    You can access the first child of the bookmark root with:

    BMR2 = BMR.children[0];
    Bernd Alheit Guest

  9. #9

    Default Re: How to create a "sub-bookmark" using VB.NET

    this instruction works in C but not in VB.net...i don't know why !!!
    arnaud_castel@adobeforums.com Guest

  10. #10

    Default Re: How to create a "sub-bookmark" using VB.NET

    This works in VBS.

    HTH, Reinhard

    bookmarks.vbs
    --------------------

    gPDFPath = "C:\test.pdf"

    'Initialize Acrobat by creating App object
    set gApp = CreateObject("AcroExch.App")



    ' show Acrobat
    gApp.Show()

    'Set AVDoc object
    set gAvDoc = CreateObject("AcroExch.AVDoc")

    ' open the PDF
    If gAvDoc.Open(gPDFPath, "") Then

    ' create bookmarks tree
    Set PDDoc = gAVDoc.GetPDDoc()
    Set JSO = PDDoc.GetJSObject

    Set BMR = JSO.BookmarkRoot
    BMR.createchild "Mother1", "this.pageNum= 0",0
    BMC = BMR.children
    Set oBMC = bmc(0)
    oBMC.createChild "Child1", "this.pageNum = 1", 0
    oBMC.createChild "Child2", "this.pageNum = 1", 1
    BMC = oBMC.Children
    Set oBMC = bmc(1)
    oBMC.createChild "Child21", "this.pageNum = 1", 0



    BMR.createchild "Mother2", "this.pageNum= 0",1
    BMC = BMR.children
    Set oBMC = bmc(1)
    oBMC.createChild "Child1", "this.pageNum = 1", 0



    End If

    Set gAPP = Nothing
    Set AVDoc = Nothing
    Set PDDoc = Nothing
    Set JSO = Nothing
    Reinhard_Franke@adobeforums.com Guest

  11. #11

    Default Re: How to create a "sub-bookmark" using VB.NET

    Yes, it's works....
    thank you very much for your help.
    arnaud_castel@adobeforums.com Guest

Similar Threads

  1. Replies: 1
    Last Post: April 24th, 01:27 PM
  2. CFINPUT type="radio" w/ "value" requires "label"
    By Iceborer in forum Macromedia ColdFusion
    Replies: 2
    Last Post: February 21st, 06:16 PM
  3. Can't create PS file - "no desktop printer exists for this spool type"
    By Trudie_Derbyshire@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 5
    Last Post: July 29th, 03:07 PM
  4. Replies: 2
    Last Post: July 11th, 04:29 AM
  5. "Start" "Program" "Menu" list is empty
    By Pete in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 10th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139