Skip to content

A simple C wrapper library, for generating PostScript files.

Notifications You must be signed in to change notification settings

profmadden/pstools

Repository files navigation

pstools

A simple C wrapper library, for generating PostScript files.

This library was presented at WOSET2020, a Workshop on Open Source EDA Tools

WOSET Paper (PDF) YouTube presentation

PostScript is a handy language for creating graphics, text, and whatnot. Really, some first-rate magic from the good folks at Adobe. This library is designed to make creating PostScript files from C programs a little less cryptic, and a little less painful.

For writing raw PostScript, here's some good references:

Call ps_init to open a file and generate the boilerplate PostScript, that should be at the front. This will create a virtual drawing surface, with an XY origin, and a width and height.

ps_context *context = ps_init("filename.ps", float originx, float originy, float width, float height);

Then, call the various ps routines with your C code, to create lines, circles, text, and so on. After you're done, call ps_finish which will generate the terminating boilerplate for the PostScript, and closes the file.

This should create a PostScript file that you can then view with Adobe Acrobat, convert to encapsulated PostScript with gs, and so on. We use something like this:

gs -o OutputFileName.pdf -sDEVICE=pdfwrite -dEPSCrop InputFileName.ps

In our research group, we use this to generate debug information and draw figures, from our design automation tools. PostScript is cross-platform, so there's no worries if we're running on Mac, Linux, or Windows. The PostScript renders nicely, is generally very compact, and makes it easy to capture visuals at different points in the run of a tool.

This software is made available without restriction, for any purpose you might wish (but obviously, comes with no warranty or support commitment). It would be cool if you let us know if you use it, and maybe mention it if it's in a research paper or something.

About

A simple C wrapper library, for generating PostScript files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages