PostScript Processing Question

Oct 01, 2009 7 Replies

I found a way to concatenate multiple PostScript files, add a special header and footer, and end up with a single file that can be converted to PDF.



I use this to collect data from 50 or more simulation runs onto a single graph.



Problem: Resulting PDF is HUGE, because, for example, the grid and its scales are repeated 50 or more times.



Anyone know of a cute way to find duplicates and delete them?



I have UltraEdit v14 at my disposal, though I would consider purchasing something else if it were "slick" ;-)



Thanks!



...Jim Thompson


| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Why not output the data as ASCII and use Gnuplot to make the plots? You only need to figure out the Gnuplot script once.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

Tell me more!

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Gnuplot is a script-driven plotting program,

formatting link
You make a script that reads an ASCII data file and plots it any way you like. Once you have it set up the way you want, you just change the name of the data files and away you go. This takes a bit of experimenting, but there are a _lot_ of examples on the website.

You can do simple data manipulation, e.g. sums, differences, products, and absolute values. If you want to do any serious processing of the data before plotting, Gnuplot is also the native plot package of GNU Octave, which is an open-source Matlab clone.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

If you do a lot of this, i would recommend writing a program to find duplicates (and delete them). Might even take commonly used sections and write canned "subroutines" that can be called umpteen times inside the PS file (/JTscale1 {blah blah} def). As you know, these "subroutines" can also be in an external file.

What, no Windows GUI overlay ?:-)

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

There's a Windows app that does the display. I usually use it under Cygwin, which has a separate X11 display program. But for making Postscript you don't need a display at all. (I use ghostview or ps2pdf from the Ghostscript package to make pdfs when needed.)

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 hobbs at electrooptical dot net http://electrooptical.net

As a *general* problem, I believe it's unfeasible to solve in a complete way, due to the Turing-complete nature of PostScript.

As a specific problem, for combining graphs generated by a particular program, it'll depend on how that program generates the graphs (e.g. the grids and scales). If it spits out PostScript which includes graph-and-scale-generating PostScript procs (e.g. if it has a library that it just includes) you can probably use Perl or some similar string-and-pattern-friendly language to strip out the library inclusion in all but the first image, and just re-invoke the procs in subsequent pages. On the other hand, if the program "open-codes" the graphs and scales, you'll have a more complex pattern-recognition procedure to write.

You could try running the script through Distiller or a similar PostScript-to-PostScript optimizer, and see if that helps.

Dave Platt AE6EO Friends of Jade Warrior home page: http://www.radagast.org/jade-warrior I do _not_ wish to receive unsolicited commercial email, and I will boycott any company which has the gall to send me such ads!

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required