Thread Subject: Save figure within GUI not working

Subject: Save figure within GUI not working

From: Amir

Date: 10 Jul, 2008 17:36:06

Message: 1 of 2

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!

Subject: Save figure within GUI not working

From: Richard Quist

Date: 17 Jul, 2008 00:29:02

Message: 2 of 2

"Amir " <amirschricker.DELETE@DELETE.gmail.DELETE.com> wrote
in message <g55ha6$itc$1@fred.mathworks.com>...
> 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!

Check the PaperPositionMode property of your figure. If it's
set to 'auto' then the output should sized to match the
figure's (newFig) width and height (based on the 3rd and 4th
values of the figure's Position property). If the
PaperPositionMode property is set to 'manual' then the
output should be sized based on the value of the figure's
PaperPosition property.

--

Richard Quist
Software Developer
The MathWorks, Inc.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
paperposition Richard Quist 16 Jul, 2008 20:30:12
print Richard Quist 16 Jul, 2008 20:30:12
pdf Richard Quist 16 Jul, 2008 20:30:12
gui Amir 10 Jul, 2008 13:40:13
save as pdf Amir 10 Jul, 2008 13:40:13
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com