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

Hi All,
I'm having a hell of a time with PDF::API2.
I have a document on which I have placed a heap of text.
Now, I want to draw a black line. The following works OK to draw a red line:
my $gfx2=$page->gfx; $gfx2->strokecolor('red'); $gfx2->move(100,100); $gfx2->line(200,200); $gfx2->stroke;
However, if I change strokecolor('red') to strokecolor('black'), I don't get a line on the screen, and it plays havoc with Acrobat reader (parts of the document suddenly go missing, all sorts of odd things going on when trying to view the document).
I'm not the first one to complain about the PDF::API2 docs, but can anyone tell me where to find appropriate color definitions for this module?

Replies are listed 'Best First'.
Re: PDF::API2 colors
by McDarren (Abbot) on Jul 04, 2006 at 07:16 UTC
    A quick google came up with this link, which says:
    PREDEFINED COLORS See the file unicolor.txt for a complete list.

    I guess that file comes with PDF::API2::Util
    Does that help?

    Cheers,
    Darren :)

      Kinda. Looks like unicolor.txt isn't actually installed on a Win32 machine, but I found PDF::API2::Util.pm, which defines all the colors. Black is one of them , so I think my issue is somewhere else.