Thread Subject: [Help] Printing problem in Mac OSX Leopard

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 29 Oct, 2007 21:45:04

Message: 1 of 26

Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't print
out the figure I created. I got this error message:

'-----------------------------------------
??? Error using ==> graphics/private/send at 307
Error using ==> graphics/private/send at 129
Problem sending file to output device, system returned error :
lpr: The printer or class was not found.


Error in ==> printdlg>LocalInitFig at 469
  if LocalJavaPrintDlg( Data, Dlgname )

Error in ==> printdlg at 100
   Dlg=LocalInitFig(Data);

Error in ==> graphics/private/ppreview>onPrint at 906
printdlg(fig);
'-------------------------------------------

I can see the printer in the Print Window. But I can't print out the file.
Although I can save the figure as a PDF file and print it out without problem, I
still want to print the file directly under Matlab. Do I need to re-install
Matlab? Any idea to fix this problem? Thank you very much for your help.

I use Mac OSX Leopard, Matlab 2007a Student version


Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 30 Oct, 2007 12:19:15

Message: 2 of 26

Niner wrote:
> Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't print
> out the figure I created. I got this error message:
>
> '-----------------------------------------
> ??? Error using ==> graphics/private/send at 307
> Error using ==> graphics/private/send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> Error in ==> printdlg>LocalInitFig at 469
> if LocalJavaPrintDlg( Data, Dlgname )
>
> Error in ==> printdlg at 100
> Dlg=LocalInitFig(Data);
>
> Error in ==> graphics/private/ppreview>onPrint at 906
> printdlg(fig);
> '-------------------------------------------
>
> I can see the printer in the Print Window. But I can't print out the file.
> Although I can save the figure as a PDF file and print it out without problem, I
> still want to print the file directly under Matlab. Do I need to re-install
> Matlab? Any idea to fix this problem? Thank you very much for your help.
>
> I use Mac OSX Leopard, Matlab 2007a Student version
>
>

You will probably need to contact support to resolve this. It may help
if you provide the info above as well as the output from the following:
   figure;
   plot(1:10);
   print -DEBUG

Note: if you're trying to print to something other than the default
printer then change the print command to

   print -DEBUG -P<printername>

where <printername> would be replaced by whatever name is assigned to
that printer.

The printcap entry for that printer may also be of use...

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 30 Oct, 2007 19:04:15

Message: 3 of 26

Hi Richard,

  Thank you very much for your comment. I may not address my question
clearly. My problem is about "Print" from the menu bar. When I create a
figure, I choose File -> Print Preview... from menu bar. Then I center the
figure, or stretch it to fill the page. Then I click the "Print" button. The error
message appears at this moment. It doesn't print out the figure. Same
condition happened when I click on the "Printer" icon on the tool bar.
However, I can print the figure using command "print" in the command
window. Following is an example of "print -DEBUG".

'------------------------------------
Debugging in PRINT, PrintJob object is:

pj =

                Handles: {[7]}
                 Driver: 'ps2'
               FileName: '/tmp/tp480322.ps'
             PageNumber: 0
                 Active: 0
                 Return: 0
             AllFigures: [7x1 double]
            AllPointers: {7x1 cell}
            PrinterName: ''
          SimWindowName: ''
               Renderer: ''
         rendererOption: 0
            PrintOutput: 1
                Verbose: 0
            Orientation: ''
                 hgdata: []
             PaperUnits: ''
                PrintUI: 1
             nouiOption: 0
                 UIData: []
                    DPI: -1
              DriverExt: 'ps'
            DriverClass: 'PS'
           DriverExport: 0
            DriverColor: 0
         DriverColorSet: 0
            GhostDriver: ''
              GhostName: ''
             GhostImage: 0
            GhostExtent: []
       GhostTranslation: []
       PostScriptAppend: 0
       PostScriptLatin1: 1
         PostScriptCMYK: 0
    PostScriptTightBBox: 1
      PostScriptPreview: 0
            TiffPreview: 1
             TiledPrint: 0
               FromPage: 1
                 ToPage: 9999
             FramePrint: 0
               PrintCmd: 'lpr -r'
          DefaultDevice: '-dps2'
                  Error: 0
              DebugMode: 1
              Validated: 1
          XTerminalMode: 0

Printing handle: 7
Passing input args to hardcopy: '/tmp/tp480322.ps' '-dps2'
PRINT debugging: print command = 'lpr -r "/tmp/tp480322.ps"'.
'-------------------------------------------------

So, it is confused to me that why command "print" works but not the "print"
button. I prefer to use the "Print Preview..." and "Print" button from the figure
window in case I want to adjust the figure position on the paper. This
condition didn't happen in Mac OSX Tiger.

Any idea about this problem? Any comment is appreciated.


Oh, one more question. When I use command "print", the data is sent to the
printer, but the printer doesn't print it out right away. The data receiving light
is flashing on the printer panel, and I have to stop by the printer and press
the print button to let the figure print out. If I don't, the figure will never be
printed. This is Weird. I didn't have this condition for older Matlab version.
This weird behavior happens both on Mac OXS Tiger and Leopard. Any idea ??


 I use Mac OSX Leopard, Matlab 2007a Student version.

Niner

 


Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fg77g3$6jo$1@fred.mathworks.com>...
> Niner wrote:
> > Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't
print
> > out the figure I created. I got this error message:
> >
> > '-----------------------------------------
> > ??? Error using ==> graphics/private/send at 307
> > Error using ==> graphics/private/send at 129
> > Problem sending file to output device, system returned error :
> > lpr: The printer or class was not found.
> >
> >
> > Error in ==> printdlg>LocalInitFig at 469
> > if LocalJavaPrintDlg( Data, Dlgname )
> >
> > Error in ==> printdlg at 100
> > Dlg=LocalInitFig(Data);
> >
> > Error in ==> graphics/private/ppreview>onPrint at 906
> > printdlg(fig);
> > '-------------------------------------------
> >
> > I can see the printer in the Print Window. But I can't print out the file.
> > Although I can save the figure as a PDF file and print it out without
problem, I
> > still want to print the file directly under Matlab. Do I need to re-install
> > Matlab? Any idea to fix this problem? Thank you very much for your help.
> >
> > I use Mac OSX Leopard, Matlab 2007a Student version
> >
> >
>
> You will probably need to contact support to resolve this. It may help
> if you provide the info above as well as the output from the following:
> figure;
> plot(1:10);
> print -DEBUG
>
> Note: if you're trying to print to something other than the default
> printer then change the print command to
>
> print -DEBUG -P<printername>
>
> where <printername> would be replaced by whatever name is assigned to
> that printer.
>
> The printcap entry for that printer may also be of use...
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 30 Oct, 2007 19:39:44

Message: 4 of 26

Niner wrote:
> Hi Richard,
>
> Thank you very much for your comment. I may not address my question
> clearly. My problem is about "Print" from the menu bar. When I create a
> figure, I choose File -> Print Preview... from menu bar. Then I center the
> figure, or stretch it to fill the page. Then I click the "Print" button. The error
> message appears at this moment. It doesn't print out the figure. Same
> condition happened when I click on the "Printer" icon on the tool bar.
> However, I can print the figure using command "print" in the command
> window. Following is an example of "print -DEBUG".
>
> '------------------------------------
> Debugging in PRINT, PrintJob object is:
>
> pj =
>
> Handles: {[7]}
> Driver: 'ps2'
> FileName: '/tmp/tp480322.ps'
> PageNumber: 0
> Active: 0
> Return: 0
> AllFigures: [7x1 double]
> AllPointers: {7x1 cell}
> PrinterName: ''
> SimWindowName: ''
> Renderer: ''
> rendererOption: 0
> PrintOutput: 1
> Verbose: 0
> Orientation: ''
> hgdata: []
> PaperUnits: ''
> PrintUI: 1
> nouiOption: 0
> UIData: []
> DPI: -1
> DriverExt: 'ps'
> DriverClass: 'PS'
> DriverExport: 0
> DriverColor: 0
> DriverColorSet: 0
> GhostDriver: ''
> GhostName: ''
> GhostImage: 0
> GhostExtent: []
> GhostTranslation: []
> PostScriptAppend: 0
> PostScriptLatin1: 1
> PostScriptCMYK: 0
> PostScriptTightBBox: 1
> PostScriptPreview: 0
> TiffPreview: 1
> TiledPrint: 0
> FromPage: 1
> ToPage: 9999
> FramePrint: 0
> PrintCmd: 'lpr -r'
> DefaultDevice: '-dps2'
> Error: 0
> DebugMode: 1
> Validated: 1
> XTerminalMode: 0
>
> Printing handle: 7
> Passing input args to hardcopy: '/tmp/tp480322.ps' '-dps2'
> PRINT debugging: print command = 'lpr -r "/tmp/tp480322.ps"'.
> '-------------------------------------------------
>
> So, it is confused to me that why command "print" works but not the "print"
> button. I prefer to use the "Print Preview..." and "Print" button from the figure
> window in case I want to adjust the figure position on the paper. This
> condition didn't happen in Mac OSX Tiger.
>
> Any idea about this problem? Any comment is appreciated.
>
>
> Oh, one more question. When I use command "print", the data is sent to the
> printer, but the printer doesn't print it out right away. The data receiving light
> is flashing on the printer panel, and I have to stop by the printer and press
> the print button to let the figure print out. If I don't, the figure will never be
> printed. This is Weird. I didn't have this condition for older Matlab version.
> This weird behavior happens both on Mac OXS Tiger and Leopard. Any idea ??
>
>
> I use Mac OSX Leopard, Matlab 2007a Student version.
>
> Niner
>
>
>
>
> Richard Quist <rquist_nospam@mathworks.com> wrote in message
> <fg77g3$6jo$1@fred.mathworks.com>...
>> Niner wrote:
>>> Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't
> print
>>> out the figure I created. I got this error message:
>>>
>>> '-----------------------------------------
>>> ??? Error using ==> graphics/private/send at 307
>>> Error using ==> graphics/private/send at 129
>>> Problem sending file to output device, system returned error :
>>> lpr: The printer or class was not found.
>>>
>>>
>>> Error in ==> printdlg>LocalInitFig at 469
>>> if LocalJavaPrintDlg( Data, Dlgname )
>>>
>>> Error in ==> printdlg at 100
>>> Dlg=LocalInitFig(Data);
>>>
>>> Error in ==> graphics/private/ppreview>onPrint at 906
>>> printdlg(fig);
>>> '-------------------------------------------
>>>
>>> I can see the printer in the Print Window. But I can't print out the file.
>>> Although I can save the figure as a PDF file and print it out without
> problem, I
>>> still want to print the file directly under Matlab. Do I need to re-install
>>> Matlab? Any idea to fix this problem? Thank you very much for your help.
>>>
>>> I use Mac OSX Leopard, Matlab 2007a Student version
>>>
>>>
>> You will probably need to contact support to resolve this. It may help
>> if you provide the info above as well as the output from the following:
>> figure;
>> plot(1:10);
>> print -DEBUG
>>
>> Note: if you're trying to print to something other than the default
>> printer then change the print command to
>>
>> print -DEBUG -P<printername>
>>
>> where <printername> would be replaced by whatever name is assigned to
>> that printer.
>>
>> The printcap entry for that printer may also be of use...
>>
>> --
>>
>> Richard Quist
>> Software Developer
>> The MathWorks, Inc.
>
>

You might want to verify that the name of the printer in the MATLAB
print dialog box agrees with the name of the printer as it is defined to
  your system - including capitalization/case of the characters.

The print toolbar button, the print dialog box, and print preview all
use MATLAB's print command (the same one you get when you type
print from the command line) - the GUIs simply set additional
parameters and/or figure properties before calling the print command.
If you're adventurous you can set a breakpoint in MATLAB's print command
with this command and investigate. To set the breakpoint type:
    dbstop in print
then print your figure from the dialog box. When the breakpoint is hit
display the parameters passed to print (simply enter varargin at the
MATLAB command line). This will let you see what the GUI is sending
(which may help identify the problem). To clear the breakpoint you can
enter the command:
   dbclear in print

I'm not sure at all why the command line print requires you to press the
print key on the printer... Since you have a postscript printer you can
try printing from MATLAB to a file and then sending that file to the
printer with the lpr command to see if that works (note the leading '!'
before the lpr command)
   print -dpsc test.ps
   !lpr test.ps
You can try the same lpr command from a shell prompt to see if it
behaves differently outside of MATLAB


--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 1 Nov, 2007 22:17:07

Message: 5 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fg81a0$ijr$1@fred.mathworks.com>...
> Niner wrote:
> > Hi Richard,
> >
> > Thank you very much for your comment. I may not address my question
> > clearly. My problem is about "Print" from the menu bar. When I create a
> > figure, I choose File -> Print Preview... from menu bar. Then I center the
> > figure, or stretch it to fill the page. Then I click the "Print" button. The
error
> > message appears at this moment. It doesn't print out the figure. Same
> > condition happened when I click on the "Printer" icon on the tool bar.
> > However, I can print the figure using command "print" in the command
> > window. Following is an example of "print -DEBUG".
> >
> > '------------------------------------
> > Debugging in PRINT, PrintJob object is:
> >
> > pj =
> >
> > Handles: {[7]}
> > Driver: 'ps2'
> > FileName: '/tmp/tp480322.ps'
> > PageNumber: 0
> > Active: 0
> > Return: 0
> > AllFigures: [7x1 double]
> > AllPointers: {7x1 cell}
> > PrinterName: ''
> > SimWindowName: ''
> > Renderer: ''
> > rendererOption: 0
> > PrintOutput: 1
> > Verbose: 0
> > Orientation: ''
> > hgdata: []
> > PaperUnits: ''
> > PrintUI: 1
> > nouiOption: 0
> > UIData: []
> > DPI: -1
> > DriverExt: 'ps'
> > DriverClass: 'PS'
> > DriverExport: 0
> > DriverColor: 0
> > DriverColorSet: 0
> > GhostDriver: ''
> > GhostName: ''
> > GhostImage: 0
> > GhostExtent: []
> > GhostTranslation: []
> > PostScriptAppend: 0
> > PostScriptLatin1: 1
> > PostScriptCMYK: 0
> > PostScriptTightBBox: 1
> > PostScriptPreview: 0
> > TiffPreview: 1
> > TiledPrint: 0
> > FromPage: 1
> > ToPage: 9999
> > FramePrint: 0
> > PrintCmd: 'lpr -r'
> > DefaultDevice: '-dps2'
> > Error: 0
> > DebugMode: 1
> > Validated: 1
> > XTerminalMode: 0
> >
> > Printing handle: 7
> > Passing input args to hardcopy: '/tmp/tp480322.ps' '-dps2'
> > PRINT debugging: print command = 'lpr -r "/tmp/tp480322.ps"'.
> > '-------------------------------------------------
> >
> > So, it is confused to me that why command "print" works but not the
"print"
> > button. I prefer to use the "Print Preview..." and "Print" button from the
figure
> > window in case I want to adjust the figure position on the paper. This
> > condition didn't happen in Mac OSX Tiger.
> >
> > Any idea about this problem? Any comment is appreciated.
> >
> >
> > Oh, one more question. When I use command "print", the data is sent to
the
> > printer, but the printer doesn't print it out right away. The data receiving
light
> > is flashing on the printer panel, and I have to stop by the printer and
press
> > the print button to let the figure print out. If I don't, the figure will never
be
> > printed. This is Weird. I didn't have this condition for older Matlab
version.
> > This weird behavior happens both on Mac OXS Tiger and Leopard. Any
idea ??
> >
> >
> > I use Mac OSX Leopard, Matlab 2007a Student version.
> >
> > Niner
> >
> >
> >
> >
> > Richard Quist <rquist_nospam@mathworks.com> wrote in message
> > <fg77g3$6jo$1@fred.mathworks.com>...
> >> Niner wrote:
> >>> Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab
can't
> > print
> >>> out the figure I created. I got this error message:
> >>>
> >>> '-----------------------------------------
> >>> ??? Error using ==> graphics/private/send at 307
> >>> Error using ==> graphics/private/send at 129
> >>> Problem sending file to output device, system returned error :
> >>> lpr: The printer or class was not found.
> >>>
> >>>
> >>> Error in ==> printdlg>LocalInitFig at 469
> >>> if LocalJavaPrintDlg( Data, Dlgname )
> >>>
> >>> Error in ==> printdlg at 100
> >>> Dlg=LocalInitFig(Data);
> >>>
> >>> Error in ==> graphics/private/ppreview>onPrint at 906
> >>> printdlg(fig);
> >>> '-------------------------------------------
> >>>
> >>> I can see the printer in the Print Window. But I can't print out the file.
> >>> Although I can save the figure as a PDF file and print it out without
> > problem, I
> >>> still want to print the file directly under Matlab. Do I need to re-
install
> >>> Matlab? Any idea to fix this problem? Thank you very much for your
help.
> >>>
> >>> I use Mac OSX Leopard, Matlab 2007a Student version
> >>>
> >>>
> >> You will probably need to contact support to resolve this. It may help
> >> if you provide the info above as well as the output from the following:
> >> figure;
> >> plot(1:10);
> >> print -DEBUG
> >>
> >> Note: if you're trying to print to something other than the default
> >> printer then change the print command to
> >>
> >> print -DEBUG -P<printername>
> >>
> >> where <printername> would be replaced by whatever name is assigned
to
> >> that printer.
> >>
> >> The printcap entry for that printer may also be of use...
> >>
> >> --
> >>
> >> Richard Quist
> >> Software Developer
> >> The MathWorks, Inc.
> >
> >
>
> You might want to verify that the name of the printer in the MATLAB
> print dialog box agrees with the name of the printer as it is defined to
> your system - including capitalization/case of the characters.
>
> The print toolbar button, the print dialog box, and print preview all
> use MATLAB's print command (the same one you get when you type
> print from the command line) - the GUIs simply set additional
> parameters and/or figure properties before calling the print command.
> If you're adventurous you can set a breakpoint in MATLAB's print command
> with this command and investigate. To set the breakpoint type:
> dbstop in print
> then print your figure from the dialog box. When the breakpoint is hit
> display the parameters passed to print (simply enter varargin at the
> MATLAB command line). This will let you see what the GUI is sending
> (which may help identify the problem). To clear the breakpoint you can
> enter the command:
> dbclear in print
>
> I'm not sure at all why the command line print requires you to press the
> print key on the printer... Since you have a postscript printer you can
> try printing from MATLAB to a file and then sending that file to the
> printer with the lpr command to see if that works (note the leading '!'
> before the lpr command)
> print -dpsc test.ps
> !lpr test.ps
> You can try the same lpr command from a shell prompt to see if it
> behaves differently outside of MATLAB
>
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.

Hi, Richard,

  Thanks a lot for the comment. I checked the printer name and was sure the
name is the same in both Matlab and Mac. The printer is a network printer,
which requires an IP address to connect to. Both Matlab and Mac use the
same IP address, and I only connect to one printer. I don't think Matlab could
connect to other printers.

  I tried to use breakpoint in print. I found 'varargin' has two cells.

varargin =

    [7] '-P128.95.xxx.xxx'

I don't understand the meaning of [7], but I know the second cell is the IP
address of printer. The breakpoint stopped Matlab in print.m file. When I
clicked 'Run' button from the tool bar, the error message appeared.

'-------------------------------------------
??? Error using ==> graphics/private/send at 307
Error using ==> graphics/private/send at 129
Problem sending file to output device, system returned error :
lpr: The printer or class was not found.


Error in ==> printdlg>LocalInitFig at 469
  if LocalJavaPrintDlg( Data, Dlgname )

Error in ==> printdlg at 100
   Dlg=LocalInitFig(Data);

Error in ==> graphics/private/ppreview>onPrint at 906
printdlg(fig);
'-------------------------------------------------

This condition occurred when I used 'Print Preview' window, same condition
as I mentioned before.

I also tested the 'print as ps file' function. It worked find and I can print out
the *.ps file from command line. I can print the *.ps file from Mac's shell too.
The only thing that didn't change was I still had to press the print button on
printer to print out the figure.

I noticed that the changes I made to the figure under 'Print Preview' window
was saved after I closes the 'Print Preview' window. So I can simply type 'print'
in command line to print out the modified figure. Although this is OK to me, I
still want to print the figure just by clicking the Print button.


Any idea about this problem? I really appreciate your comment. Thank you.



Niner




Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 2 Nov, 2007 12:13:53

Message: 6 of 26

Niner wrote:
> Richard Quist <rquist_nospam@mathworks.com> wrote in message
> <fg81a0$ijr$1@fred.mathworks.com>...
>> Niner wrote:
>>> Hi Richard,
>>>
>>> Thank you very much for your comment. I may not address my question
>>> clearly. My problem is about "Print" from the menu bar. When I create a
>>> figure, I choose File -> Print Preview... from menu bar. Then I center the
>>> figure, or stretch it to fill the page. Then I click the "Print" button. The
> error
>>> message appears at this moment. It doesn't print out the figure. Same
>>> condition happened when I click on the "Printer" icon on the tool bar.
>>> However, I can print the figure using command "print" in the command
>>> window. Following is an example of "print -DEBUG".
>>>
>>> '------------------------------------
>>> Debugging in PRINT, PrintJob object is:
>>>
>>> pj =
>>>
>>> Handles: {[7]}
>>> Driver: 'ps2'
>>> FileName: '/tmp/tp480322.ps'
>>> PageNumber: 0
>>> Active: 0
>>> Return: 0
>>> AllFigures: [7x1 double]
>>> AllPointers: {7x1 cell}
>>> PrinterName: ''
>>> SimWindowName: ''
>>> Renderer: ''
>>> rendererOption: 0
>>> PrintOutput: 1
>>> Verbose: 0
>>> Orientation: ''
>>> hgdata: []
>>> PaperUnits: ''
>>> PrintUI: 1
>>> nouiOption: 0
>>> UIData: []
>>> DPI: -1
>>> DriverExt: 'ps'
>>> DriverClass: 'PS'
>>> DriverExport: 0
>>> DriverColor: 0
>>> DriverColorSet: 0
>>> GhostDriver: ''
>>> GhostName: ''
>>> GhostImage: 0
>>> GhostExtent: []
>>> GhostTranslation: []
>>> PostScriptAppend: 0
>>> PostScriptLatin1: 1
>>> PostScriptCMYK: 0
>>> PostScriptTightBBox: 1
>>> PostScriptPreview: 0
>>> TiffPreview: 1
>>> TiledPrint: 0
>>> FromPage: 1
>>> ToPage: 9999
>>> FramePrint: 0
>>> PrintCmd: 'lpr -r'
>>> DefaultDevice: '-dps2'
>>> Error: 0
>>> DebugMode: 1
>>> Validated: 1
>>> XTerminalMode: 0
>>>
>>> Printing handle: 7
>>> Passing input args to hardcopy: '/tmp/tp480322.ps' '-dps2'
>>> PRINT debugging: print command = 'lpr -r "/tmp/tp480322.ps"'.
>>> '-------------------------------------------------
>>>
>>> So, it is confused to me that why command "print" works but not the
> "print"
>>> button. I prefer to use the "Print Preview..." and "Print" button from the
> figure
>>> window in case I want to adjust the figure position on the paper. This
>>> condition didn't happen in Mac OSX Tiger.
>>>
>>> Any idea about this problem? Any comment is appreciated.
>>>
>>>
>>> Oh, one more question. When I use command "print", the data is sent to
> the
>>> printer, but the printer doesn't print it out right away. The data receiving
> light
>>> is flashing on the printer panel, and I have to stop by the printer and
> press
>>> the print button to let the figure print out. If I don't, the figure will never
> be
>>> printed. This is Weird. I didn't have this condition for older Matlab
> version.
>>> This weird behavior happens both on Mac OXS Tiger and Leopard. Any
> idea ??
>>>
>>> I use Mac OSX Leopard, Matlab 2007a Student version.
>>>
>>> Niner
>>>
>>>
>>>
>>>
>>> Richard Quist <rquist_nospam@mathworks.com> wrote in message
>>> <fg77g3$6jo$1@fred.mathworks.com>...
>>>> Niner wrote:
>>>>> Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab
> can't
>>> print
>>>>> out the figure I created. I got this error message:
>>>>>
>>>>> '-----------------------------------------
>>>>> ??? Error using ==> graphics/private/send at 307
>>>>> Error using ==> graphics/private/send at 129
>>>>> Problem sending file to output device, system returned error :
>>>>> lpr: The printer or class was not found.
>>>>>
>>>>>
>>>>> Error in ==> printdlg>LocalInitFig at 469
>>>>> if LocalJavaPrintDlg( Data, Dlgname )
>>>>>
>>>>> Error in ==> printdlg at 100
>>>>> Dlg=LocalInitFig(Data);
>>>>>
>>>>> Error in ==> graphics/private/ppreview>onPrint at 906
>>>>> printdlg(fig);
>>>>> '-------------------------------------------
>>>>>
>>>>> I can see the printer in the Print Window. But I can't print out the file.
>>>>> Although I can save the figure as a PDF file and print it out without
>>> problem, I
>>>>> still want to print the file directly under Matlab. Do I need to re-
> install
>>>>> Matlab? Any idea to fix this problem? Thank you very much for your
> help.
>>>>> I use Mac OSX Leopard, Matlab 2007a Student version
>>>>>
>>>>>
>>>> You will probably need to contact support to resolve this. It may help
>>>> if you provide the info above as well as the output from the following:
>>>> figure;
>>>> plot(1:10);
>>>> print -DEBUG
>>>>
>>>> Note: if you're trying to print to something other than the default
>>>> printer then change the print command to
>>>>
>>>> print -DEBUG -P<printername>
>>>>
>>>> where <printername> would be replaced by whatever name is assigned
> to
>>>> that printer.
>>>>
>>>> The printcap entry for that printer may also be of use...
>>>>
>>>> --
>>>>
>>>> Richard Quist
>>>> Software Developer
>>>> The MathWorks, Inc.
>>>
>> You might want to verify that the name of the printer in the MATLAB
>> print dialog box agrees with the name of the printer as it is defined to
>> your system - including capitalization/case of the characters.
>>
>> The print toolbar button, the print dialog box, and print preview all
>> use MATLAB's print command (the same one you get when you type
>> print from the command line) - the GUIs simply set additional
>> parameters and/or figure properties before calling the print command.
>> If you're adventurous you can set a breakpoint in MATLAB's print command
>> with this command and investigate. To set the breakpoint type:
>> dbstop in print
>> then print your figure from the dialog box. When the breakpoint is hit
>> display the parameters passed to print (simply enter varargin at the
>> MATLAB command line). This will let you see what the GUI is sending
>> (which may help identify the problem). To clear the breakpoint you can
>> enter the command:
>> dbclear in print
>>
>> I'm not sure at all why the command line print requires you to press the
>> print key on the printer... Since you have a postscript printer you can
>> try printing from MATLAB to a file and then sending that file to the
>> printer with the lpr command to see if that works (note the leading '!'
>> before the lpr command)
>> print -dpsc test.ps
>> !lpr test.ps
>> You can try the same lpr command from a shell prompt to see if it
>> behaves differently outside of MATLAB
>>
>>
>> --
>>
>> Richard Quist
>> Software Developer
>> The MathWorks, Inc.
>
> Hi, Richard,
>
> Thanks a lot for the comment. I checked the printer name and was sure the
> name is the same in both Matlab and Mac. The printer is a network printer,
> which requires an IP address to connect to. Both Matlab and Mac use the
> same IP address, and I only connect to one printer. I don't think Matlab could
> connect to other printers.
>
> I tried to use breakpoint in print. I found 'varargin' has two cells.
>
> varargin =
>
> [7] '-P128.95.xxx.xxx'
>
> I don't understand the meaning of [7], but I know the second cell is the IP
> address of printer. The breakpoint stopped Matlab in print.m file. When I
> clicked 'Run' button from the tool bar, the error message appeared.
>
> '-------------------------------------------
> ??? Error using ==> graphics/private/send at 307
> Error using ==> graphics/private/send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> Error in ==> printdlg>LocalInitFig at 469
> if LocalJavaPrintDlg( Data, Dlgname )
>
> Error in ==> printdlg at 100
> Dlg=LocalInitFig(Data);
>
> Error in ==> graphics/private/ppreview>onPrint at 906
> printdlg(fig);
> '-------------------------------------------------
>
> This condition occurred when I used 'Print Preview' window, same condition
> as I mentioned before.
>
> I also tested the 'print as ps file' function. It worked find and I can print out
> the *.ps file from command line. I can print the *.ps file from Mac's shell too.
> The only thing that didn't change was I still had to press the print button on
> printer to print out the figure.
>
> I noticed that the changes I made to the figure under 'Print Preview' window
> was saved after I closes the 'Print Preview' window. So I can simply type 'print'
> in command line to print out the modified figure. Although this is OK to me, I
> still want to print the figure just by clicking the Print button.
>
>
> Any idea about this problem? I really appreciate your comment. Thank you.
>
>
>
> Niner
>
>
The [7] you see in the debug output is the handle of the figure being
printed... it's either the figure you created or a temporary copy
created by print preview.

I think the issue is that the operating system lpr command (used by
MATLAB to send the file to your printer) doesn't recognize the IP
address as a printer. I would expect that if you print to a ps file
(test.ps) and then from a system prompt (or using MATLAB's "bang"
command) if you executed the following you would see the same/similar
error.
 From MATLAB: !lpr -P128.95.xxx.xxx test.ps
 From a shell prompt: lpr -P128.95.xxx.xxx test.ps
(filling in the complete ip address, of course)

