Ask a Question related to Adobe Acrobat SDK, Design and Development.
-
Tom Danninger #1
Adding Links in VB.NET
I'm trying to modify one of the sample programs to add a file link to a PDF document. I've search the documentation 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
-
Adding previous and next links in the cfgrid
I have been reading through a few of these topics, and have not found an answer to this question. Is there built in functionality within MX7 that... -
Adding Javascript for Hiding email links.
With the problem of spam bots out there looking for every email address they can get their robot paws on, we have the need to cloak our email... -
Adding file links column in a datagrid
Hi I have a list of files in the filesystem and the paths and filename to these files are stored in records in a database. I need to display these... -
Adding CFIDE and CFTOKEN to all links
Hello, I need to be able to share session variables across 2 sites that have 2 different domain names. The two sites are running on the same... -
Spinning animation and adding links..ACK!
Ack! I am attempting to make an image (a 3d ring) spin on an axis. Problem is, it will rotate 180 degrees then flips back To see what I mean go... -
Leonard_Rosenthol@adobeforums.com #2
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
-
Bernd Alheit #3
Re: Adding Links in VB.NET
Peddler is one of the PDF Library Samples.
Bernd Alheit Guest
-
Tom Danninger #4
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
-
PDL@adobeforums.com #5
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
-
Tom Danninger #6
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 documentation 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
-
PDL@adobeforums.com #7
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
-
Tom Danninger #8
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 document to a PDF document without mal-forming the link. I have hundreds of these documents 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 document 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
-
Tom Danninger #9
Re: Adding Links in VB.NET
I've spent some time since my last post reviewing all the documentation 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 documentation 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 documentation on the correct Link Annotation field names... or copy them from whereever?
Tom Danninger Guest
-
Bernd Alheit #10
Re: Adding Links in VB.NET
Look at the method addLink in the Acrobat JavaScript documentation.
Bernd Alheit Guest
-
Tom Danninger #11
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 documentation 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



Reply With Quote

