Generating postscript file

B

BCC

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
 
A

Ala Qumsieh

BCC said:
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
 
I

Ian Wilson

BCC said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top