Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: [Help] Printing problem in Mac OSX Leopard
Date: Thu, 1 Nov 2007 22:17:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 258
Message-ID: <fgdj93$bsh$1@fred.mathworks.com>
References: <fg5k90$6uk$1@fred.mathworks.com> <fg77g3$6jo$1@fred.mathworks.com> <fg7v7f$8cd$1@fred.mathworks.com> <fg81a0$ijr$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193955427 12177 172.30.248.37 (1 Nov 2007 22:17:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 1 Nov 2007 22:17:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1130080
Xref: news.mathworks.com comp.soft-sys.matlab:435725



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