Why am I unable to print from the 'File -> Print' menu in the MATLAB editor in my Linux machine running CUPS?

6 views (last 30 days)
I am unable to print from the 'File->Print' menu in the MATLAB Editor, but I am able to print using the PRINT command. I am running Linux with the CUPS/IPP printing system and all my other programs are able to print.
When I invoke PRINTDLG, it produces the error "There are no properly configured printers on your system". If I execute the Java command:
javax.print.PrintServiceLookup.lookupDefaultPrintService
I obtain an empty string.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Feb 2010
When you print from the 'File->Print' menu, a totally different code path is taken from that used when you execute the PRINT command. When you print from the menu, Java is used to send the print job whereas the PRINT command interfaces directly with the operating system. In some cases, the results obtained from these two printing methods is different. In this case, Java is unable to find the default printer in your system, so printing from the menu fails.
This issue might be produced by a misconfiguration of the CUPS printing system.
Below, you will find the uncommented lines of the file '/etc/cups/cupsd.conf' for a Linux Fedora Core 4 running CUPS 1.1.17 that has a unique printer called Jupiter.
LogFilePerm 0600
MaxLogSize 2000000000
LogLevel info
Printcap /etc/printcap
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>
<Location /admin>
AuthType Basic
AuthClass System
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>
<Location /printers/jupiter>
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
AuthType None
</Location>
Browsing On
BrowseProtocols cups
BrowseOrder Deny,Allow
BrowseAllow from @LOCAL
Listen 127.0.0.1:631
Also, here are the uncommented lines of the file '/etc/cups/printers.conf'
<DefaultPrinter jupiter>
DeviceURI lpd://printers/jupiter
Location
Info
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
</Printer>
You may also access 'cupsd.conf' through the web interface by visiting the following link (provided you are accessing the machine locally):
http://localhost:631
Using the configuration files above, you might be able to print both from the file menu and using the PRINT command. Moreover, the output of the Java call that looks for the default printer is
javax.print.PrintServiceLookup.lookupDefaultPrintService
ans =
IPP Printer : jupiter
We have seen that in some Linux distributions, such as Debian 3.1, there is more that one line with the 'Listen' parameter in the CUPS configuration file. This line reads
Listen /var/run/cups/cups.sock
Commenting this line out and restarting the CUPS service sometimes solved the issue. After restarting CUPS, close and open MATLAB before you try to print again.
Sometimes, leaving the above line uncommented and commenting this line:
Listen localhost:631
also works. However, commenting out this line will disable the GUI for updating the CUPS configuration.
Some customer have also reported that the issue was caused due to an unusually named PPD file. Check the following folder that holds all the Printer Drivers (PPD):
/etc/cups/PPD
Check to see if any of the printer driver filenames have special characters in them. for example:
"HP_LaserJet_M1522nf_MFP_[00CNC89DN058]_(Fax).ppd"
Removing this driver and restarting cups and MATLAB seemed to resolve the issue. MATLAB was able to recognize other printers installed on the system.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!