Path: news.mathworks.com!not-for-mail
From: "Amir " <amirschricker.DELETE@DELETE.gmail.DELETE.com>
Newsgroups: comp.soft-sys.matlab
Subject: Save figure within GUI not working
Date: Thu, 10 Jul 2008 17:36:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 18
Message-ID: <g55ha6$itc$1@fred.mathworks.com>
Reply-To: "Amir " <amirschricker.DELETE@DELETE.gmail.DELETE.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1215711366 19372 172.30.248.37 (10 Jul 2008 17:36:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 10 Jul 2008 17:36:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1056418
Xref: news.mathworks.com comp.soft-sys.matlab:478669



Hi. I have a GUI that contains a plot, which I'm trying to 
be able to save as a PDF at the click of a button. It isn't 
working perfectly, however. A PDF is created with the 
correct plot and all, but the position/size of the plot in 
the PDF isn't fullscreen (as if I created it from the 
Matlab command window), rather the same shape/size as it is 
on the GUI. 

Here is the code I use:

function saveasPDF_Callback(hObject, eventdata, handles)
 [f p]=uiputfile('*.pdf','Save as PDF');
 newFig=figure;
 axesObject2=copyobj(handles.axes1,newFig);
 print(newFig,'-dpdf',[p f]);


Any ideas? Thanks!