beginr has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am generating a OrgChart using the following code. I am able to create the diagram but there are no text in that chart. I am using the following code segment and OS is Solaris 11
#!/usr/bin/perl use GD::OrgChart; use constant FONT => "/usr/openwin/lib/locale/KOI8-R/X11/fonts/TrueT +ype/TimesBold.ttf"; #use IO::Pipe; our $COMPANY; # put data into $COMPANY such that it looks like: $COMPANY = { text => "Owner", subs => [ { text => "President", subs => [ { text => "Watcher" }, { text => "Sitter" }, ]}, { text => "Security", subs => [ { text => "Watcher" }, { text => "Watcher" }, ]}, ]}; our $chart = GD::OrgChart->new({ size => 12, font => FONT }); $chart->DrawTree($COMPANY); open (PIC, ">gd.gif") || die "Oops unable open file"; if (PIC){ print "FILE OPENED"; }else { print "Oops!"; } binmode PIC; our $image = $chart->Image; print PIC ($image->gif()); close(PIC);

Replies are listed 'Best First'.
Re: GD OrgChart
by Khen1950fx (Canon) on Sep 21, 2006 at 08:51 UTC
    GD::OrgChart has some problems. I reviewed the readme to see what the dependencies are, and I noticed that it was designed with Perl module GD 1.41. The GD 1.x series had to drop support for GIF because of licensing issues. GIF support is back in the 2.x series; however, I don't think that GD::OrgChart supports it. It seems to be more suited for PNG, so give PNG a try instead of GIF.

    If you really have to use GIF, there are a couple of things that need to be done. First, make sure you have GD in the 2.x series installed and that it has GIF support. You can check that using the command "gdlib-config --features"---it'll list the formats that it supports. Second, you might want to consider using Image::OrgChart instead of GD::OrgChart. Personally, I prefer Image::OrgChart.