Why am I unable to print to PDF format when MATLAB 6.0 or 6.1 (R12 or R12.1) is installed in a directory with a space in the name?

2 views (last 30 days)
I have installed MATLAB in a directory with a space in the name (like C:\Program Files\MATLAB). When I try to print a figure in pdf format:
print -dpdf test.pdf
I receive the following error:
??? Error using ==> print
Error using ==> C:\Program Files\MATLAB\toolbox\matlab\graphics\private\ghostscript
Problem calling GhostScript. System returned error:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This has been fixed in MATLAB 6.5 (R13).
For previous versions, you can work around the problem by changing lines 150-151 of $MATLAB\toolbox\graphics\private\ghostscript.m (where $MATLAB is the root MATLAB directory) from:
[s, r] = privdos( pj, [ 'echo quit | ' gsPath '\gs "@' rsp_file ...
'" "' pj.FileName '"' ] );
to
[s, r] = privdos( pj, [ 'echo quit | "' gsPath '\gs" "@' rsp_file ...
'" "' pj.FileName '"' ] );

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!