PostScript/Simple version 0.05 ============================== PostScript::Simple allows you to have a simple method of writing PostScript files from Perl. It has several graphics primitives that allow lines, circles, polygons and boxes to be drawn. Text can be added to the page using standard PostScript fonts. Features include: Generation of multi-page PostScript files Generation of single-page EPS files Creating lines/circles etc. Rectangles and boxes Text Colour Pre-defined paper sizes Etc. etc. A module that provides compatibility with the GD module calls might also one day be written, so that programs may be easily be converted to produce PostScript. Don't hold your breath. The file examples/example.pl provides some bad examples of what this module does. Changes from 0.04: Watch Out! Several functions now have options passed by hash reference, rather than the method used before. Your programs might break! This way is a lot tidier... sorry if this caused any problems. For example, before: $p->box(10,10,20,20, 1); $p->text(15, 15, "Hello", 'right'); $p->polygon("rotate=45", 1,1, 1,2, 2,2, 2,1, 1,1); now: $p->box({filled=>1}, 10,10, 20,20); $p->text({align=>"right"}, 15,15, "Hello"); $p->polygon({rotate=>45}, 1,1, 1,2, 2,2, 2,1, 1,1); INSTALLATION To install this module type the following: perl Makefile.PL make make test make install COPYRIGHT AND LICENCE Copyright (C) 2002 Matthew C. Newton / Newton Computing This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details, available at http://www.gnu.org/licenses/gpl.html. ACKNOWLEDGEMENTS Thanks go to the following: m.s.withall2@lut.ac.uk for help with the initial idea riechert@pobox.com for help with the distribution pkent@cpan.org for many updates and fixes dion@swamp.dk for updates for font encoding, text alignment and more michael.tomuschat@planet-interkom.de for several updates (not yet merged) cade@cpan.org for text rotate / align update stuff marty@ancient-scotland.co.uk for lots of useful discussion ...and probably more, apologies if you are missing from this list and have contributed something. If you have sent me a patch for this module, and had no reply, please re-send it. I'm particularly bad at missing e-mails... TO-DO / DONE LISTS: Done: landscape seems to work ok xsize and ysize set fine colour option works. need to alter colour->grey calculation (i know how to) clipping works eps option works (but output needs slight modification save/restore etc) page option works. setpage allows page number/name to be changed bb[xy][12] options are in and set lines, circles and boxes work. functions only added when needed. setcolour function works. colour look-up table added. postscript DSC headers seem to be fine (for PS and EPS) colour->grey calculation (tested: this is actually ok) different line widths polygon function text and font functions paper sizes defined and used (DSC comment added) better error reporting (postscript comments still?) font encoding for european etc. add dd cc and sp to units text rotate / align To-Do: PostScript "compression", i.e. /n {newpath} bind def any postscript optimisation that can be done? import eps files into the postscript hope that units are now correct... check postscript font support? define shape functions translate / scale / rotate functions? gd wrapper module generate PostScript using a stack, rather than writing to the end of a text variable? could lead to some rather neat stuff (loops etc) triangle function(s) probably not... polygon does this different line styles (dashes)? code compression using single letter dictionary defs (optional?) my-printer-can-play-jingle-bells-now function? nope, we're not trying to write BeetHoven files... ttf font support (get lost!) (compare gd module for functions that we could do with) pie slices / arcs how about "write this out as a PDF file" option? possibly, as pdf is related... nope, use pstopdf write out as xfig file option? nope, this is a postscript module. maybe Graphics::Vector next? write out as LaTeX picture (XYPic?) file option? nope, see above