http://www.perlmonks.org?node_id=1067537

flexvault has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I use 'PDF::API2' to generate pdf reports and I now need to add a hyperlink to get a pdf document within one of the reports. I tried this:

$pdf->link( 'http://search.cpan.org', 'A Hyperlink', x => 350, y => $pdf->height - 150 );

I took this format from 'PDF::API2::Simple;' which I get errors trying to install from CPAN. Can it be done with 'PDF::API2' directly?

Thank you...Ed

"Well done is better than well said." - Benjamin Franklin

Replies are listed 'Best First'.
Re: Anyone know how to add a Hyperlink with PDF::API2
by soonix (Canon) on Dec 18, 2013 at 10:39 UTC

    Since PDF::API2::Simple is just a wrapper around PDF::API2, the answer has to be yes.

    But originally you wanted to use PDF::API2::Simple. I, too, tried to install it from CPAN, and also got an error. I don't know what your error was, mine was
    Can't locate inc/Module/Install.pm in @INC

    After I installed Module::Install from CPAN (seems to be a missing dependency), and changing one of the tests (Windows can't unlink open files, bug is older than my youngest son), I was able to install it. Perhaps with this info, you should be able to install it, too.

    Update: I'm a bit puzzled. The aforementioned bug is filed against PDF::API2::Simple, which uses ->saveas from PDF::API2 which in turn should close the file. Maybe an upstream bug?

      The Module::Install module should have been included in the P::A::S distribution in the inc directory, but it is not. File this as a bug against P::A::S (Update: unless already submitted - see below).

      --MidLifeXis

        There is already a bug "missing inc directory", which contains the aforementioned error message.

        next update: I just noticed there is an "unauthorized release" 1.1.5 by chromatic.
        I am behind a firewall and therefore using a "Minicpan" which is obviously outdated.
        Will try to check with actual CPAN and get back with the result later.

        cpan CHROMATIC/PDF-API2-Simple-1.1.5.tar.gz on a fresh strawberry didn't have the Module::Install missing (I added that info to rt://28125).
        rt://58106 still needs attention, but might be a problem in PDF::API2

      Dear soonix,

        Perhaps with this info, you should be able to install it, too.
      Thanks! You hit it right on ++ !

      Regards...Ed

      "Well done is better than well said." - Benjamin Franklin

Re: Anyone know how to add a Hyperlink with PDF::API2
by ww (Archbishop) on Dec 18, 2013 at 03:13 UTC