How to print figure generated by GUI?
5 views (last 30 days)
Show older comments
I have created a GUI that outputs a figure with some text on it. The figure is set up using the following code:
figure(1)
set(1, 'units', 'pixels', 'pos', [0 0 612.48 792.627])
axis off
set(gca,'Position',[0.1 0.1 0.1 0.1],'units','pixels') % Margin
set(gca, 'XTick', [])
set(gca, 'YTick', [])
The text is placed on the figure using text(). After a pushbutton is pushed, the figure is displayed. The issue that I am having is I am trying to have the pushbottom not only display the figure but also print the figure after it is displayed. The figure title is 'Figure 1'. I have tried to put print('Figure 1','-fillpage') in the push button but that gives the following error message:
Problem sending file to output device, system returned error :
lpr: The printer or class does not exist.
I have also tried to manually print the figure from the file menu, but this gives the same error as above. Is what I am trying to do possible or would I have save and print the figure every time?
Thanks in advance for any help!
0 Comments
Answers (1)
John BG
on 28 Jul 2016
try the following
printdlg
you should see an empty figure frame, and after that your system should show the printer dialog for you to go ahead with the print: choose device, configure settings, ..
do you reach the printer dialog of your local system?
John
5 Comments
John BG
on 29 Jul 2016
1.- Is it your computer? or university? or work?
2.- If yours, do you share it with others?
3.- have you recently opened the folders where MATLAB program are installed?
4.- In what folder have you installed MATLAB?
5.- Because, from what you write, it only happens in a specific situation, try reinstalling MATLAB.
6.- What R version do you have? R2012 R2015a R2015b R2016a?
5.- In any case you lose nothing by putting through a service request to MATHWORKS
you may need the serial number handy
cannot help any further on this print problem.
Regards
John BG
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!