Print command producing occasional cropped pdfs when running in non-interactive mode

2 visualizzazioni (ultimi 30 giorni)
I'm having issues running a compiled (2022a) executable in non-interactive mode on a server. If I run the script or executable when logged in, the pdfs of the plots are produced correctly. When the executable is run in non-interactive mode (hidden scheduled task, user not logged in), some but not all of the pdfs are cropped on the right hand side.
I've tried other commands (imwrite, saveas, exportgraphic) and they are cropping the same plot in the same way.
I think the issue is to do with there being no display but cannot work out how to fix it.
The plot is landscape A4, units cm, outerposition is [0 0 29.7 21] , position [2 2.5 26.7 16.5]. I've tried using bestfit but the result is the same.
I've tried reducing width of position to increase the space on the right hand side, but this didnt work either.
Any suggestions?

Risposte (1)

Divyanshu
Divyanshu il 17 Dic 2024
I think the reason for this inconsistent behavior in non-interactive mode on server is because of the renderer used by the print command.
By default, MATLAB uses different renderers based on the environment, so I think the renderer used in non-interactive mode is causing the issue.
A possible workaround that can be tried is to set the renderer input argument of print command or Renderer property for the figure.
Additionally, please go through the 'Vector Graphics File' section and the underlying note in the following documentation link.
Hope it helps!

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by