comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » ps export/import
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
ps export/import [message #23110] Thu, 04 January 2001 13:51 Go to previous message
Martin Schultz is currently offline  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 103 times)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: impossible?: overlaying lineplots on surface-plots
Next Topic: write JPEG

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:14:23 PDT 2025

Total time taken to generate the page: 0.48086 seconds