Generating postscript file

Discussion in 'Perl Misc' started by BCC, Nov 4, 2004.

  1. BCC

    BCC Guest

    Does anyone know of a perl module like GD that will allow me to draw
    with colors and shapes and save it as a postscript file? GD doesnt give
    me that option unfortunately.

    Looked in CPAN and didnt see anything.

    Thanks
    BCC, Nov 4, 2004
    #1
    1. Advertising

  2. BCC

    Ala Qumsieh Guest

    BCC wrote:
    > Does anyone know of a perl module like GD that will allow me to draw
    > with colors and shapes and save it as a postscript file? GD doesnt give
    > me that option unfortunately.


    Could be overkill, but a Tk::Canvas allows you to dump the contents of
    the canvas as a postscript file. It is part of Tk which is a GUI
    toolkit, so you won't find all of the functionality offered by
    graphics-specific modules like GD.

    --Ala
    Ala Qumsieh, Nov 4, 2004
    #2
    1. Advertising

  3. BCC

    Jon Ericson Guest

    Jon Ericson, Nov 4, 2004
    #3
  4. BCC

    Ian Wilson Guest

    BCC wrote:

    > Does anyone know of a perl module like GD that will allow me to draw
    > with colors and shapes and save it as a postscript file? GD doesnt give
    > me that option unfortunately.
    >
    > Looked in CPAN and didnt see anything.
    >
    > Thanks


    #!/bin/perl
    use warnings;
    use strict;

    my $text='Why not learn Postscript?';

    print <<ENDPS;
    %!PS
    %
    % define a handy subroutine to scale units
    %
    /inch { 72 mul } def
    %
    % draw a blue rectangle
    %
    0 0 1 setrgbcolor
    1 inch 8 inch moveto
    6 inch 8 inch lineto
    6 inch 9 inch lineto
    1 inch 9 inch lineto
    closepath
    fill
    %
    % write some text
    %
    1.8 inch 8.4 inch moveto
    /Helvetica findfont 22 scalefont setfont
    1 setgray
    ($text) show
    %
    % emit page
    %
    showpage
    ENDPS
    Ian Wilson, Nov 5, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arthur

    Printing Postscript in Perl

    Arthur, Mar 7, 2004, in forum: Perl
    Replies:
    2
    Views:
    645
    Roel van der Steen
    Mar 7, 2004
  2. Roedy Green
    Replies:
    0
    Views:
    1,084
    Roedy Green
    Aug 2, 2003
  3. J M
    Replies:
    2
    Views:
    147
    Darren Dunham
    Jan 26, 2004
  4. Carsten Thomas

    print file information from postscript headers

    Carsten Thomas, Nov 9, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    100
    Carsten Thomas
    Nov 9, 2005
  5. Replies:
    0
    Views:
    160
Loading...

Share This Page