Print command producing occasional cropped pdfs when running in non-interactive mode
2 views (last 30 days)
Show older comments
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?
1 Comment
Walter Roberson
on 10 Dec 2024
I have heard of similar problems. Unfortunately, I do not recall the work-around.
Answers (1)
Divyanshu
on 17 Dec 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!
0 Comments
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!