saving graphic as pdf file not working "out of the box"

8 visualizaciones (últimos 30 días)
James McDaniel
James McDaniel el 26 de Sept. de 2025
Comentada: James McDaniel el 27 de Sept. de 2025
The following code has produced a good output file since pdf was invented. I never had a problem. But the latest version has problems with THE MOST BASIC saving of a figure file.
Here is a MRE:
plot(1:10)
print -dpdf test.pdf
I get this warning:
Warning: The figure is too large for the page and will be cut off. Resize the figure, adjust the output size by setting the figure's
PaperPosition property, use the 'print' command with either the '-bestfit' or '-fillpage' options, or use the 'Best fit' or 'Fill page' options
on the 'Print Preview' window.
> In validate (line 167)
In
print (line 67)
In
test (line 3)
The resulting file is of course a highly clipped verion of the plot I wanted. Please help, this seems like a really basic malfunction of this release. Please do not tell me that I have to custom size each figure until the print command is happy with the size. That would be a lot of iteration on each figure and I make many figures per day.
  3 comentarios
DGM
DGM el 27 de Sept. de 2025
Things are slow/dead on the weekend. I'd chime in, but the newest version I run is R2019b. I'm out of the loop.
That said, have you tried using exportgraphics() instead of just using print()? Again, I'm in R2019b, so I can't mess with that either.
There's this current bug in PDF export, but it doesn't appear to be related. There seem to be perennial Mac-related graphics issues that are also foreign to me.

Iniciar sesión para comentar.

Respuestas (1)

Anton Kogios
Anton Kogios el 27 de Sept. de 2025
All of these options work fine for me with no warnings/errors on R2025b using Windows 10:
plot(1:10)
print -dpdf test.pdf
saveas(gcf,'test.pdf')
exportgraphics(gcf,'test.pdf') % cropped

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by