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

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

I have heard of similar problems. Unfortunately, I do not recall the work-around.

댓글을 달려면 로그인하십시오.

답변 (1개)

Divyanshu
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!

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2022a

질문:

2024년 12월 10일

답변:

2024년 12월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by