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!
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.