[changeset] printing multipage postscript files

Ben Abbott bpabbott at mac.com
Wed Jun 3 05:54:42 CDT 2009


On Jun 3, 2009, at 5:53 AM, Ben Abbott wrote:

>
> On Jun 3, 2009, at 5:04 AM, Petr Mikulik wrote:
>
>> In Octave 2.x, printing many drawings into one multipage postscript
>> file
>> was very easy:
>> 	gset term post; gset out 'a.ps'
>> 	plot(1:10)
>> 	plot(2:20) # many plots from simulations, one plot per page
>> 	gset out; gset term x11
>>
>> (Note that multipage pdf files or animated gifs were also possible
>> using
>> gset term pdf or gset term gif animate.)
>>
>> In Matlab, it is achieved in a more complicated way which requires
>> "print"
>> command after each plot:
>> 	plot(1:10)
>> 	print a.ps -dps
>> 	plot(2:20)
>> 	print a.ps -dps -dappend
>>
>> which actually needs to be written in this way if the same script
>> generates
>> graphs for screen and/or printer:
>> 	print=1;
>>       plot(1:10)
>>       if (print) print a.ps -dps; endif
>>       plot(2:20)
>>       if (print) print a.ps -dps -dappend; endif
>>
>> How to achieve this in Octave 3.x where gset is no longer possible?
>> Gnuplot does not support concatenation of output into one file.
>>
>> It seems to me that the "-dappend" option could be easily
>> implemented in
>> Octave this way (requires ghostcript and creation of two temporary
>> files):
>>   print a.ps -dps -dappend
>> =>
>>   drawnow('/tmp/tmp1.ps')
>>   gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=/tmp/tmp2.ps \
>> 	 a.ps tmp1.ps -c quit
>>   mv /tmp/tmp2.ps a.ps
>>
>> If ghostscript is not found, then the last plot will overwrite the
>> file,
>> i.e.
>>  mv /tmp/tmp1.ps a.ps
>>
>> On unixes, ghostscript is always called "gs", thus there will be no
>> problem.
>> On Windows, these names can be rather different ("gswinc"?).
>> On Mac?
>>
>> Could the "-dappend" functionality by added?
>
> Petr,
>
> As Octave's print command already relies upon ghostscript, such
> functionality can be added without to much difficulty.
>
> Regarding Mac OSX, it is another Unix variant, so what works on other
> unixes can work there as well.
>
> I'll take a look at this over the next few days.
>
> Ben

Petr,

Please check that this works are you expect. I've tested the three  
examples below on Mac OSX with no problems.

surf(peaks)
print -dps append.ps
sombrero (25)
print -dps -append append.ps

surf(peaks)
print -dpdf append.pdf
sombrero (25)
print -dpdf -append append.pdf

surf(peaks)
print -dps append.ps
rename ("appdend.ps", "append.pdf");
sombrero (25)
print -dpdf -append append.pdf

The last one I hadn't expected to work, but ghostscript handled it  
nicely.

Ben



-------------- next part --------------
A non-text attachment was scrubbed...
Name: changeset.patch
Type: application/octet-stream
Size: 3895 bytes
Desc: not available
Url : https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20090603/a4ba4bfa/attachment.obj 
-------------- next part --------------







More information about the Bug-octave mailing list