Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: PDF::Create Questions

by tall_man (Parson)
on Apr 08, 2003 at 13:26 UTC ( #248922=note: print w/replies, xml ) Need Help??

in reply to PDF::Create Questions

In the PDF::Create constructor code, I find the following line:
my $fh = new FileHandle "> $self->{'filename'}";
It means that the file will be overwritten automatically, (provided you have write permission to the old file).

The pod for contains a command to add a rectangle to the path. Then you can either stroke or fill that path. For example:

$page2->rectangle(0,0,40,60); $page2->stroke();
Update: improved rectangle example.

Replies are listed 'Best First'.
Re: Re: PDF::Create Questions
by peppiv (Curate) on Apr 08, 2003 at 14:32 UTC
    Thank for the help. The rectangle works like a charm. It's a shame you couldn't shade with the fill command. That would rock.

    In the FileHandle example (your code explains more than the docs) how do I declare $self? Would this line come after the Create line? Sorry for all the questions.


      You don't have to declare $self. I just clipped out a line from the PDF::Create "new" function to show you that it opens the file with a '>' in front of the name, which means that it will overwrite the old file automatically. There's no extra code you have to put in.
        I can't seem to get it right. I understand using the '>' to open a file to overwrite, but no matter how I try to make the syntax work, I fail.

        How do I get from here

        my $fh = new FileHandle "> $self->{'filename'}";
        to here?

        my $pdf = new PDF::Create ('filename' => '/html/mypdf.pdf', 'PageMode' => 'UseNone', );
        Even trying this
        my $pdf = new PDF::Create "> ('filename' => '/html/mypdf.pdf', 'PageMode' => 'UseNone', )";
        and giving the pdf file 777 permissions doesn't work. Please help!


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://248922]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2021-06-15 01:08 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (66 votes). Check out past polls.