Error when using print: Java exception occurred: java.lang.​IllegalSta​teExceptio​n: Graphics state stack should be empty at this point

When running a matlab script that uses the print function, I receive the following error:
Error using print (line 82)
There was a problem while generating the output: Java exception occurred:
java.lang.IllegalStateException: Graphics state stack should be empty at this point
at org.apache.xmlgraphics.ps.PSGenerator.resetGraphicsState(Unknown Source)
at org.apache.xmlgraphics.ps.PSGenerator.showPage(Unknown Source)
at org.apache.xmlgraphics.java2d.ps.PSDocumentGraphics2D.writePageTrailer(Unknown Source)
at org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D.closePage(Unknown Source)
at org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D.finish(Unknown Source)
at com.mathworks.hg.print.FOPPSVectorStrategy.endJob(FOPPSVectorStrategy.java:212)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:239)
Error in save_figs_to_pdf (line 38)
print(handle,'-dpsc2', tmpfile_ps, '-append', '-fillpage');
end
Any idea on the cause or how to fix it? The script continues to work on the computer it was written on, but doesn't seem to work on the several others tried. Is there some setting in MATLAB or the computers that could be adjusted to make this work?

1 Comment

Without complete reproduction steps, it would be hard to tell. You should contact Mathworks support about this.

Sign in to comment.

Answers (0)

Asked:

on 11 Dec 2017

Commented:

on 27 Dec 2017

Community Treasure Hunt

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

Start Hunting!