Print command producing occasional cropped pdfs when running in non-interactive mode
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2024-12-10
I have heard of similar problems. Unfortunately, I do not recall the work-around.
回答(1 个)
Divyanshu
2024-12-17
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!