I think what you need to do is add the printer to your Mac, specifying
that it is an IP printer and entering both the IP address as well as
giving it a queue name, such as "networkprinter". Once that's done,
restart MATLAB and choose the queue name you specified as the printer to
print to (either from the list of printers shown in the dialog box or
with the print command's -P option

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 2 Nov, 2007 20:51:46

Message: 7 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fgf4a1$s68$1@fred.mathworks.com>...
> >
> > Hi, Richard,
> >
> > Thanks a lot for the comment. I checked the printer name and was sure
the
> > name is the same in both Matlab and Mac. The printer is a network
printer,
> > which requires an IP address to connect to. Both Matlab and Mac use the
> > same IP address, and I only connect to one printer. I don't think Matlab
could
> > connect to other printers.
> >
> > I tried to use breakpoint in print. I found 'varargin' has two cells.
> >
> > varargin =
> >
> > [7] '-P128.95.xxx.xxx'
> >
> > I don't understand the meaning of [7], but I know the second cell is the
IP
> > address of printer. The breakpoint stopped Matlab in print.m file. When I
> > clicked 'Run' button from the tool bar, the error message appeared.
> >
> > '-------------------------------------------
> > ??? Error using ==> graphics/private/send at 307
> > Error using ==> graphics/private/send at 129
> > Problem sending file to output device, system returned error :
> > lpr: The printer or class was not found.
> >
> >
> > Error in ==> printdlg>LocalInitFig at 469
> > if LocalJavaPrintDlg( Data, Dlgname )
> >
> > Error in ==> printdlg at 100
> > Dlg=LocalInitFig(Data);
> >
> > Error in ==> graphics/private/ppreview>onPrint at 906
> > printdlg(fig);
> > '-------------------------------------------------
> >
> > This condition occurred when I used 'Print Preview' window, same
condition
> > as I mentioned before.
> >
> > I also tested the 'print as ps file' function. It worked find and I can print
out
> > the *.ps file from command line. I can print the *.ps file from Mac's shell
too.
> > The only thing that didn't change was I still had to press the print button
on
> > printer to print out the figure.
> >
> > I noticed that the changes I made to the figure under 'Print Preview'
window
> > was saved after I closes the 'Print Preview' window. So I can simply type
'print'
> > in command line to print out the modified figure. Although this is OK to
me, I
> > still want to print the figure just by clicking the Print button.
> >
> >
> > Any idea about this problem? I really appreciate your comment. Thank
you.
> >
> >
> >
> > Niner
> >
> >
> The [7] you see in the debug output is the handle of the figure being
> printed... it's either the figure you created or a temporary copy
> created by print preview.
>
> I think the issue is that the operating system lpr command (used by
> MATLAB to send the file to your printer) doesn't recognize the IP
> address as a printer. I would expect that if you print to a ps file
> (test.ps) and then from a system prompt (or using MATLAB's "bang"
> command) if you executed the following you would see the same/similar
> error.
> From MATLAB: !lpr -P128.95.xxx.xxx test.ps
> From a shell prompt: lpr -P128.95.xxx.xxx test.ps
> (filling in the complete ip address, of course)
>
> I think what you need to do is add the printer to your Mac, specifying
> that it is an IP printer and entering both the IP address as well as
> giving it a queue name, such as "networkprinter". Once that's done,
> restart MATLAB and choose the queue name you specified as the printer to
> print to (either from the list of printers shown in the dialog box or
> with the print command's -P option
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Hi Richard,

  Thank you very much for your response. The printer I am using has already
added to Mac' printer list. I use the System Preference --> Print & Fax to
setup the printer. Here is the info about setting the printer.

---------------------------------------------------
IP Printer
Protocol : Line Printer Daemon - LPD (this is Mac's default. The other two
options are "Internet Printing Protocol, IPP" and "HP Jetdirect - Socket")
Address : 128.95.xxx.xxx
Queue : (there's a note: "Leave blank for default queue." So I leave it blank)
Name : HP LaserJet 1320 (I name this printer.)
Location: (I leave it blank)
Print Using: HP LaserJet 1320 series (the driver for the HP printer)
---------------------------------------------------

After setting the printer, I view the general info of the printer.

-----------------------------------
Name: HP LaserJet 1320
Location: (blank)
Queue Name: HP_LaserJet_1320
Host Name: localhost
Driver Version: 4.0.0.080
URL: lpd://128.95.xxx.xxx/
----------------------------------

This works fine with the applications installed in my MBP, except Matlab.
I can see the printer "HP LaserJet 1320" in the list when I open Print Widow in
Matlab. But it got errors when I click "Print" button. As you mentioned, I can't
print the *.ps file by the command "lpr -P" under either Matlab command
window or Mac's bash shell. Why? What is the reason that the shell command
can't recognize the printer? However, if just use command "lpr", the printing
works fine, except that I have to stop by the printer and press the "Print"
button.

I had tried to restart Matlab and MBP several times, and it was no good.

I think that command "lpr" would print the file by the default printer, and this
sends the signal to Mac's default printer. In Matlab, it looks like the "print"
command tries to use "lpr -P" command, which doesn't work. This is weird to
me. Before I upgraded my Mac OSX to Leopard, the printing had no problem
in Matlab under Tiger. After upgrading, I re-set the printer and the problem
occurred. There's mystery somewhere.

Is there any way that I can reset the printer in Matlab, like delete the printer
settings? Maybe after resetting, let Matlab look for the printer again. This
may solve the problem. What do you think?

Any comment is appreciated. Thank you.




Niner



Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 5 Nov, 2007 16:04:27

Message: 8 of 26

Niner wrote:
<<snip>>


>> The [7] you see in the debug output is the handle of the figure being
>> printed... it's either the figure you created or a temporary copy
>> created by print preview.
>>
>> I think the issue is that the operating system lpr command (used by
>> MATLAB to send the file to your printer) doesn't recognize the IP
>> address as a printer. I would expect that if you print to a ps file
>> (test.ps) and then from a system prompt (or using MATLAB's "bang"
>> command) if you executed the following you would see the same/similar
>> error.
>> From MATLAB: !lpr -P128.95.xxx.xxx test.ps
>> From a shell prompt: lpr -P128.95.xxx.xxx test.ps
>> (filling in the complete ip address, of course)
>>
>> I think what you need to do is add the printer to your Mac, specifying
>> that it is an IP printer and entering both the IP address as well as
>> giving it a queue name, such as "networkprinter". Once that's done,
>> restart MATLAB and choose the queue name you specified as the printer to
>> print to (either from the list of printers shown in the dialog box or
>> with the print command's -P option
>>
>> --
>>
>> Richard Quist
>> Software Developer
>> The MathWorks, Inc.
>
>
> Hi Richard,
>
> Thank you very much for your response. The printer I am using has already
> added to Mac' printer list. I use the System Preference --> Print & Fax to
> setup the printer. Here is the info about setting the printer.
>
> ---------------------------------------------------
> IP Printer
> Protocol : Line Printer Daemon - LPD (this is Mac's default. The other two
> options are "Internet Printing Protocol, IPP" and "HP Jetdirect - Socket")
> Address : 128.95.xxx.xxx
> Queue : (there's a note: "Leave blank for default queue." So I leave it blank)
> Name : HP LaserJet 1320 (I name this printer.)
> Location: (I leave it blank)
> Print Using: HP LaserJet 1320 series (the driver for the HP printer)
> ---------------------------------------------------
>
> After setting the printer, I view the general info of the printer.
>
> -----------------------------------
> Name: HP LaserJet 1320
> Location: (blank)
> Queue Name: HP_LaserJet_1320
> Host Name: localhost
> Driver Version: 4.0.0.080
> URL: lpd://128.95.xxx.xxx/
> ----------------------------------
>
> This works fine with the applications installed in my MBP, except Matlab.
> I can see the printer "HP LaserJet 1320" in the list when I open Print Widow in
> Matlab. But it got errors when I click "Print" button. As you mentioned, I can't
> print the *.ps file by the command "lpr -P" under either Matlab command
> window or Mac's bash shell. Why? What is the reason that the shell command
> can't recognize the printer? However, if just use command "lpr", the printing
> works fine, except that I have to stop by the printer and press the "Print"
> button.
>
> I had tried to restart Matlab and MBP several times, and it was no good.
>
> I think that command "lpr" would print the file by the default printer, and this
> sends the signal to Mac's default printer. In Matlab, it looks like the "print"
> command tries to use "lpr -P" command, which doesn't work. This is weird to
> me. Before I upgraded my Mac OSX to Leopard, the printing had no problem
> in Matlab under Tiger. After upgrading, I re-set the printer and the problem
> occurred. There's mystery somewhere.
>
> Is there any way that I can reset the printer in Matlab, like delete the printer
> settings? Maybe after resetting, let Matlab look for the printer again. This
> may solve the problem. What do you think?
>
> Any comment is appreciated. Thank you.
>
>
>
>
> Niner
>
>
>

There aren't any printer-specific settings in MATLAB - we query the OS
for the information on what printers are available.

In the print preview case, we don't check whether you're selecting the
default printer (in which case the lpr command without the -P option
could be used); we always provide the -P option to explicitly tell the
OS to use the specific printer.

It looks like something has changed in your print settings during the
Leopard upgrade. Instead of returning the printer NAME ('HP LaserJet
1320') the OS is giving us the IP address. Can you post the printcap
entry for this printer? It should be in the /etc/printcap file.

As a possible workaround, one of my co-workers pointed out that adding
the -H option to the lpr command, telling lpr what server to find the
printer on, may work. Since the OS is giving you the IP address that's
the value you'd set for the -H parameter. To make this change in MATLAB
you'd need to edit the file send.m in the
<matlabroot>/toolbox/matlab/graphics/private directory.
In that file you'll find a section (starting around line 94) that looks
like this:
     if ~isempty( pj.PrinterName )
         %If user specified a printer, add it to the printing command
         if notBSD
           cmdOption = '-d';
         else
           cmdOption = '-P';
         end
         lprcmd = [ lprcmd ' "' cmdOption pj.PrinterName '"' ];
     end
Underneath the line that reads
           cmdOption = '-P';
add the following (above the end statement)
           lprcmd = [ lprcmd ' "-H' pj.PrinterName '"' ];

Note - this isn't a great solution - and it will fail for any printer
for which the OS gives you the real name instead of the IP address...but
it may be sufficient while you're working through the problem.


I also took a quick look at Apple's support site - looking specifically
for IP printer issues with Leopard and found at least one user who
suggests NOT leaving the queue name blank when setting up the printer.
For example, see:
http://discussions.apple.com/thread.jspa?messageID=5683220�
Even though you're only having issues with MATLAB printing, it may be
worth a try to set the queue name explicitly on the printer setup dialog.

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 5 Nov, 2007 18:10:47

Message: 9 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fgneub$o5v$1@fred.mathworks.com>...
> Niner wrote:
> <<snip>>
>
>
> >> The [7] you see in the debug output is the handle of the figure being
> >> printed... it's either the figure you created or a temporary copy
> >> created by print preview.
> >>
> >> I think the issue is that the operating system lpr command (used by
> >> MATLAB to send the file to your printer) doesn't recognize the IP
> >> address as a printer. I would expect that if you print to a ps file
> >> (test.ps) and then from a system prompt (or using MATLAB's "bang"
> >> command) if you executed the following you would see the
same/similar
> >> error.
> >> From MATLAB: !lpr -P128.95.xxx.xxx test.ps
> >> From a shell prompt: lpr -P128.95.xxx.xxx test.ps
> >> (filling in the complete ip address, of course)
> >>
> >> I think what you need to do is add the printer to your Mac, specifying
> >> that it is an IP printer and entering both the IP address as well as
> >> giving it a queue name, such as "networkprinter". Once that's done,
> >> restart MATLAB and choose the queue name you specified as the
printer to
> >> print to (either from the list of printers shown in the dialog box or
> >> with the print command's -P option
> >>
> >> --
> >>
> >> Richard Quist
> >> Software Developer
> >> The MathWorks, Inc.
> >
> >
> > Hi Richard,
> >
> > Thank you very much for your response. The printer I am using has
already
> > added to Mac' printer list. I use the System Preference --> Print & Fax to
> > setup the printer. Here is the info about setting the printer.
> >
> > ---------------------------------------------------
> > IP Printer
> > Protocol : Line Printer Daemon - LPD (this is Mac's default. The other two
> > options are "Internet Printing Protocol, IPP" and "HP Jetdirect - Socket")
> > Address : 128.95.xxx.xxx
> > Queue : (there's a note: "Leave blank for default queue." So I leave it
blank)
> > Name : HP LaserJet 1320 (I name this printer.)
> > Location: (I leave it blank)
> > Print Using: HP LaserJet 1320 series (the driver for the HP printer)
> > ---------------------------------------------------
> >
> > After setting the printer, I view the general info of the printer.
> >
> > -----------------------------------
> > Name: HP LaserJet 1320
> > Location: (blank)
> > Queue Name: HP_LaserJet_1320
> > Host Name: localhost
> > Driver Version: 4.0.0.080
> > URL: lpd://128.95.xxx.xxx/
> > ----------------------------------
> >
> > This works fine with the applications installed in my MBP, except Matlab.
> > I can see the printer "HP LaserJet 1320" in the list when I open Print
Widow in
> > Matlab. But it got errors when I click "Print" button. As you mentioned, I
can't
> > print the *.ps file by the command "lpr -P" under either Matlab command
> > window or Mac's bash shell. Why? What is the reason that the shell
command
> > can't recognize the printer? However, if just use command "lpr", the
printing
> > works fine, except that I have to stop by the printer and press the "Print"
> > button.
> >
> > I had tried to restart Matlab and MBP several times, and it was no good.
> >
> > I think that command "lpr" would print the file by the default printer, and
this
> > sends the signal to Mac's default printer. In Matlab, it looks like the
"print"
> > command tries to use "lpr -P" command, which doesn't work. This is
weird to
> > me. Before I upgraded my Mac OSX to Leopard, the printing had no
problem
> > in Matlab under Tiger. After upgrading, I re-set the printer and the
problem
> > occurred. There's mystery somewhere.
> >
> > Is there any way that I can reset the printer in Matlab, like delete the
printer
> > settings? Maybe after resetting, let Matlab look for the printer again. This
> > may solve the problem. What do you think?
> >
> > Any comment is appreciated. Thank you.
> >
> >
> >
> >
> > Niner
> >
> >
> >
>
> There aren't any printer-specific settings in MATLAB - we query the OS
> for the information on what printers are available.
>
> In the print preview case, we don't check whether you're selecting the
> default printer (in which case the lpr command without the -P option
> could be used); we always provide the -P option to explicitly tell the
> OS to use the specific printer.
>
> It looks like something has changed in your print settings during the
> Leopard upgrade. Instead of returning the printer NAME ('HP LaserJet
> 1320') the OS is giving us the IP address. Can you post the printcap
> entry for this printer? It should be in the /etc/printcap file.
>
> As a possible workaround, one of my co-workers pointed out that adding
> the -H option to the lpr command, telling lpr what server to find the
> printer on, may work. Since the OS is giving you the IP address that's
> the value you'd set for the -H parameter. To make this change in MATLAB
> you'd need to edit the file send.m in the
> <matlabroot>/toolbox/matlab/graphics/private directory.
> In that file you'll find a section (starting around line 94) that looks
> like this:
> if ~isempty( pj.PrinterName )
> %If user specified a printer, add it to the printing command
> if notBSD
> cmdOption = '-d';
> else
> cmdOption = '-P';
> end
> lprcmd = [ lprcmd ' "' cmdOption pj.PrinterName '"' ];
> end
> Underneath the line that reads
> cmdOption = '-P';
> add the following (above the end statement)
> lprcmd = [ lprcmd ' "-H' pj.PrinterName '"' ];
>
> Note - this isn't a great solution - and it will fail for any printer
> for which the OS gives you the real name instead of the IP address...but
> it may be sufficient while you're working through the problem.
>
>
> I also took a quick look at Apple's support site - looking specifically
> for IP printer issues with Leopard and found at least one user who
> suggests NOT leaving the queue name blank when setting up the printer.
> For example, see:
> http://discussions.apple.com/thread.jspa?
messageID=5683220�
> Even though you're only having issues with MATLAB printing, it may be
> worth a try to set the queue name explicitly on the printer setup dialog.
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Hi Richard,

   Thank you very much for you response. About the queue name problem, I
did an experiment. I set up three printers each with different printing protocol
. I gave each printer a queue name. So, we had

Name Queue Name
------ ------------
HP_IPP HP1320_IPP
HP_LPD HP1320_LPD
HP_Socket (no queue name is required)

Then I restarted my MBP, and opened Matlab. I created a simple plot, and
used both Print Preview and Print button to print out the figure. Here is the
results.

                     under Print Preview use Print button
                    --------------- ---------------
HP_IPP sent w/out error sent w/out error
HP_LPD sent w/out error sent w/out error
HP_Socket sent w/out error sent w/out error

All of the printer settings worked fine when I tried to print the figure, no
error message this time. But, the protocol HP_IPP can't finish the printing,
which had a warning message in the printing job list (can be seen when open
the Print Queue window in Mac). The other two settings worked very well.

So it tuned out that using a queue name was the solution to this problem,
and IPP protocol was not functional in my case. At the end, I delete the IPP
printer setting and use LPD printer setting.

I didn't modify the send.m file, and here is the content of printcap before I
did my experiment. (I hide the IP address)

'-----------------------------------------------
# This file was automatically generated by cupsd(8) from the
# /private/etc/cups/printers.conf file. All changes to this file
# will be lost.
_128_95_xxx_xxx-1|128.95.xxx.xxx
HP:rm=127.0.0.1:rp=_128_95_xxx_xxx-1:
'--------------------------------------------------

Just one question left. I still need to stop by the printer and press the Print
button to let the figure print out. I still have no idea about this one. I didn't
have same situation when I used Mac OSX Tiger. Is it possible to be fixed if I
re-install the Matlab? or is this the problem about X11?

Any comment is appreciated. Thank you very much for your help.


I use Mac OSX Leopard, Matlab 2007a Student version.

Niner


Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 6 Nov, 2007 14:29:28

Message: 10 of 26

Niner wrote:
> Richard Quist <rquist_nospam@mathworks.com> wrote in message
> <fgneub$o5v$1@fred.mathworks.com>...
>> Niner wrote:
>> <<snip>>
>>
>>
>>>> The [7] you see in the debug output is the handle of the figure being
>>>> printed... it's either the figure you created or a temporary copy
>>>> created by print preview.
>>>>
>>>> I think the issue is that the operating system lpr command (used by
>>>> MATLAB to send the file to your printer) doesn't recognize the IP
>>>> address as a printer. I would expect that if you print to a ps file
>>>> (test.ps) and then from a system prompt (or using MATLAB's "bang"
>>>> command) if you executed the following you would see the
> same/similar
>>>> error.
>>>> From MATLAB: !lpr -P128.95.xxx.xxx test.ps
>>>> From a shell prompt: lpr -P128.95.xxx.xxx test.ps
>>>> (filling in the complete ip address, of course)
>>>>
>>>> I think what you need to do is add the printer to your Mac, specifying
>>>> that it is an IP printer and entering both the IP address as well as
>>>> giving it a queue name, such as "networkprinter". Once that's done,
>>>> restart MATLAB and choose the queue name you specified as the
> printer to
>>>> print to (either from the list of printers shown in the dialog box or
>>>> with the print command's -P option
>>>>
>>>> --
>>>>
>>>> Richard Quist
>>>> Software Developer
>>>> The MathWorks, Inc.
>>>
>>> Hi Richard,
>>>
>>> Thank you very much for your response. The printer I am using has
> already
>>> added to Mac' printer list. I use the System Preference --> Print & Fax to
>>> setup the printer. Here is the info about setting the printer.
>>>
>>> ---------------------------------------------------
>>> IP Printer
>>> Protocol : Line Printer Daemon - LPD (this is Mac's default. The other two
>>> options are "Internet Printing Protocol, IPP" and "HP Jetdirect - Socket")
>>> Address : 128.95.xxx.xxx
>>> Queue : (there's a note: "Leave blank for default queue." So I leave it
> blank)
>>> Name : HP LaserJet 1320 (I name this printer.)
>>> Location: (I leave it blank)
>>> Print Using: HP LaserJet 1320 series (the driver for the HP printer)
>>> ---------------------------------------------------
>>>
>>> After setting the printer, I view the general info of the printer.
>>>
>>> -----------------------------------
>>> Name: HP LaserJet 1320
>>> Location: (blank)
>>> Queue Name: HP_LaserJet_1320
>>> Host Name: localhost
>>> Driver Version: 4.0.0.080
>>> URL: lpd://128.95.xxx.xxx/
>>> ----------------------------------
>>>
>>> This works fine with the applications installed in my MBP, except Matlab.
>>> I can see the printer "HP LaserJet 1320" in the list when I open Print
> Widow in
>>> Matlab. But it got errors when I click "Print" button. As you mentioned, I
> can't
>>> print the *.ps file by the command "lpr -P" under either Matlab command
>>> window or Mac's bash shell. Why? What is the reason that the shell
> command
>>> can't recognize the printer? However, if just use command "lpr", the
> printing
>>> works fine, except that I have to stop by the printer and press the "Print"
>>> button.
>>>
>>> I had tried to restart Matlab and MBP several times, and it was no good.
>>>
>>> I think that command "lpr" would print the file by the default printer, and
> this
>>> sends the signal to Mac's default printer. In Matlab, it looks like the
> "print"
>>> command tries to use "lpr -P" command, which doesn't work. This is
> weird to
>>> me. Before I upgraded my Mac OSX to Leopard, the printing had no
> problem
>>> in Matlab under Tiger. After upgrading, I re-set the printer and the
> problem
>>> occurred. There's mystery somewhere.
>>>
>>> Is there any way that I can reset the printer in Matlab, like delete the
> printer
>>> settings? Maybe after resetting, let Matlab look for the printer again. This
>>> may solve the problem. What do you think?
>>>
>>> Any comment is appreciated. Thank you.
>>>
>>>
>>>
>>>
>>> Niner
>>>
>>>
>>>
>> There aren't any printer-specific settings in MATLAB - we query the OS
>> for the information on what printers are available.
>>
>> In the print preview case, we don't check whether you're selecting the
>> default printer (in which case the lpr command without the -P option
>> could be used); we always provide the -P option to explicitly tell the
>> OS to use the specific printer.
>>
>> It looks like something has changed in your print settings during the
>> Leopard upgrade. Instead of returning the printer NAME ('HP LaserJet
>> 1320') the OS is giving us the IP address. Can you post the printcap
>> entry for this printer? It should be in the /etc/printcap file.
>>
>> As a possible workaround, one of my co-workers pointed out that adding
>> the -H option to the lpr command, telling lpr what server to find the
>> printer on, may work. Since the OS is giving you the IP address that's
>> the value you'd set for the -H parameter. To make this change in MATLAB
>> you'd need to edit the file send.m in the
>> <matlabroot>/toolbox/matlab/graphics/private directory.
>> In that file you'll find a section (starting around line 94) that looks
>> like this:
>> if ~isempty( pj.PrinterName )
>> %If user specified a printer, add it to the printing command
>> if notBSD
>> cmdOption = '-d';
>> else
>> cmdOption = '-P';
>> end
>> lprcmd = [ lprcmd ' "' cmdOption pj.PrinterName '"' ];
>> end
>> Underneath the line that reads
>> cmdOption = '-P';
>> add the following (above the end statement)
>> lprcmd = [ lprcmd ' "-H' pj.PrinterName '"' ];
>>
>> Note - this isn't a great solution - and it will fail for any printer
>> for which the OS gives you the real name instead of the IP address...but
>> it may be sufficient while you're working through the problem.
>>
>>
>> I also took a quick look at Apple's support site - looking specifically
>> for IP printer issues with Leopard and found at least one user who
>> suggests NOT leaving the queue name blank when setting up the printer.
>> For example, see:
>> http://discussions.apple.com/thread.jspa?
> messageID=5683220�
>> Even though you're only having issues with MATLAB printing, it may be
>> worth a try to set the queue name explicitly on the printer setup dialog.
>>
>> --
>>
>> Richard Quist
>> Software Developer
>> The MathWorks, Inc.
>
>
> Hi Richard,
>
> Thank you very much for you response. About the queue name problem, I
> did an experiment. I set up three printers each with different printing protocol
> . I gave each printer a queue name. So, we had
>
> Name Queue Name
> ------ ------------
> HP_IPP HP1320_IPP
> HP_LPD HP1320_LPD
> HP_Socket (no queue name is required)
>
> Then I restarted my MBP, and opened Matlab. I created a simple plot, and
> used both Print Preview and Print button to print out the figure. Here is the
> results.
>
> under Print Preview use Print button
> --------------- ---------------
> HP_IPP sent w/out error sent w/out error
> HP_LPD sent w/out error sent w/out error
> HP_Socket sent w/out error sent w/out error
>
> All of the printer settings worked fine when I tried to print the figure, no
> error message this time. But, the protocol HP_IPP can't finish the printing,
> which had a warning message in the printing job list (can be seen when open
> the Print Queue window in Mac). The other two settings worked very well.
>
> So it tuned out that using a queue name was the solution to this problem,
> and IPP protocol was not functional in my case. At the end, I delete the IPP
> printer setting and use LPD printer setting.
>
> I didn't modify the send.m file, and here is the content of printcap before I
> did my experiment. (I hide the IP address)
>
> '-----------------------------------------------
> # This file was automatically generated by cupsd(8) from the
> # /private/etc/cups/printers.conf file. All changes to this file
> # will be lost.
> _128_95_xxx_xxx-1|128.95.xxx.xxx
> HP:rm=127.0.0.1:rp=_128_95_xxx_xxx-1:
> '--------------------------------------------------
>
> Just one question left. I still need to stop by the printer and press the Print
> button to let the figure print out. I still have no idea about this one. I didn't
> have same situation when I used Mac OSX Tiger. Is it possible to be fixed if I
> re-install the Matlab? or is this the problem about X11?
>
> Any comment is appreciated. Thank you very much for your help.
>
>
> I use Mac OSX Leopard, Matlab 2007a Student version.
>
> Niner
>
>

I'm glad that setting the print queue name is working for you.

As far as having to go and press the 'print' button on the printer to
get the printout to appear, I don't think reinstalling MATLAB will help.
I suspect it's either a problem with Leopard or with the HP driver
(there seem to be quite a few printing-related issues being discussed on
the Apple Leopard forums).
--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 6 Nov, 2007 22:02:43

Message: 11 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
> >
>
> I'm glad that setting the print queue name is working for you.
>
> As far as having to go and press the 'print' button on the printer to
> get the printout to appear, I don't think reinstalling MATLAB will help.
> I suspect it's either a problem with Leopard or with the HP driver
> (there seem to be quite a few printing-related issues being discussed on
> the Apple Leopard forums).
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Hi Richard,

    Thanks a lot for your help. For the problem of pressing the print button, I
found a solution. I reset the printer in my Mac. But this time I let Mac detect
the printer type, not assigning it as HP LaserJet 1320. So I use "Generic
PostScript Printer". Then when I print the figure under Matlab, the figure is
printed without stopping by and pressing the print button. GREAT~

   Just write down my comment to follow up. Thank you.


Niner
 

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 6 Nov, 2007 22:02:49

Message: 12 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
> >
>
> I'm glad that setting the print queue name is working for you.
>
> As far as having to go and press the 'print' button on the printer to
> get the printout to appear, I don't think reinstalling MATLAB will help.
> I suspect it's either a problem with Leopard or with the HP driver
> (there seem to be quite a few printing-related issues being discussed on
> the Apple Leopard forums).
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Hi Richard,

    Thanks a lot for your help. For the problem of pressing the print button, I
found a solution. I reset the printer in my Mac. But this time I let Mac detect
the printer type, not assigning it as HP LaserJet 1320. So I use "Generic
PostScript Printer". Then when I print the figure under Matlab, the figure is
printed without stopping by and pressing the print button. GREAT~

   Just write down my comment to follow up. Thank you.


Niner
 

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 6 Nov, 2007 22:02:54

Message: 13 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
> >
>
> I'm glad that setting the print queue name is working for you.
>
> As far as having to go and press the 'print' button on the printer to
> get the printout to appear, I don't think reinstalling MATLAB will help.
> I suspect it's either a problem with Leopard or with the HP driver
> (there seem to be quite a few printing-related issues being discussed on
> the Apple Leopard forums).
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Hi Richard,

    Thanks a lot for your help. For the problem of pressing the print button, I
found a solution. I reset the printer in my Mac. But this time I let Mac detect
the printer type, not assigning it as HP LaserJet 1320. So I use "Generic
PostScript Printer". Then when I print the figure under Matlab, the figure is
printed without stopping by and pressing the print button. GREAT~

   Just write down my comment to follow up. Thank you.


Niner
 

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 6 Nov, 2007 22:03:06

Message: 14 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
> >
>
> I'm glad that setting the print queue name is working for you.
>
> As far as having to go and press the 'print' button on the printer to
> get the printout to appear, I don't think reinstalling MATLAB will help.
> I suspect it's either a problem with Leopard or with the HP driver
> (there seem to be quite a few printing-related issues being discussed on
> the Apple Leopard forums).
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.


Hi Richard,

    Thanks a lot for your help. For the problem of pressing the print button, I
found a solution. I reset the printer in my Mac. But this time I let Mac detect
the printer type, not assigning it as HP LaserJet 1320. So I use "Generic
PostScript Printer". Then when I print the figure under Matlab, the figure is
printed without stopping by and pressing the print button. GREAT~

   Just write down my comment to follow up. Thank you.


Niner
 

Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 8 Nov, 2007 13:29:35

Message: 15 of 26

"Niner " <ninerh@seed.net.tw> wrote in message
<fgqoaq$8o4$1@fred.mathworks.com>...
> Richard Quist <rquist_nospam@mathworks.com> wrote in message
> > >
> >
> > I'm glad that setting the print queue name is working
for you.
> >
> > As far as having to go and press the 'print' button on
the printer to
> > get the printout to appear, I don't think reinstalling
MATLAB will help.
> > I suspect it's either a problem with Leopard or with the
HP driver
> > (there seem to be quite a few printing-related issues
being discussed on
> > the Apple Leopard forums).
> > --
> >
> > Richard Quist
> > Software Developer
> > The MathWorks, Inc.
>
>
> Hi Richard,
>
> Thanks a lot for your help. For the problem of
pressing the print button, I
> found a solution. I reset the printer in my Mac. But this
time I let Mac detect
> the printer type, not assigning it as HP LaserJet 1320. So
I use "Generic
> PostScript Printer". Then when I print the figure under
Matlab, the figure is
> printed without stopping by and pressing the print button.
GREAT~
>
> Just write down my comment to follow up. Thank you.
>
>
> Niner
>

One more followup for others looking at this thread.

In my investigations here I also found that enabling the
creation of the printcap file in the cups configuration, and
specifying that the printcap file be created in the /etc
directory will enable MATLAB to make the translation between
the printer address/name that is shown in the File->Print
dialog box and the printer queue name that the OS is
expecting. MATLAB has some Mac-only code that does this
translation, but it will only work if the printcap file is
created and in that location (/etc/printcap).

If it's not already configured, edit the cupsd.conf file and
add this line:
Printcap /etc/printcap

--
Richard Quist
Software Developer
The Mathworks, Inc

Subject: [Help] Printing problem in Mac OSX Leopard

From: Peter Rowat

Date: 18 Jan, 2008 03:23:01

Message: 16 of 26

I have a similar but not identical problem. I upgraded my
iMac to Leopard (10.5.1) and I am running Matlab R2007b.
I created a plot, then clicked "print" and get the error below.

Any suggestions what to try?
I can print to a file and then via Preview to the printer.

-- Peter R
===
Matlab printing error:

>> plot(C1B15(1:10000))
??? Error using ==> send at 129
Error using ==> send at 129
Problem sending file to output device, system returned error :
lpr: The printer or class was not found.


Error in ==> printdlg>LocalInitFig at 469
  if LocalJavaPrintDlg( Data, Dlgname )

Error in ==> printdlg at 100
   Dlg=LocalInitFig(Data);

??? Error while evaluating uimenu Callback

>> print -DEBUG
Debugging in PRINT, PrintJob object is:

pj =

                Handles: {[1]}
                 Driver: 'ps2'
               FileName:
'/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps'
             PageNumber: 0
                 Active: 0
                 Return: 0
             AllFigures: 1
            AllPointers: 'arrow'
            PrinterName: ''
          SimWindowName: ''
               Renderer: ''
         rendererOption: 0
            PrintOutput: 1
                Verbose: 0
            Orientation: ''
                 hgdata: []
             PaperUnits: ''
                PrintUI: 1
             nouiOption: 0
                 UIData: []
                    DPI: -1
              DriverExt: 'ps'
            DriverClass: 'PS'
           DriverExport: 0
            DriverColor: 0
         DriverColorSet: 0
            GhostDriver: ''
              GhostName: ''
             GhostImage: 0
            GhostExtent: []
       GhostTranslation: []
       PostScriptAppend: 0
       PostScriptLatin1: 1
         PostScriptCMYK: 0
    PostScriptTightBBox: 1
      PostScriptPreview: 0
            TiffPreview: 1
             TiledPrint: 0
               FromPage: 1
                 ToPage: 9999
             FramePrint: 0
               PrintCmd: 'lpr -r'
          DefaultDevice: '-dps2'
                  Error: 0
              DebugMode: 1
              Validated: 1
          XTerminalMode: 0

Printing handle: 1
Passing input args to hardcopy:
'/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps' '-dps2'
PRINT debugging: print command = 'lpr -r
"/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps"'.
>>

Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 18 Jan, 2008 14:14:12

Message: 17 of 26

Peter Rowat wrote:
> I have a similar but not identical problem. I upgraded my
> iMac to Leopard (10.5.1) and I am running Matlab R2007b.
> I created a plot, then clicked "print" and get the error below.
>
> Any suggestions what to try?
> I can print to a file and then via Preview to the printer.
>
> -- Peter R
> ===
> Matlab printing error:
>
>>> plot(C1B15(1:10000))
> ??? Error using ==> send at 129
> Error using ==> send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> Error in ==> printdlg>LocalInitFig at 469
> if LocalJavaPrintDlg( Data, Dlgname )
>
> Error in ==> printdlg at 100
> Dlg=LocalInitFig(Data);
>
> ??? Error while evaluating uimenu Callback
>
>>> print -DEBUG
> Debugging in PRINT, PrintJob object is:
>
> pj =
>
> Handles: {[1]}
> Driver: 'ps2'
> FileName:
> '/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps'
> PageNumber: 0
> Active: 0
> Return: 0
> AllFigures: 1
> AllPointers: 'arrow'
> PrinterName: ''
> SimWindowName: ''
> Renderer: ''
> rendererOption: 0
> PrintOutput: 1
> Verbose: 0
> Orientation: ''
> hgdata: []
> PaperUnits: ''
> PrintUI: 1
> nouiOption: 0
> UIData: []
> DPI: -1
> DriverExt: 'ps'
> DriverClass: 'PS'
> DriverExport: 0
> DriverColor: 0
> DriverColorSet: 0
> GhostDriver: ''
> GhostName: ''
> GhostImage: 0
> GhostExtent: []
> GhostTranslation: []
> PostScriptAppend: 0
> PostScriptLatin1: 1
> PostScriptCMYK: 0
> PostScriptTightBBox: 1
> PostScriptPreview: 0
> TiffPreview: 1
> TiledPrint: 0
> FromPage: 1
> ToPage: 9999
> FramePrint: 0
> PrintCmd: 'lpr -r'
> DefaultDevice: '-dps2'
> Error: 0
> DebugMode: 1
> Validated: 1
> XTerminalMode: 0
>
> Printing handle: 1
> Passing input args to hardcopy:
> '/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps' '-dps2'
> PRINT debugging: print command = 'lpr -r
> "/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps"'.

This sounds like the same issue the original poster ran into. There are
2 ways to address it that I'm aware of. The first is a CUPS
configuration setting on the Mac - if there's no /etc/printcap file
created by CUPS, MATLAB's Java-based Print dialog will call the PRINT
command with an invalid printer address, instead of the printer queue
name. This invalid address is not recognized by the operating system.

The CUPS issue can be fixed by adding the following line to the CUPS
configuration file (/etc/cups/cupsd.conf):
   Printcap /etc/printcap
and then restarting the cups process. You may have to login as the root
user to edit this file. Please back up the file before making any changes.

If you are unable to make the above change to the CUPS configuration
file the alternative is to change how the printer is setup in the
operating system. On the Mac's printer browser/print setup dialog do the
following to get MATLAB to recognize the printer:
* set the 'Protocol' field to 'Line Printer Daemon - LPD'
* Set the 'Address' field to the printer host name or address
* leave the 'Queue' name field blank
* **IMPORTANT** IF the printer address field has periods in it, change
the 'Name' field to something that does NOT have any periods
* Close the dialog to save the settings.

You will need to restart MATLAB before these changes take effect.

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 18 Jan, 2008 14:23:03

Message: 18 of 26

"Peter Rowat" <prowat@ucsd.edu> wrote in message
<fmp62l$iq2$1@fred.mathworks.com>...
> I have a similar but not identical problem. I upgraded my
> iMac to Leopard (10.5.1) and I am running Matlab R2007b.
> I created a plot, then clicked "print" and get the error
below.
>
> Any suggestions what to try?
> I can print to a file and then via Preview to the printer.
>
> -- Peter R
> ===
> Matlab printing error:
>
> >> plot(C1B15(1:10000))
> ??? Error using ==> send at 129
> Error using ==> send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> Error in ==> printdlg>LocalInitFig at 469
> if LocalJavaPrintDlg( Data, Dlgname )
>
> Error in ==> printdlg at 100
> Dlg=LocalInitFig(Data);
>
> ??? Error while evaluating uimenu Callback
>
> >> print -DEBUG
> Debugging in PRINT, PrintJob object is:
>
> pj =
>
> Handles: {[1]}
> Driver: 'ps2'
> FileName:
> '/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps'
> PageNumber: 0
> Active: 0
> Return: 0
> AllFigures: 1
> AllPointers: 'arrow'
> PrinterName: ''
> SimWindowName: ''
> Renderer: ''
> rendererOption: 0
> PrintOutput: 1
> Verbose: 0
> Orientation: ''
> hgdata: []
> PaperUnits: ''
> PrintUI: 1
> nouiOption: 0
> UIData: []
> DPI: -1
> DriverExt: 'ps'
> DriverClass: 'PS'
> DriverExport: 0
> DriverColor: 0
> DriverColorSet: 0
> GhostDriver: ''
> GhostName: ''
> GhostImage: 0
> GhostExtent: []
> GhostTranslation: []
> PostScriptAppend: 0
> PostScriptLatin1: 1
> PostScriptCMYK: 0
> PostScriptTightBBox: 1
> PostScriptPreview: 0
> TiffPreview: 1
> TiledPrint: 0
> FromPage: 1
> ToPage: 9999
> FramePrint: 0
> PrintCmd: 'lpr -r'
> DefaultDevice: '-dps2'
> Error: 0
> DebugMode: 1
> Validated: 1
> XTerminalMode: 0
>
> Printing handle: 1
> Passing input args to hardcopy:
> '/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps' '-dps2'
> PRINT debugging: print command = 'lpr -r
> "/tmp/tpa9706fbc_54b2_48ce_859c_06332576a99c.ps"'.
> >>
This sounds like it's the same issue the original poster was
having, which turned out to be caused by a CUPS
configuration issue on the Mac:

There's no /etc/printcap file created by CUPS, which causes
MATLAB's Java-based Print dialog to call the PRINT command
with an invalid printer address, instead of the printer
queue name. This invalid address is not recognized by the
operating system.
 
The issue can be fixed by adding the following line to the
CUPS configuration file (/etc/cups/cupsd.conf):
  Printcap /etc/printcap
and then restarting the cups process. You may have to login
as the root user to edit this file. Please back up the file
before making any changes.
 
If you are unable to make the above change to the CUPS
configuration file the alternative is to change how the
printer is setup in the operating system. On the Mac's
printer browser/print setup dialog do the following to get
MATLAB to recognize the printer:
* set the 'Protocol' field to 'Line Printer Daemon - LPD'
* Set the 'Address' field to the printer host name or address
* leave the 'Queue' name field blank
* **IMPORTANT** IF the printer address field has periods in
it, change the 'Name' field to something that does NOT have
any periods
* Close the dialog to save the settings.
 
You will need to restart MATLAB before these changes take
effect.



Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 18 Jan, 2008 18:51:01

Message: 19 of 26

"Richard Quist" <rquist_nospam@mathworks.com> wrote in message
<fmqco7$1rl$1@fred.mathworks.com>...
> "Peter Rowat" <prowat@ucsd.edu> wrote in message
> <fmp62l$iq2$1@fred.mathworks.com>...
> > I have a similar but not identical problem. I upgraded my
> > iMac to Leopard (10.5.1) and I am running Matlab R2007b.
> > I created a plot, then clicked "print" and get the error
> below.
> >
> > Any suggestions what to try?
> > I can print to a file and then via Preview to the printer.
> >
> > -- Peter R
> > ===
> > Matlab printing error:
>
> This sounds like it's the same issue the original poster was
> having, which turned out to be caused by a CUPS
> configuration issue on the Mac:
>
> There's no /etc/printcap file created by CUPS, which causes
> MATLAB's Java-based Print dialog to call the PRINT command
> with an invalid printer address, instead of the printer
> queue name. This invalid address is not recognized by the
> operating system.
>
> The issue can be fixed by adding the following line to the
> CUPS configuration file (/etc/cups/cupsd.conf):
> Printcap /etc/printcap
> and then restarting the cups process. You may have to login
> as the root user to edit this file. Please back up the file
> before making any changes.
>
> If you are unable to make the above change to the CUPS
> configuration file the alternative is to change how the
> printer is setup in the operating system. On the Mac's
> printer browser/print setup dialog do the following to get
> MATLAB to recognize the printer:
> * set the 'Protocol' field to 'Line Printer Daemon - LPD'
> * Set the 'Address' field to the printer host name or address
> * leave the 'Queue' name field blank
> * **IMPORTANT** IF the printer address field has periods in
> it, change the 'Name' field to something that does NOT have
> any periods
> * Close the dialog to save the settings.
>
> You will need to restart MATLAB before these changes take
> effect.
>

Hi, I am getting another similar printing error in Matlab. This time I use a HP
DeskJet 5150 printer and connect it to my MacBook Pro via USB. The Mac can
detect the printer and add it to the list automatically. But when I try to print a
figure under Matlab, it got some errors on printing. The error message
appeared when I click the "Printer" button on the toolbar of a figure.

??? Error using ==> graphics/private/send at 307
Error using ==> graphics/private/send at 129
Problem sending file to output device, system returned error :
lpr: The printer or class was not found.


Error in ==> printdlg>LocalInitFig at 469
  if LocalJavaPrintDlg( Data, Dlgname )

Error in ==> printdlg at 100
   Dlg=LocalInitFig(Data);

??? Error using ==> printdlg(gcbf)
Error using ==> graphics/private/send at 307
Error using ==> graphics/private/send at 129
Problem sending file to output device, system returned error :
lpr: The printer or class was not found.


??? Error while evaluating uipushtool ClickedCallback

Then, I tried to use "Print Preview..." from the menu bar, it came out same
error message. However, if I use command "print" in Matlab command
window, the figure can be printed out by the USB printer (I set this printer as
my default printer in Mac). I am confused about the printing behavior. How
come it is failed when calling a Java-based printing window? I prefer to use
the print window because I can modify the figure (size, scale, etc..). How can I
fix this problem?

Also, I found that in my /etc/cups/cupsd.conf , there is no
Printcap /etc/printcap
Should I add this line? at the very beginning or as the last line?

Any comment is much appreciated. Thanks a lot for help.


I am using MBP, OSX 10.5.1, Matlab Students 2007a.


Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 18 Jan, 2008 19:07:34

Message: 20 of 26

Niner wrote:
> "Richard Quist" <rquist_nospam@mathworks.com> wrote in message
> <fmqco7$1rl$1@fred.mathworks.com>...
>> "Peter Rowat" <prowat@ucsd.edu> wrote in message
>> <fmp62l$iq2$1@fred.mathworks.com>...
>>> I have a similar but not identical problem. I upgraded my
>>> iMac to Leopard (10.5.1) and I am running Matlab R2007b.
>>> I created a plot, then clicked "print" and get the error
>> below.
>>> Any suggestions what to try?
>>> I can print to a file and then via Preview to the printer.
>>>
>>> -- Peter R
>>> ===
>>> Matlab printing error:
>> This sounds like it's the same issue the original poster was
>> having, which turned out to be caused by a CUPS
>> configuration issue on the Mac:
>>
>> There's no /etc/printcap file created by CUPS, which causes
>> MATLAB's Java-based Print dialog to call the PRINT command
>> with an invalid printer address, instead of the printer
>> queue name. This invalid address is not recognized by the
>> operating system.
>>
>> The issue can be fixed by adding the following line to the
>> CUPS configuration file (/etc/cups/cupsd.conf):
>> Printcap /etc/printcap
>> and then restarting the cups process. You may have to login
>> as the root user to edit this file. Please back up the file
>> before making any changes.
>>
>> If you are unable to make the above change to the CUPS
>> configuration file the alternative is to change how the
>> printer is setup in the operating system. On the Mac's
>> printer browser/print setup dialog do the following to get
>> MATLAB to recognize the printer:
>> * set the 'Protocol' field to 'Line Printer Daemon - LPD'
>> * Set the 'Address' field to the printer host name or address
>> * leave the 'Queue' name field blank
>> * **IMPORTANT** IF the printer address field has periods in
>> it, change the 'Name' field to something that does NOT have
>> any periods
>> * Close the dialog to save the settings.
>>
>> You will need to restart MATLAB before these changes take
>> effect.
>>
>
> Hi, I am getting another similar printing error in Matlab. This time I use a HP
> DeskJet 5150 printer and connect it to my MacBook Pro via USB. The Mac can
> detect the printer and add it to the list automatically. But when I try to print a
> figure under Matlab, it got some errors on printing. The error message
> appeared when I click the "Printer" button on the toolbar of a figure.
>
> ??? Error using ==> graphics/private/send at 307
> Error using ==> graphics/private/send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> Error in ==> printdlg>LocalInitFig at 469
> if LocalJavaPrintDlg( Data, Dlgname )
>
> Error in ==> printdlg at 100
> Dlg=LocalInitFig(Data);
>
> ??? Error using ==> printdlg(gcbf)
> Error using ==> graphics/private/send at 307
> Error using ==> graphics/private/send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> ??? Error while evaluating uipushtool ClickedCallback
>
> Then, I tried to use "Print Preview..." from the menu bar, it came out same
> error message. However, if I use command "print" in Matlab command
> window, the figure can be printed out by the USB printer (I set this printer as
> my default printer in Mac). I am confused about the printing behavior. How
> come it is failed when calling a Java-based printing window? I prefer to use
> the print window because I can modify the figure (size, scale, etc..). How can I
> fix this problem?
>
> Also, I found that in my /etc/cups/cupsd.conf , there is no
> Printcap /etc/printcap
> Should I add this line? at the very beginning or as the last line?
>
> Any comment is much appreciated. Thanks a lot for help.
>
>
> I am using MBP, OSX 10.5.1, Matlab Students 2007a.
>
>


Yes, you should add that line. It's location in the file isn't too
important as long as it's not contained within a "tagged" section. For
example, NOT within a section like the following:
      <Location />
      Order Deny,Allow
      Deny From All
      Allow From 127.0.0.1
      Allow From 127.0.0.2
      Allow From @LOCAL
      </Location>
Putting it at the end of the file is probably the easiest.


The reason the behavior is different is that the print dialog and print
preview window ALWAYS pass the printer name (using the -P option) to the
print command, even if the chosen printer is the default, and that
printer name is passed along by the print command to the operating
system. When printing from the command line I'm guessing you are not
using the -P parameter to specify the printer, so the operating system
picks the default.


--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Niner

Date: 18 Jan, 2008 22:43:03

Message: 21 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fmqtdm$nb$1@fred.mathworks.com>...
> Niner wrote:
> > "Richard Quist" <rquist_nospam@mathworks.com> wrote in message
> > <fmqco7$1rl$1@fred.mathworks.com>...
> >> "Peter Rowat" <prowat@ucsd.edu> wrote in message
> >> <fmp62l$iq2$1@fred.mathworks.com>...
> >>> I have a similar but not identical problem. I upgraded my
> >>> iMac to Leopard (10.5.1) and I am running Matlab R2007b.
> >>> I created a plot, then clicked "print" and get the error
> >> below.
> >>> Any suggestions what to try?
> >>> I can print to a file and then via Preview to the printer.
> >>>
> >>> -- Peter R
> >>> ===
> >>> Matlab printing error:
> >> This sounds like it's the same issue the original poster was
> >> having, which turned out to be caused by a CUPS
> >> configuration issue on the Mac:
> >>
> >> There's no /etc/printcap file created by CUPS, which causes
> >> MATLAB's Java-based Print dialog to call the PRINT command
> >> with an invalid printer address, instead of the printer
> >> queue name. This invalid address is not recognized by the
> >> operating system.
> >>
> >> The issue can be fixed by adding the following line to the
> >> CUPS configuration file (/etc/cups/cupsd.conf):
> >> Printcap /etc/printcap
> >> and then restarting the cups process. You may have to login
> >> as the root user to edit this file. Please back up the file
> >> before making any changes.
> >>
> >> If you are unable to make the above change to the CUPS
> >> configuration file the alternative is to change how the
> >> printer is setup in the operating system. On the Mac's
> >> printer browser/print setup dialog do the following to get
> >> MATLAB to recognize the printer:
> >> * set the 'Protocol' field to 'Line Printer Daemon - LPD'
> >> * Set the 'Address' field to the printer host name or address
> >> * leave the 'Queue' name field blank
> >> * **IMPORTANT** IF the printer address field has periods in
> >> it, change the 'Name' field to something that does NOT have
> >> any periods
> >> * Close the dialog to save the settings.
> >>
> >> You will need to restart MATLAB before these changes take
> >> effect.
> >>
> >
> > Hi, I am getting another similar printing error in Matlab. This time I use a
HP
> > DeskJet 5150 printer and connect it to my MacBook Pro via USB. The Mac
can
> >
>
> Yes, you should add that line. It's location in the file isn't too
> important as long as it's not contained within a "tagged" section. For
> example, NOT within a section like the following:
> <Location />
> Order Deny,Allow
> Deny From All
> Allow From 127.0.0.1
> Allow From 127.0.0.2
> Allow From @LOCAL
> </Location>
> Putting it at the end of the file is probably the easiest.
>
>
> The reason the behavior is different is that the print dialog and print
> preview window ALWAYS pass the printer name (using the -P option) to the
> print command, even if the chosen printer is the default, and that
> printer name is passed along by the print command to the operating
> system. When printing from the command line I'm guessing you are not
> using the -P parameter to specify the printer, so the operating system
> picks the default.
>
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.

Hi Richard,

Thank you very much. You suggestions solved my problem. Now the printing
is working great. I added the line at the end of cupsd.conf . Thanks again.




Subject: [Help] Printing problem in Mac OSX Leopard

From: Peter Rowat

Date: 19 Jan, 2008 00:27:29

Message: 22 of 26

> The issue can be fixed by adding the following line to the
> CUPS configuration file (/etc/cups/cupsd.conf):
> Printcap /etc/printcap
> and then restarting the cups process. You may have to login
> as the root user to edit this file. Please back up the file
> before making any changes.

Thank you, Richard.
I made the change in "cupsd.conf" as you suggested and now
I can print Matlab graphics correctly.

-- Peter


Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 21 Jan, 2008 13:53:11

Message: 23 of 26

Niner wrote:
> Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't print
> out the figure I created. I got this error message:
>
> '-----------------------------------------
> ??? Error using ==> graphics/private/send at 307
> Error using ==> graphics/private/send at 129
> Problem sending file to output device, system returned error :
> lpr: The printer or class was not found.
>
>
> Error in ==> printdlg>LocalInitFig at 469
> if LocalJavaPrintDlg( Data, Dlgname )
>
> Error in ==> printdlg at 100
> Dlg=LocalInitFig(Data);
>
> Error in ==> graphics/private/ppreview>onPrint at 906
> printdlg(fig);
> '-------------------------------------------
>
> I can see the printer in the Print Window. But I can't print out the file.
> Although I can save the figure as a PDF file and print it out without problem, I
> still want to print the file directly under Matlab. Do I need to re-install
> Matlab? Any idea to fix this problem? Thank you very much for your help.
>
> I use Mac OSX Leopard, Matlab 2007a Student version
>
>

The solution for this issue has been published here:
http://www.mathworks.com/support/solutions/data/1-5DRO9Z.html?solution=1-5DRO9Z

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Alexander Gera

Date: 23 Jan, 2008 22:48:01

Message: 24 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<fn2847$2hr$1@fred.mathworks.com>...
> Niner wrote:
> > Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't
print
> > out the figure I created. I got this error message:
> >
> > '-----------------------------------------
> > ??? Error using ==> graphics/private/send at 307
> > Error using ==> graphics/private/send at 129
> > Problem sending file to output device, system returned error :
> > lpr: The printer or class was not found.
> >
> >
> > Error in ==> printdlg>LocalInitFig at 469
> > if LocalJavaPrintDlg( Data, Dlgname )
> >
> > Error in ==> printdlg at 100
> > Dlg=LocalInitFig(Data);
> >
> > Error in ==> graphics/private/ppreview>onPrint at 906
> > printdlg(fig);
> > '-------------------------------------------
> >
> > I can see the printer in the Print Window. But I can't print out the file.
> > Although I can save the figure as a PDF file and print it out without
problem, I
> > still want to print the file directly under Matlab. Do I need to re-install
> > Matlab? Any idea to fix this problem? Thank you very much for your help.
> >
> > I use Mac OSX Leopard, Matlab 2007a Student version
> >
> >
>
> The solution for this issue has been published here:
> http://www.mathworks.com/support/solutions/data/1-5DRO9Z.html?
solution=1-5DRO9Z
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.

I have the same problem as 'niner' with Matlab Version 7.1 (R14SP3). I
inserted the line Printcap /etc/printcap after the last line in the file:
cupsd.conf, but I am still getting the error message and no plot.


Subject: [Help] Printing problem in Mac OSX Leopard

From: Richard Quist

Date: 24 Jan, 2008 13:20:19

Message: 25 of 26

Alexander Gera wrote:
> Richard Quist <rquist_nospam@mathworks.com> wrote in message
> <fn2847$2hr$1@fred.mathworks.com>...
>> Niner wrote:
>>> Hi, my Macbook Pro had upgraded to Leopard. I found that Matlab can't
> print
>>> out the figure I created. I got this error message:
>>>
>>> '-----------------------------------------
>>> ??? Error using ==> graphics/private/send at 307
>>> Error using ==> graphics/private/send at 129
>>> Problem sending file to output device, system returned error :
>>> lpr: The printer or class was not found.
>>>
>>>
>>> Error in ==> printdlg>LocalInitFig at 469
>>> if LocalJavaPrintDlg( Data, Dlgname )
>>>
>>> Error in ==> printdlg at 100
>>> Dlg=LocalInitFig(Data);
>>>
>>> Error in ==> graphics/private/ppreview>onPrint at 906
>>> printdlg(fig);
>>> '-------------------------------------------
>>>
>>> I can see the printer in the Print Window. But I can't print out the file.
>>> Although I can save the figure as a PDF file and print it out without
> problem, I
>>> still want to print the file directly under Matlab. Do I need to re-install
>>> Matlab? Any idea to fix this problem? Thank you very much for your help.
>>>
>>> I use Mac OSX Leopard, Matlab 2007a Student version
>>>
>>>
>> The solution for this issue has been published here:
>> http://www.mathworks.com/support/solutions/data/1-5DRO9Z.html?
> solution=1-5DRO9Z
>> --
>>
>> Richard Quist
>> Software Developer
>> The MathWorks, Inc.
>
> I have the same problem as 'niner' with Matlab Version 7.1 (R14SP3). I
> inserted the line Printcap /etc/printcap after the last line in the file:
> cupsd.conf, but I am still getting the error message and no plot.
>
>

After you restart cups you also need to restart MATLAB.
Does the /etc/printcap file exist? (note that the filename is case
sensitive - it must be all lowercase)

What does the Mac's print browser/print setup dialog show for the
following fields for the printer you're trying to use?
protocol:
address:
queue:
name:


--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: [Help] Printing problem in Mac OSX Leopard

From: Andrew

Date: 16 Jul, 2008 22:22:01

Message: 26 of 26

Richard Quist <rquist_nospam@mathworks.com> wrote in message
<snip>
> The solution for this issue has been published here:
> http://www.mathworks.com/support/solutions/data/1-5DRO9Z.html?
solution=1-5DRO9Z
>
> --
>
> Richard Quist
> Software Developer
> The MathWorks, Inc.

This worked for me with one caveat--color plots are always printed in black and
white. Is anyone else having this problem? Am I overlooking something
obvious? In the options dialog, I make certain to select the "color" (vs.
"monochrome") option.

Andrew

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
leopard Alexander Gera 23 Jan, 2008 17:50:21
printing Alexander Gera 23 Jan, 2008 17:50:21
printcap Richard Quist 18 Jan, 2008 08:55:53
java Richard Quist 18 Jan, 2008 08:55:53
matlab Peter Rowat 15 Jan, 2008 23:31:58
cups Richard Quist 8 Nov, 2007 08:30:59
leopard Niner 29 Oct, 2007 17:45:19
mac Niner 29 Oct, 2007 17:45:19
os x Niner 29 Oct, 2007 17:45:19
printer Niner 29 Oct, 2007 17:45:18
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com