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

1 visualizzazione (ultimi 30 giorni)
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
  1 Commento
Mikkel Ibsen
Mikkel Ibsen il 13 Nov 2017
The only thing I can find is the command:
movefile
But that isnt good coding, but more the lack of it and trying to solve a problem you dont understand.

Accedi per commentare.

Risposta accettata

Cam Salzberger
Cam Salzberger il 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

Più risposte (0)

Categorie

Scopri di più su Dialog Boxes in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by