octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overriding print.m pdf default terminal choices?


From: Benjamin Lindner
Subject: Re: overriding print.m pdf default terminal choices?
Date: Mon, 24 Aug 2009 22:01:29 +0200
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

Benjamin Lindner wrote:
Ben Abbott wrote:
On Monday, August 17, 2009, at 11:27AM, "Benjamin Lindner" <address@hidden> wrote:
Hello list,

I wondered if it is possible to force print.m to use ghostscript for
printing to pdf even if gnuplot provides a pdfcairo terminal?

I ask because the last available gnuplot for win32 does not include the
patch which fixes the spurious-pages-in-pdf-output bug.
So a command as
 plot(0:0.1:10, sin(0:0.1:10), "@-"); print -dpdf test.pdf
produces a three-page pdf.

I don't know when there will be a new gnuplot release or snapshot
release but the do not happen very frequently.

So for the mingw32 binaries I'd like to have print.m to use ps->pdf via
ghostscript for the moment.

benjamin

I assume you are referring to Octave's latest sources, and that you are not running gnuplot's development sources (meaning your version of gnuplot is 4.2.x, or earlier)?

Actually I'm referring to the 3.2.x branch of octave and the latest version of gnuplot available is the 2008-11-21 4.3.0 cvs snapshot.

If so then, what you're asking for should be the default. If it is not, then the check for ghostscript may be failing.

Does the code below indicate you have ghostscript installed?

    if (~isempty (getenv ("GSC")))
      persistent ghostscript_binary = getenv ("GSC");
    else
      persistent ghostscript_binary = "gswin32c";
    endif
[status, output] = system (sprintf ("if exist \"%s\" ( exit /B 1 ) else ( exit /B 0 )", ghostscript_binary));
    have_ghostscript = (status == 0)

Ben


thanks for the hint.

I have the environment variable GSC defined as

 > ghostscript_binary = getenv("GSC")
ghostscript_binary = C:\Programs\gs\gs8.62\bin\gswin32c.exe

and naturally this executable exists.
However, have_ghostscript evaluates to false.

This is strange.
Seems the exit code is not propagated into the variable status, as

 > [s,o]=system("exit 1")
s =  127
o =

but

 > system("exit 1")
ans =  1

I need to investigate this further.


Ben, I think your code snippet above is out of date.
In both 3.2.3 and current development tip I have

elseif (ispc ())
[status, output] = system (sprintf ("if exist \"%s\" ( exit /B 1 ) else ( exit /B 0 )", ghostscript_binary));
      have_ghostscript = (status ~= 0);
endif

The fact that calling system with two outputs does not return the correct exit code on windows aside, I end up with have_ghostscript = 1. I use the 4.3.0-cvs snapshot of 2008-11-21 (from the gnuplot homepage) and built with support for the pdfcairo terminal.

The result being that print uses the pdfcairo terminal, because it is preferred over an available ghostscript.

And I'm back again at my first question: Is there an easy way to make print.m prefer the ghostscript way? Or do I need to provide a 4.3.0 version of gnuplot without the cairo terminals?

benjamin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]