When using print for my gui I want it to work lige uiputfile, where the user can deside where to place the print.

1 次查看(过去 30 天)
Hey Matlab experts
I have a gui where I use the command print, to print my gui with all the information on it, into a pdf. Instead of it just printing a pdf and placing it next to where the gui is placed, then I want it to make a pop-up window like you get when using uiputfile, where the user can select where to place the pdf. How do I do that?
print(handles.output, '-dpdf', 'test1.pdf', '-r2000'); %What I originally used.
[FileName,PathName] = uiputfile('*.pdf','Save Print'); % This is what I tried 1/2
save([PathName,FileName],print(handles.output, '-dpdf', 'test1.pdf', '-r2000')); %2/2

采纳的回答

Cam Salzberger
Cam Salzberger 2017-11-13
Hello Mikkel,
The print command does not provide an output argument - it is what is writing the file to disk. The save command should only be used when trying to save a MAT file, not when trying to write a PDF to disk.
What you can do instead is simply provide the full-path filename as the filename input argument to the print command:
[FileName,PathName] = uiputfile('*.pdf','Save Print');
print(handles.output, '-dpdf', fullfile(PathName, FileName), '-r2000')
Also, -r2000 is likely not necessary, as the PDF should be printed in vector format. Typically you would specify PaperPosition and/or PaperSize (or other paper properties) if you were concerned about the size on the PDF.
-Cam

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by