octave-maintainers
[Top][All Lists]
Advanced

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

Re: fltk printing


From: Michael D Godfrey
Subject: Re: fltk printing
Date: Sat, 07 Aug 2010 12:49:55 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Thunderbird/3.1.1

On 08/07/2010 10:45 AM, Ben Abbott wrote:
It looks like the eps file isn't recognized as existing when ghostscript is called ... and still isn't recognized when unlinked.
>> 
>> Please check that the file is present by adding "dir (opts.ghostscript.source)" to __fltk_print__.m in the position indicated below.
>> 
>>  case {"ps", "ps2", "psc", "psc2", "pdf"}
>>    opts.ghostscript.source = strcat (tmpnam (), ".eps");
>>    file2unlink = opts.ghostscript.source;
>>    if (strcmp (opts.devopt, "pdf"))
>>      opts.ghostscript.device = "pdfwrite";
>>    else
>>      opts.ghostscript.device = "pswrite";
>>    endif
>>    opts.ghostscript.output = opts.name;
>>    drawnow ("eps", opts.ghostscript.source);
>>    dir (opts.ghostscript.source)
>>    if (opts.tight_flag)
>>      __tight_eps_bbox__ (opts, opts.ghostscript.source);
>>    endif
>> 
>> Now if you try "print test.pdf", does the dir() command indicate the eps file exists?
>> 
>> Ben
> 
> This is likely an important point.  I think that (system(...) returns when the call (gs)
> thinks it is done.  That is not the same as the files have actually been written.  My systems
> NFS mount from a server, so files actually showing up can be delayed.
> 
> I will try your suggestion when I can.  In any case, it will likely be a good idea to wait
> until the files generated by gs actually show up before trying to use them.
> 
> Think a bit about why, under the same conditions, print('test.pdf'),  always works.
> 
> Michael
Michael, I'm surprised the temp files are on a server? Does tmpnam() actually return a file to be opened on a server?

In either event, it does appear to be a synchronization / timing problem.

Reading through the Matlab docs, if new files are created programmatically they will not be seen by Matlab until the next command prompt. To overcome this "rehash()" should be run. I'm not familiar with what Octave does in this case, but it looks quite similar.

Explicitly updating the path looks like a better solution than using a while-loop and waiting until Octave sees the file.

Shai, Is "rehash" implicit when "drawnow ("eps", opts.name)" is called? .,, should it be?

Michael, if you'd like to test this solution, place a "rehash()" after each "drawnow(...)" in __fltk_print__.m.

Ben

p.s.  Some of this dropped off the list, so I've reconstructed the thread and cc'd the list.



Ben,

I tried inserting the line:

 dir (opts.ghostscript.source)

as you asked above, and got:

octave:1> plot(1:200)
octave:2> print test.pdf
warning: dir: nonexistent file `/tmp/oct-wJihMn.eps'
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
warning: print.m: ghostscript failed to convert output to file 'test.pdf'.
No such file or directory
warning: print.m: failed to delete temporay file, '/tmp/oct-wJihMn.eps'.
octave:3> 
octave:3> print('test.pdf');
oct-dAdvmx.eps
octave:4> 
======================================
So, if ('test.pdf')  is used the file is there, if test.pdf is used it is not!

Michael

=============================================


reply via email to

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