Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: [Help] Printing problem in Mac OSX Leopard
Date: Fri, 2 Nov 2007 20:51:46 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 158
Message-ID: <fgg2l2$mju$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> <fgdj93$bsh$1@fred.mathworks.com> <fgf4a1$s68$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1194036706 23166 172.30.248.38 (2 Nov 2007 20:51:46 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 2 Nov 2007 20:51:46 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1130080
Xref: news.mathworks.com comp.soft-sys.matlab:435872



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