[changeset] improved support for pdf output

Ben Abbott bpabbott at mac.com
Wed Apr 8 18:57:13 CDT 2009


On Apr 8, 2009, at 2:17 PM, Michael D. Godfrey wrote:

> Ben,
>
> Here is what I learned about matlab behavior:
> matlab version 7.5.0 (R2007B)
> I did:
> print -depsc  't2eps.eps'     -> %!PS-Adobe-2.0 EPSF-1.2
>
> print -dpdf  't2pdf.pdf'        -> %PDF-1.4
> and
> print('teps.eps')                -> %!PS-Adobe-3.0
>
> No PS -d option is provided.

hmm ... the Mac version of Matlab has supported {"-dps", "-dpsc" , "- 
dps2", "-dpsc2"} for the last few years.

>  Matlab seems not use the suffix to
> decide anything.  Therefore, print('tps.ps')  and print('teps.eps')
> produce identical outputs except for the %%Title: and %%CreationDate.
> However, print -deps 't2eps.eps' and print('t2eps.eps') do not produce
> the same outputs.  The only way to get PS seems to be  
> print('teps.eps').

The following should produce a ps file

	print (gcf, "-dps", "test.ps").

> For PS and EPS the bounding box is "tight" and the same for the
> both print -depsc and print('teps.eps').

I tried the following with Matlab 2008b

 >> plot(1:10)
 >> print(gcf,'-dps','test.ps')

The bounding-box is at the end of the ps-file

%%Trailer
%%BoundingBox:    78   215   548   589
%%Pages: 001
%%EOF

The bounding box is tight. However, the page size is usletter.  To be  
fully compatible we need to render a full page and then crop the  
bounding box. Is it worth the hassle to do that (I don' t know how to  
do that cross-platform).

Regarding pdf output, Matlab does produce a usletter size page. I'm  
much less fluent if the pdf language. While there is no "boundingbox",  
I did notice ...

	MediaBox [0 0 612 792]

Which is 8.5x11 inches. So it appears to me that the changeset is  
doing the correct thing.

In any event, as a result of our discussions I've looked at the  
behavior of Matlab's printing more closely. It appears I've been  
working under false impressions about how the paper* properties are   
intended to be treated. I haven't been paying attention to  
paperpositionmode. When paperpositionmode == "auto" devices directed  
related to printed output (ps & pdf) respect the papersize. The other  
devices render an output that mirrors the image on the screen (I  
think ... I'll need to experiment further to be sure).

Ben



More information about the Bug-octave mailing list