Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Printing Plots in PDF format
Date: Mon, 04 Aug 2008 10:47:28 -0400
Organization: The MathWorks
Lines: 44
Message-ID: <g774q0$mle$1@fred.mathworks.com>
References: <g6d752$3oa$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: quistr.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1217861248 23214 144.212.107.174 (4 Aug 2008 14:47:28 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 4 Aug 2008 14:47:28 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
In-Reply-To: <HIDDEN>
Xref: news.mathworks.com comp.soft-sys.matlab:483521



Naveen wrote:
> Hi, 
> Iam trying to create a bunch of plots, and print them to 
> pdf file. I am saving all my plots in figs() and if i 
> print them one by one into PDF file it works. But i like 
> to append them all together into one PDF file. I am unable 
> to do this. Any help is appreciated very much. Thanks in 
> advance. Best, Naveen
> 
> % Print each of the 10 plots in a separate PDF document. 
> 
> print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
> print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
> print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
> print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
> print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
> print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
> print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
> print(figs(8),'-dpdf','-r600','-painters','test8.pdf')  
> print(figs(9),'-dpdf','-r600','-painters','test9.pdf')     
> print(figs(10),'-dpdf','-r600','-painters','test10.pdf')  
> 
> % Print all the 10 plots into one PDF document. 
> 
> print(figs(1),'-dpdf','-r600','-painters','test.pdf');
> for i=2:length(figs)
>         print(figs(i),'-append','-dpdf','-r600','-
> painters','test.pdf');
> end

The -append option in MATLAB is only supported for postscript output. Take a 
look at my ps2pdf function, available from the File Exchange 
here:http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1097474&objectType=author

It will let you take a postscript file (including a multi-page file generated 
from MATLAB with the -append option) and convert it to PDF.

Hope that helps.

-- 

Richard Quist
Software Developer
The MathWorks, Inc.