Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: PDF::Create Questions

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


in reply to Re: Re: PDF::Create Questions
in thread PDF::Create 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.

Replies are listed 'Best First'.
Re: Re^3: PDF::Create Questions
by peppiv (Curate) on Apr 09, 2003 at 12:43 UTC
    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!

    peppiv

      You are not being specific about what you mean by "I fail" and "it doesn't work." What's the error message?

      Using the sample.pl file that came with the PDF::Create module, I was able to overwrite an existing pdf file with no problem at all. I can't imagine what is going wrong unless there is something strange about "/html"... Try creating and overwriting in a local directory instead.

        My apologies. I let my frustration get the better of me sometimes. Appreciate the patience.

        I can easily create a file using this:
        my $pdf = new PDF::Create ('filename' => '../html/logs/mypdf.pdf', 'PageMode' => 'UseNone', 'Title' => 'Anything', );
        If I use this:
        my $pdf = new PDF::Create "> ('filename' => '../html/logs/mypdf.pdf', 'PageMode' => 'UseNone', 'Title' => 'Anything', )";
        It doesn't create a pdf. And it doesn't overwrite the existing one. I tried using a local directory and it made no difference.

        This is the error message I get when I run the second piece of code.

        Odd number of elements in hash assignment at /usr/lib/perl5/site_perl/5.6.1/PDF/Create.pm line 28.

        When I placed the '>' symbol in different parts of the line I would get 'syntax error in line ...... around '>'.."

        I know I'm missing something small here, and I just can't seem to find it. Any ideas are welcome. (Except "don't quit your day job"!) I like learning Perl!

        peppiv

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2021-06-19 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (92 votes). Check out past polls.

    Notices?