When using print for my gui I want it to work lige uiputfile, where the user can deside where to place the print.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mikkel Ibsen
le 13 Nov 2017
Réponse apportée : Cam Salzberger
le 13 Nov 2017
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
Réponse acceptée
Cam Salzberger
le 13 Nov 2017
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dialog Boxes dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!