ps export/import [message #23110] |
Thu, 04 January 2001 13:51  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Hi all,
after struggling with this for ages and a whole day, I finally
figured out a way to import ps files generated with IDL into word
processing software such as StarOffice or Word. The trouble came
because
(a) I usually don't generate postscript with /ENCAPSULATE in IDL, so
my files are missing the EPSF-3.0 label in the first line
(b) I generate a lot of landscape plots which come out rotated in IDL
ps.
as a brave guy (but only after browsing through newsgroup archives
;-), I decided it should be possible to delete the rotate statement in
the ps file without destroying the file. Turns out one has to delete a
few more things as well: all bounding boxes, the page orientation and
a translate statement. If, thereafter, the honored user sends the
crippled file through ps2epsi (viva Unix ;-) she will have a perfect
encapsulated file including a preview image.
Attached is a small shell script which automates this process:
psfix filename [outfilename]
If outfilename is not given it will be the basefilename of filename +
'.eps'
Good night,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
#!/bin/sh
#
# shell script to fix postscript files that were generated in IDL
# with landscape orientation to create epsi files that can be
# imported into StarOffice
#
# Author: Martin Schultz, MPI, 04 Jan 2001
# The output file will be <filename>.eps unless otherwise specified
# check arguments
if [ .$1. == .. ] ; then
echo Usage: psfix inputfile [outputfile]
exit
else
infile=$1
fi
echo Converting $infile
if [ ! -s $infile ] ; then
echo Input file $infile not found!
exit
fi
if [ .$2. == .. ] ; then
outfile=`basename $infile .ps`.eps
else
outfile=$2
fi
echo generating EPS file $outfile
# remove bounding box and orientation statements
sed 's/%%BoundingBox:.*//' $infile > tmp___001.ps
sed 's/%%PageOrientation: Landscape//' tmp___001.ps > tmp___002.ps
rm -f tmp___001.ps
sed 's/%%PageBoundingBox:.*//' tmp___002.ps > tmp___003.ps
rm -f tmp___002.ps
# remove rotate and translate statements
sed 's/[0-9 ]*translate//' tmp___003.ps > tmp___004.ps
rm -f tmp___003.ps
sed 's/[0-9 ]*rotate//' tmp___004.ps > tmp___005.ps
rm -f tmp___004.ps
# convert to epsi
ps2epsi tmp___005.ps
rm -f tmp___005.ps
# rename
mv tmp___005.epsi $outfile
rm -f tmp___005.epsi
-
Attachment: psfix
(Size: 1.16KB, Downloaded 102 times)
|
|
|
|
|
|
Re: ps export/import [message #23216 is a reply to message #23129] |
Thu, 11 January 2001 09:43   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
"Wim G. Bouwman" <w.g.bouwman@iri.tudelft.nl> writes:
> Another easy way in an windows environment is to read the IDL produced
> post-script files in Correl-draw and after correcting your graph's (making the
> lines thicker, annotating the graph and putting the numbers on the axis at the
> correct positions) it can be exported in WMF-format.
I may have mentioned this before, but I have found, experimentally of
course, that the thickness of the lines should be increased bya factor
of 3, when going from the screen to the printed output.
When I make plotting scripts, I check for the output device and do the
multiplication if it's to the PS device.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
|
Re: ps export/import [message #23368 is a reply to message #23208] |
Mon, 15 January 2001 05:46  |
hahn
Messages: 108 Registered: November 1993
|
Senior Member |
|
|
"Richard G. French" <rfrench@wellesley.edu> wrote:
> Just tried this out and it works like a champ. Only problem is that
> METAFILE is not supported in the UNIX version of IDL, so if you are
> using UNIX, you are out of luck.
There is an old ISO standard for a graphics metafile called CGM,
computer graphics metafile. It can contain both vector and raster
graphics. The IDL interface is set_plot, "cgm" and you should
follow it by calling device with those keywords you need for that
application.
At least vector gaphics - that's what I use - are supported by
Word and many other programs. I'm not so familiar with the Unix
world so it depends on the programs you use there.
Norbert
|
|
|