in reply to Re: How do I replace certain character if condition exists
in thread How do I replace certain character if condition exists

Great Job Bart.. could you post your additions to add color? Sounds great :)
  • Comment on Re: Re: How do I replace certain character if condition exists

Replies are listed 'Best First'.
PDF::Create::Extensions (was: Re: How do I replace certain character if condition exists)
by bart (Canon) on Apr 21, 2003 at 21:00 UTC
    could you post your additions to add color? Sounds great :)
    Sure. Eventually, I'd like to get it on CPAN, but I'm not sure how long it can still take, so in the meantime, here's my add-on module for PDF::Create, which I gave the name PDF::Create::Extensions. All you need is this extra file, which adds a few methods to PDF::Create::Page, and they're available as soon as you do
    use PDF::Create; use PDF::Create::Extensions;
    You can create two kinds of colour, "linecolor" (for lines) and "fillcolor" (for area fills). For each, you can set the color in the same way, in RGB ("RGB" or "RG": red, green, blue, each value ranging from 0 to 1, less is darker), grayscale ("GRAY", "GREY" or "G", 1 value from 0 (white) to 1 (black); and CMYK ("CMYK" or "K", 4 values from 0 to 1, more is darker), like this:
    $page->linecolor(RGB => 0.6, 0.2, 0.2);
    The color type is case insensitive.

    The second thing you can set, is line width, line connection style ("join": styles "miter", "round", "bevel"), and line end style ("cap": styles "butt", "round", "square" (="projecting square")), like this:

    $page->linewidth(0.8, 'join' => 'miter');
    See the PDF documentation on what the possibilities represent, or just experiment with these options. Again, the names are case insensitive.

    Save the next code as PDF/Create/Extensions.pm somewhere in your @INC

      Wow bart! Very cool. Very easy to use. Thanks a million.

      peppiv