Skip to content

Commit

Permalink
added windows support to print to pdf (this should work at least from…
Browse files Browse the repository at this point in the history
… Matlab 6 on)
  • Loading branch information
DanielMiklody committed May 9, 2016
1 parent 7684215 commit 0ecb8c0
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions utils/util_printFigure.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,21 @@ function util_printFigure(file, varargin)
end

if strcmpi(opt.Format, 'PDF') || strcmpi(opt.Format, 'EPSPDF'),
if ~strncmp('eps', opt.Device, 3),
error('For output in PDF format, OPT.Device must be eps*');
end
cmd= sprintf('cd %s; epstopdf --embed %s.eps', filepath, filename);
util_unixCmd(cmd, 'could not convert EPS to PDF');
if strcmpi(opt.Format, 'PDF'),
cmd= sprintf('cd %s; rm %s.eps', filepath, filename);
util_unixCmd(cmd, 'could not remove EPS');
end
if isunix
if ~strncmp('eps', opt.Device, 3),
error('For output in PDF format, OPT.Device must be eps*');
end
cmd= sprintf('cd %s; epstopdf --embed %s.eps', filepath, filename);
util_unixCmd(cmd, 'could not convert EPS to PDF');
if strcmpi(opt.Format, 'PDF'),
cmd= sprintf('cd %s; rm %s.eps', filepath, filename);
util_unixCmd(cmd, 'could not remove EPS');
end
else
if numel(opt.PaperSize)>2
opt.PaperSize=opt.PaperSize([3 4]);
end
set(gcf, 'paperSize',opt.PaperSize);
print('-dpdf',gcf,fullName)
end
end

0 comments on commit 0ecb8c0

Please sign in to comment.