Professional Web Applications Themes

Adding Links in VB.NET - Adobe Acrobat SDK

I'm trying to modify one of the sample programs to add a file link to a PDF doent. I've search the doentation and found references in IAC to a ArcoExch.PDAnnot with a annotation type of PDLinkAnnot. I've also found a couple of references to a sample named Peddler which would seem to do what I want. However, in using the Visual Studio 2005 Object Browser on the Adobe 8.0 Type Library I cannot find a method that will add a link... Also, no trace of a sample named Peddler in the Adobe 8 SDK... Anyone know where either/both of these ...

  1. #1

    Default Adding Links in VB.NET

    I'm trying to modify one of the sample programs to add a file link to a PDF doent. I've search the doentation and found references in IAC to a ArcoExch.PDAnnot with a annotation type of PDLinkAnnot. I've also found a couple of references to a sample named Peddler which would seem to do what I want. However, in using the Visual Studio 2005 Object Browser on the Adobe 8.0 Type Library I cannot find a method that will add a link... Also, no trace of a sample named Peddler in the Adobe 8 SDK... Anyone know where either/both of these items my reside? Thanks for any help you can provide.
    Tom Danninger Guest

  2. #2

    Default Re: Adding Links in VB.NET

    Never heard of Peddler...

    But yes, adding links via IAC is most certainly doable...
    Leonard_Rosenthol@adobeforums.com Guest

  3. #3

    Default Re: Adding Links in VB.NET

    Peddler is one of the PDF Library Samples.
    Bernd Alheit Guest

  4. #4

    Default Re: Adding Links in VB.NET

    Thanks for the responses. You say that Peddler is one of the PDF Library Samples... Is it part of the SDK? Where are the Library Samples kept...?

    Which method on what object does one use to add a link? As I mentioned I have not been able to find a method with the Object brower.
    Tom Danninger Guest

  5. #5

    Default Re: Adding Links in VB.NET

    I believe Peddler is one of the PDF Library Samples included when licensing the PDFL and the DLE APIs from DataLogics.

    If you are interested in licensing the PDF Library you should contact DataLogics - it is not free like the SDK.
    PDL@adobeforums.com Guest

  6. #6

    Default Re: Adding Links in VB.NET

    Thanks... that clears up the Peddler sample question. Curious why there would be at least two references to it in the Adobe doentation without any words about it being a Datalogics Sample... I'm not yet ready to recommend we spend more money to get around a problem in the base version of Acrobat Pro... Perhaps I'll be able to locate the right method in the Adobe VB.NET library... though no luck so far.
    Tom Danninger Guest

  7. #7

    Default Re: Adding Links in VB.NET



    I'm not yet ready to recommend we spend more money to get around a problem
    in the base version of Acrobat Pro




    What "problem" is that?

    There is no "add link" method directly. I suggest you read the PDF Reference 1.7 so that you understand what a "link" is inside a PDF.

    All links are just annotations of a specific type. You need to create a Link Annotation, set it's properties as described for Link Annotations in the PDF Reference, and then use AcroExch.PDPage.AddAnnot method to add the link annotation to the page.

    Many features that seem to function in a similar manner to something like HTML are handled completely differently internal to the PDF and the application. It's definitely recommended to have read and understood the relevant sections of the PDF Reference before working with the SDK.

    In this case, you should read section 8.4.5 "Annotation Types" of the PDF Reference, section titled "Link Annotations".
    PDL@adobeforums.com Guest

  8. #8

    Default Re: Adding Links in VB.NET

    Thanks.

    The problem I'm having is getting Acrobat Pro to convert well formed relative file links in single page Word doent to a PDF doent without mal-forming the link. I have hundreds of these doents and attempted to use the Batch Processing capability of Pro 1.8.3 to convert them. As an example a relative file link of ..\index.pdf converts correctly to a link in the PDF doent when using the Convert to Adobe PDF menu item that Acrobat placed in Word 2003. However, when using the Batch Facility in Acrobat it produces a link with a double folder entry at the beginning and a missing folder at the end. Seems many user in the Acrobat forum are having similar issues and there does not seem to be a solution. So, I'm planning to write a VB.NET program that will restore the links after the conversion.

    I had found the references to links being a special type of annotation; but could not find the reference in how to use them. So, your post should help significantly... thanks again.
    Tom Danninger Guest

  9. #9

    Default Re: Adding Links in VB.NET

    I've spent some time since my last post reviewing all the doentation I could find on Link Annotation. Although the PDF reference explains well what a Link Annotation looks like in the Dictionary I could not find a reference on how to add one using the AddAnnot in VB.NET. I did find the following Code illustration on how to add a Text Annotation:

    Dim page As Acrobat.CAcroPDPage
    Dim jso As Object
    Dim point(1) As Integer
    Dim popupRect(3) As Integer
    Dim pageRect As Object
    Dim annot As Object
    Dim props As Object

    ' Get size for page 0 and set up arrays
    page = pdDoc.AcquirePage(0)
    pageRect = page.GetSize
    Point(0) = 0
    Point(1) = pageRect.y
    popupRect(0) = 0
    popupRect(1) = pageRect.y - 100
    popupRect(2) = 200
    popupRect(3) = pageRect.y

    ' Create a new Link annot
    annot = jso.AddAnnot
    props = annot.getProps
    props.Type = "Text"
    annot.setProps(props)
    ' Fill in a few fields
    props = annot.getProps

    props.page = 0
    props.point = point
    props.popupRect = popupRect
    props.author = "John Doe"
    props.noteIcon = "Comment"
    props.strokeColor = jso.Color.red
    props.Contents = "I added this comment from Visual Basic!"
    annot.setProps(props)

    The code works for a text annotation and changing the props.Type = "Link" does not cause an error. However, the fields for a Link type annotation are different (Subtype, Destination, etc.); but I have been unable to find doentation on the proper field names to use in VB and because of the way props is Dimensioned the field names are not visible to the Visual Studio debugger. Can anyone point me to doentation on the correct Link Annotation field names... or copy them from whereever?
    Tom Danninger Guest

  10. #10

    Default Re: Adding Links in VB.NET

    Look at the method addLink in the Acrobat JavaScript doentation.
    Bernd Alheit Guest

  11. #11

    Default Re: Adding Links in VB.NET

    Thanks much. I've finally got it to work... not quite the way I had thought but I've been able to embed a relative annotation link in a single page pdf file that works when I relocate the entire directory structure to another location. I had not thought to look at the JavaScript doentation for a potential model for a VB.NET application. What finally worked after several trial-and-error attempts to get the AddLink parameters correct was:

    pdDoc = AcroExchAVDoc(CInt(Me.Tag)).GetPDDoc()
    jso = pdDoc.GetJSObject
    page = pdDoc.AcquirePage(0)
    pageRect = page.GetSize

    linkRect(0) = (pageRect.x / 2) - 115
    linkRect(1) = 195
    linkRect(2) = (pageRect.x / 2) + 115
    linkRect(3) = 213

    annot = jso.AddLink(0, linkRect)
    annot.setAction("app.openDoc('../photos_index.pdf');")

    This adds an annotation link at the bottom middle of the page that when clicked executes the Java statement that loads an index page one directory up.

    Thanks again for your help. This will save me lots of time... still too bad I couldn't get the Batch Processing function to work correctly...
    Tom Danninger Guest

Similar Threads

  1. Adding previous and next links in the cfgrid
    By bulcat in forum Coldfusion Flash Integration
    Replies: 1
    Last Post: November 30th, 08:29 PM
  2. Adding Javascript for Hiding email links.
    By DrBlanston in forum Macromedia Contribute General Discussion
    Replies: 1
    Last Post: August 22nd, 01:17 PM
  3. Adding file links column in a datagrid
    By Hari S via DotNetMonster.com in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: July 14th, 04:30 AM
  4. Adding CFIDE and CFTOKEN to all links
    By jbreslow in forum Macromedia ColdFusion
    Replies: 0
    Last Post: April 22nd, 10:04 PM
  5. Spinning animation and adding links..ACK!
    By curious11 in forum Macromedia Flash Sitedesign
    Replies: 2
    Last Post: February 15th, 11:05 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