Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: Insert URI Action into Annotation Dictionary (Via Email)
Conf: (P-PDF) Developers, Msg: 91628
From: cdahl
Date: 7/8/2003 12:14 PM


I'm writing a plug-in (Acrobat 6.0) that will insert a new link
annotation into a PDF document, with a URI action that points to a web
address. I've managed to create the link annotation, and to insert the
new CosDict that contains the URI action, but I don't seem to be
constructing a valid dictionary.

I created a link in Acrobat 6 using the link tool to compare the
dictionary for each annotation. The dictionary object for the link
created by my plug-in is:

/A Dict:6 [26 0 R]
/Rect Array:4
/S URI
/Subtype Link
/Type Annot
/URI http://www.arts.com

However when I create a link using the Acrobat link tool, the dictionary
object looks like this:

/A Dict:2 [24 0 R]
/S URI
/URI www.workinglink.com
/BS Dict: 3
/S S
etc...

What I wanted to know is how to nest the /S and /URI key/value pair
underneath the /A key, as it is in the latter example above. My C++ code
i'm using at the moment is:

//Add annotation
LinkAnnot = PDPageAddNewAnnot(pdPage, addAfter,
ASAtomFromString("Link"), (const struct _t_ASFixedRect *)&boundingRect);

CosObj theObj = PDAnnotGetCosObj(LinkAnnot);
CosDoc cdoc = PDDocGetCosDoc(pdDoc);

CosDictPut(theObj, ASAtomFromString("S"),
CosNewString(cdoc,false,"URI", strlen("URI" )));
CosDictPut(theObj, ASAtomFromString("URI"),
CosNewString(cdoc,false,"http://www.arts.com",
strlen("http://www.arts.com" )));

PDAction newAction = PDActionFromCosObj (theObj);
PDLinkAnnotSetAction (LinkAnnot, newAction);

AVPageViewRectToDevice(pageView, &boundingRect, &rect);
AVPageViewInvalidateRect(pageView, &rect);

Would appreciate any help.

Thanks,
Chris.


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.