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 
Switch to threaded view of this topic Create a new topic Submit Reply
ps export/import [message #23110] Thu, 04 January 2001 13:51 Go to next 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 102 times)
Re: ps export/import [message #23126 is a reply to message #23110] Thu, 11 January 2001 04:30 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
"Wim G. Bouwman" wrote:
>
> 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.
>

That's not easier that's horrible.

The best is to use latex!


regards
Reimar



> Martin Schultz wrote:
>
>> 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.
>
> --
>
> Dr. Wim G. Bouwman phone (++31) (0)15 2786775
> Interfacultair Reactor Instituut fax (++31) (0)15 2788303
> Technische universiteit Delft w.g.bouwman@NOSPAMiri.tudelft.nl
> Mekelweg 15 http://www.iri.tudelft.nl/~bouwman
> 2629 JB Delft The Netherlands
Re: ps export/import [message #23129 is a reply to message #23110] Wed, 10 January 2001 22:07 Go to previous messageGo to next message
Wim Bouwman is currently offline  Wim Bouwman
Messages: 8
Registered: September 1997
Junior Member
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.

Martin Schultz wrote:

> 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.

--

Dr. Wim G. Bouwman phone (++31) (0)15 2786775
Interfacultair Reactor Instituut fax (++31) (0)15 2788303
Technische universiteit Delft w.g.bouwman@NOSPAMiri.tudelft.nl
Mekelweg 15 http://www.iri.tudelft.nl/~bouwman
2629 JB Delft The Netherlands
Re: ps export/import [message #23208 is a reply to message #23110] Thu, 11 January 2001 19:07 Go to previous messageGo to next message
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
"Liam E. Gumley" wrote:

> Since you mention WMF, I thought I'd mention that IDL 5.4 supports a
> Windows Metafile graphics device (set_plot, 'METAFILE'). It might be
> just the thing for producing graphics files which can be insrted into
> presentation applications such as Powerpoint. The advantage of WMF files
> is that they can be resized without loss of resolution, and they are
> recognized by Powerpoint on both Windows and MacOS platforms (and
> presumably by StarOffice as well).
>


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. Seems a pity. I was able to insert them
in PowerPoint and MSWord just fine. Nice to know about - thanks, Liam.

Dick
Re: ps export/import [message #23216 is a reply to message #23129] Thu, 11 January 2001 09:43 Go to previous messageGo to next message
Craig Markwardt is currently offline  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 #23222 is a reply to message #23129] Thu, 11 January 2001 07:44 Go to previous messageGo to next message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
"Wim G. Bouwman" wrote:
> 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.

Since you mention WMF, I thought I'd mention that IDL 5.4 supports a
Windows Metafile graphics device (set_plot, 'METAFILE'). It might be
just the thing for producing graphics files which can be insrted into
presentation applications such as Powerpoint. The advantage of WMF files
is that they can be resized without loss of resolution, and they are
recognized by Powerpoint on both Windows and MacOS platforms (and
presumably by StarOffice as well).

However for insertion into documents (e.g. Word) I still create
Postscript files in IDL, and then convert them to EPS with TIFF preview
in GSView. David has written a nice article which describes the method I
use:

http://www.dfanning.com/tips/postscript_preview.html

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
Re: ps export/import [message #23368 is a reply to message #23208] Mon, 15 January 2001 05:46 Go to previous message
hahn is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: impossible?: overlaying lineplots on surface-plots
Next Topic: write JPEG

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

Current Time: Wed Oct 08 13:48:17 PDT 2025

Total time taken to generate the page: 0.00610 seconds