Re: PDF Javascript

Todd Hamilton <netarttodd-/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.pdfapi2
Message-ID <[email protected]>
Ben,

Thanks for that input.  I will most likely do
something like that.  It really does make sense to do
it that way.  My goal though was to get an updated
date value without having to manipulate the pdf.  My
thought is that if I have to update the pdf using
pdf::api2, then I (think) would have to have use a
server side printing method. (Which may be the way I
have to go anyway) I would rather do client side
printing.  My pdfs are being served to the client in a
web page.  I would like the users to just click print
from within the acrobat plugin.  What do you think?


--- Ben <[email protected]> wrote:


---------------------------------
                  
forgive me if I am not understanding what exactly you
want,

but if all you need is a date inside the pdf why not
do something like this

use PDF::API2;
use strict;

my $pdf = PDF::API2->new;
    my $page = $pdf->page;
    my $fontType = qq(Helvetica);
    my %font = (
        Helvetica => {
                        Bold   =>
$pdf->corefont('Helvetica-Bold',    -encoding =>
'latin1'),
                        Roman  =>
$pdf->corefont('Helvetica',         -encoding =>
'latin1'),
                        Italic =>
$pdf->corefont('Helvetica-Oblique', -encoding =>
'latin1'),
                     },
     );

my $datestring = tdate();

newText($fontType,  'Bold', 14/pt, 'black', 7/mm,
270/mm, $datestring );

sub newText{

            my $flashVars = $page->text;
             $flashVars->font( $font{$_[0]}{$_[1]},
$_[2] );
             $flashVars->fillcolor( $_[3] );
             $flashVars->translate( $_[4], $_[5] );
             $flashVars->text( $_[6] );
        }

sub tdate {
   @_ = localtime(shift || time);
   return(sprintf("%02d:%02d %02d/%02d/%04d", @_[2,1],
$_[4]+1, $_[3], $_[5]+1900));
}




-----Original Message-----
From: "Mr. Shawn H. Corey" 
Sent: Aug 7, 2007 6:53 PM
To: [email protected]
Subject: Re: [perl-text-pdf-modules] PDF Javascript

                  
netarttodd wrote:
> I would like to use PDF::API2 to create a pdf that
includes
> javascript.  What I am trying to actually accomplish
is have an
> updated print date appear at the bottom of the pdf
and updated each
> time the document is printed.  I think it can be
done via javascript,
> but I don't know how to add the javascript code to
the pdf using
> PDF::API2.  Thanks for you help.

I don't remember Javascript being mentioned inside
PDF.  But you can look yourself at
http://www.adobe.com/devnet/pdf/pdf_reference.html

-- 
Just my 0.00000002 million dollars worth,
  Shawn

"For the things we have to learn before we can do
them, we learn by doing them."
  Aristotle

    
          


    
          



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.