GD::Text::Wrap require a GD object.
So you have to put the 3d graph in an image and then make a GD object with it to pass to GD::Text::Wrap.

This works for me:
use GD; use GD::Graph::bars3d; use GD::Text::Wrap; use strict; my @data = ( ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], [ 1203, 3500, 3973, 2859, 3012, 3423, 1230] ); my $graph = GD::Graph::bars3d->new( 400, 300 ); $graph->set( x_label => 'Day of the week', y_label => 'Number of hits', title => 'Daily Summary of Web Site', ); my $gd = $graph->plot( \@data ); my $img_tmp="img_tmp.png"; open FILE, ">$img_tmp"; binmode FILE; print FILE $gd->png; close FILE; my $gd_image = GD::Image->newFromPng($img_tmp) ; my $text = <<EOSTR; Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. EOSTR my $wrapbox = GD::Text::Wrap->new( $gd_image, line_space => 4, color => 'black', text => $text, ); $wrapbox->set(align => 'left', width => 120); $wrapbox->draw(110,140); open FILE, ">img.png"; binmode FILE; print FILE $gd_image->png; close FILE;

In my Win32 box, it works properly with GD 1.27.2.
If you have a more recent version of GD, instead making a temporary image, you could use:
my $gd_image = GD::Image->newFromPngData($gd->png);

In reply to Re: Adding text to a GD::Graph object... by dree
in thread Adding text to a GD::Graph object... by Clownburner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.