PDF::API2 (Creating PDF files)

J

Jasper2000

Hi,

I'm creating PDF's on the fly, with Perl 5.8, using PDF::API2.

I have no problem with most of it, albeit there's a bit of a learning
curve with creating PDFs, but I can't figure out how to insert a URL
with anchor text.

i.e. It's easy enough to insert a URL as text, and the PDF will
recognize it as a URL and make it clickable when viewed in Acrobat.
However, I would like to be able to insert a URL, such as http://www.test.com
yet have the link text be something like "Test Site" (with the actual
URL not visible).

I know it's possible to do it with PDF::API2::Simple, but the rest of
my script is already done using PDF::API2, so I hope to keep it that
way if possible.

Any assistance would be greatly appreciated, since there seems to be a
bit of a lack of good documentation for this particular module.

Thanks!
 
J

Jasper2000

If you look at the source for PDF::API2::Simple, you will find that it
uses

@rect = $self->_render_text_at( $text_obj, $text, $x, $y, $align );
$annotation = $self->current_page->annotation;

$annotation->rect( @rect );
$annotation->url( $url );

where $self->current_page is the page currently being written and
$self->_render_text_at add a piece of text and returns its bounding box.
->annotation is documented in PDF::API2::page, and the returned object
is a PDF::API2::Annotation.

Ben


That's great ... thanks very much for your pointer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top