bugGNU Octave - Bugs: bug #54560, Unable to send large figures to...


bug #54560: Unable to send large figures to the default printer

Submitter:  Pantxo Diribarne <pantxo>
Submitted:  Thu 23 Aug 2018 02:22:24 PM UTC
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sat 02 Mar 2019 09:30:48 PM UTC, comment #3: 

@Pantxo: I think you're right that we should change this to use an intermediate file.  The capacity of system pipes is going to vary between individual systems and cannot be relied upon.  Everyone, however, will have a filesystem that works.

Rik <rik5>
Group administrator
Wed 29 Aug 2018 12:54:27 AM UTC, comment #2: 

I don't have this problem with the example provided:

demo material 1
print -dpsc

However, I can trigger it with

demo light 9
print -dpsc

This seems like a fairly easy fix to go through a temporary file.

Rik <rik5>
Group administrator
Thu 23 Aug 2018 02:44:55 PM UTC, comment #1: 

There is a similar error here (https://stackoverflow.com/questions/31116490/error-12-closing-pdfwrite-device) and I guess the problem is the capacity of the pipe we use to send the output of ghostscript to lpr.

What about using an intermediate file and the "-r" switch for lpr?

Pantxo Diribarne <pantxo>
Group Member
Thu 23 Aug 2018 02:22:24 PM UTC, original submission:  

The simple command bellow for printing the current figure to the default printer fails on linux:

demo material 1
print -dpsc

I get the error bellow:

/usr/bin/lpr: Error - unable to queue from stdin - Connexion ré-initialisée par le correspondant.
GPL Ghostscript 9.20: ERROR: ioerror (-12) on closing ps2write device.

I changed _opengl_print_.m so that it prints the commands onscreen and here is what I observe

/usr/bin/gs -dQUIET -dNOPAUSE -dBATCH -dSAFER -dAutoRotatePages=/None -sDEVICE=ps2write -dLanguageLevel=2 -dEmbedAllFonts=true -dEPSCrop -sPAPERSIZE=letter -dFIXEDMEDIA -sOutputFile="-" /tmp/oct-x4iz82.ps - | /usr/bin/lpr -l ; rm /tmp/oct-x4iz82.ps

While when printing to a ps file here is the command:

/usr/bin/gs -dQUIET -dNOPAUSE -dBATCH -dSAFER -dAutoRotatePages=/None -sDEVICE=ps2write -dLanguageLevel=2 -dEmbedAllFonts=true -dEPSCrop -sPAPERSIZE=letter -dFIXEDMEDIA -sOutputFile="/tmp/toto.ps" /tmp/oct-O5mLnt.ps - ; rm /tmp/oct-O5mLnt.ps

The main difference, except the use of lpr, is that ghostscript writes to stdout instead of a file.

This is not a problem for small figures (e.g plot (1:10)) and the workaround is to print to ps first and then use lpr manually:

demo material 1
print -dpsc /tmp/toto.ps
system ("lpr -lr /tmp/toto.ps")

Pantxo Diribarne <pantxo>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-29 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code