Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Generating postscript file

Reply
Thread Tools

Generating postscript file

 
 
BCC
Guest
Posts: n/a
 
      11-04-2004
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
 
Reply With Quote
 
 
 
 
Ala Qumsieh
Guest
Posts: n/a
 
      11-04-2004
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
 
Reply With Quote
 
 
 
 
Jon Ericson
Guest
Posts: n/a
 
      11-04-2004
BCC <(E-Mail Removed)> writes:

> 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.


Not a Perl solution, but I use MetaPost
(http://cm.bell-labs.com/who/hobby/MetaPost.html).

It looks like there's a PostScript::Simple module
(http://search.cpan.org/~mcnewton/Pos...t-Simple-0.06/).

Jon
 
Reply With Quote
 
Ian Wilson
Guest
Posts: n/a
 
      11-05-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can anybody give me an example about how to write the image drawn by the canvas in WxPython into postscript file Hank Gong Python 0 04-12-2007 06:06 PM
Printing a postscript file with Win32::Printer paul.dorman@gmail.com Perl Misc 0 06-30-2006 01:29 AM
print file information from postscript headers Carsten Thomas Perl Misc 0 11-09-2005 04:07 PM
grep for text from a postscript file J M Perl Misc 2 01-26-2004 07:29 PM
Re: anyone know here to get the API/Library for reading Postscript file into JAVA? Roedy Green Java 0 08-02-2003 06:28 AM



Advertisments