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

Re: Problem using PNG images created by GD::Graphs in an API2 PDF doc

by Albannach (Monsignor)
on May 10, 2004 at 14:22 UTC ( [id://352060]=note: print w/replies, xml ) Need Help??


in reply to Problem using PNG images created by GD::Graphs in an API2 PDF doc

I don't pretend to know what is going on, but as I was bored, here are a couple of things that I did to your code, and I did end up with a functioning PDF:

  • use non-interlaced PNG with $image->interlaced(undef); in the PNG sub
  • throw in a $hPdf->save; at the end of the PDF sub
  • make sure your media box is large enough (at least 800x600 in your case)

Hope this helps!

Update: Versions I used (:

  • Perl 5.8.3 as ActiveState build 809 on Win2k
  • GD::Graph::bars 1.25
  • PDF::API2 0.3r77

It also appears that the stringify is messing things up - either put the save before it or just remove it altogether as it serves no useful purpose (at least in this code fragment).

--
I'd like to be able to assign to an luser

Replies are listed 'Best First'.
Re: Re: Problem using PNG images created by GD::Graphs in an API2 PDF doc
by jmo0099 (Initiate) on May 12, 2004 at 17:49 UTC
    Thanks for taking the time to track down that info. For some odd reason this did not take care of the problem, I still get the same error. I am running the same package revisions as you are, with the only difference that I can see is that I am running Linux (RedHat 9) and you are running windows. Its hard (and scarey) to believe that this would make such a difference in the operation of these packages. Maybe I need to uninstall + re-install all packages to make sure that I have complete distributions. Thanks, John
Re: Re: Problem using PNG images created by GD::Graphs in an API2 PDF doc
by jmo0099 (Initiate) on May 10, 2004 at 23:18 UTC
    I tried your suggestions. What I did was:
        Added "$image->interlaced(undef);" in the line after I call the plot method.
        Added "$hPdf->save;" in the line after I called the stringify method.
        Changed the dimensions of the mediabox to be 1200x900.

    Unfortunately, after all this I am still having the same problem. When the PDF file is created it starts printing out "substr outside of string at /usr/lib/perl5/site_perl/5.8.3/PDF/API2/PDF/ImagePNG.pm line 137.".

    Do you know what versions of these packages you are running? Maybe there is some incompatability if I am on the bleeding edge of releases.

    Thanks for your help,
    John

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-28 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found