Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: [Help] Printing problem in Mac OSX Leopard
Date: Tue, 30 Oct 2007 15:39:44 -0400
Organization: The MathWorks
Lines: 184
Message-ID: <fg81a0$ijr$1@fred.mathworks.com>
References: <fg5k90$6uk$1@fred.mathworks.com> <fg77g3$6jo$1@fred.mathworks.com> <fg7v7f$8cd$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: quistr.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1193773184 19067 144.212.107.174 (30 Oct 2007 19:39:44 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Oct 2007 19:39:44 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
In-Reply-To: <HIDDEN>
Xref: news.mathworks.com comp.soft-sys.matlab:435318



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.