How to create bookmark using VB.NET? - Adobe Acrobat

This is a discussion on How to create bookmark using VB.NET? - Adobe Acrobat ; Hi, I've got a code to create bookmark in pdf file but I don't think only having this line of code we can't create bookmark. I am using vb .net to do this. Dim gApp As Acrobat.CAcroApp Dim gPdDoc As ...

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

How to create bookmark using VB.NET?

  1. Default How to create bookmark using VB.NET?

    Hi,

    I've got a code to create bookmark in pdf file but I don't think only having this line of code we can't create bookmark. I am using vb.net to do this.

    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
    gPDBookmark.setTitle("First") 'IS IT RIGHT?
    End If

    Can you please help me to create the bookmark? If I get the code it would be really helpful.

    Thanks...!

  2. Default Re: How to create bookmark using VB.NET?

    It is not possible to create a bookmark with OLE. You can try Acrobat JavaScript.

  3. Default Re: How to create bookmark using VB.NET?

    You can use the JSObject in IAC to run the javascript to create the bookmarks.

  4. Default Re: How to create bookmark using VB.NET?

    Thanks Bernd,

    I tried to get the code to create tbe bookmark but didn't get the exact one.

    jsObj = pdDoc.GetJSObject
    BookMarkRoot = jsObj.BookMarkRoot
    bok.createChild()

    If I get any related stuffs it would be helpful.

    Thanks..

  5. Default Re: How to create bookmark using VB.NET?



    bok.createChild()




    What is bok? The method createChild requires the cName parameter.

  6. Default Re: How to create bookmark using VB.NET?

    I would just use

    jso = pdDoc.GetJSObject
    jso.bookmarkRoot.createChild ( "BookmarkName", "BookmarkAction" )

    bookmarkAction could be a script like

    this.pageNum++

  7. Default Re: How to create bookmark using VB.NET?

    Have a look at this:

    <http://groups.google.de/group/adobe.acrobat.sdk/browse_thread/thread/44c6c087ded64647/ea59571a8e0d438f?hl=de&lnk=gst&q=Reinhard#ea59571a8e0d438f>

    HTH, Reinhard

  8. Default Re: How to create bookmark using VB.NET?

    MANY THANKS to you all for taking the effort..

    I also got the code to create a bookmark using JSObject but the only issue is when I click on the link it is not going to the particular section since I didn't mention anything apart from this.

    I tried a lot to get the details about the same but I failed in this. So, again I am coming to you only.

    This is my code.

    Dim gPdDoc As Acrobat.CAcroPDDoc
    Dim gAvDoc As Acrobat.CAcroAVDoc
    Dim gPDFPath As String

    Dim JSO As Object
    Dim BMR As Object
    Dim BMC As Object

    'hard coding for a PDF to open, it can be changed when needed.
    gPDFPath = "C:\sample.pdf"

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

    ' show Acrobat
    gApp.Show()

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

    ' open the PDF
    If gAvDoc.Open(gPDFPath, "") Then
    gPdDoc = gAvDoc.GetPDDoc()
    JSO = gPdDoc.GetJSObject
    BMR = JSO.BookmarkRoot
    BMR.createchild("First Topic", "this.pageNum= 0", 0)
    End If

    Thanks...!

  9. Default Re: How to create bookmark using VB.NET?

    ...,"this.pageNum= 0",

    This is your bookmark - (JS) action. So if you click on the bookmark it goes to the first page (zero-based page numbering).

    If you want to go to a particular section by mouse-click on bm you have to look in the AJS-helpfile for the JS-code you need. I assume somthing like "named destination(?)".

    Best regards, Reinhard

  10. Default Re: How to create bookmark using VB.NET?

    Hi,

    I gone through AcroJS_DesignerJS.pdf, js_api_reference.pdf and js_developer_guide.pdf but I didn't get anything related to my requirement.

    As you mentioned, I need to point out the "named destination when we click on the bookmark so that it will move to that particular page and the particular topic will be shown.

    My requirement is, for example, I will have 3 headings and 2 sub- headings for each headings in a pdf file. When I open that pdf I need to create bookmarks using vb.net like,

    Heading 1 ' > It will be in 1st page
    Sub-Heading 1_1 ' > It will be in 1st page
    Sub-Heading 1_2 ' > It will be in 1st page
    Heading 2 ' > It will be in 2nd page
    Sub-Heading 2_1 ' > It will be in 2nd page
    Sub-Heading 2_2 ' > It will be in 2nd page
    Heading 3 ' > It will be in 3rd page
    Sub-Heading 3_1 ' > It will be in 3rd page
    Sub-Heading 3_2 ' > It will be in 3rdd page

    When I click on a particular topic it should be directed to the corresponding destination. How can I set the destination using Javascript in VB.Net?

    Thank you.

    Regards,
    R. Prasanna

+ Reply to Thread
Page 1 of 2 1 2 LastLast