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


in reply to Re: PDF::Create Questions
in thread PDF::Create Questions

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.

peppiv

Replies are listed 'Best First'.
Re^3: PDF::Create Questions
by tall_man (Parson) on Apr 08, 2003 at 15:33 UTC
    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!

      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.