Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUPS Linux: Help printing these media types: MS Excel, MS Word and HTML

I need to print MS Excel, MS Word and HTML files in a Linux CUPS server. When i try to print thses media types following occurs and this is what i've found till now:

  • For MS Excel and MS Word files:

    When i try to print a file like these the error output is:

    alvaro@alvaro-VM:~$ lp -d test_printer -o document-format=application/msword ptest.doc
    lp: Unsupported format 'application/msword'!
    

    or, the same:

    alvaro@alvaro-VM:~$ lp -d test_printer  ptest.doc
    lp: Unsupported format 'application/msword'!
    

    What i've found searching arround is that supposedly it is possible to use a CUPS filter, in this case the one i've found is called "officetop" (sourceforge/download link), taht would be possible to print MS OFFICE files. The problem i have with this "officetop" filter is that i don't know how to install it or counfigure it or whatever it needs to make it work and i couldn't find any tutorial or guide. So i wiil appreciate any help on this. Do you recommend use this filter to do this task? i'm open to any alternative solution.

  • For HTML files:

    As a first test i made:

    alvaro@alvaro-VM:~$ lp -d test_printer  -o document-format=text/html index.html 
    the requested id is test_printer-105 (1 archivo(s))
    

    And, which gave the same result:

    alvaro@alvaro-VM:~$ lp -d test_printer  index.html 
    the requested id is test_printer-106 (1 archivo(s))
    

    index.html:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">        
    <html><body><h1>It works!</h1>
    <p>This is a html print test.</p>
    </body></html>
    

    Result: on the printed sheet you can see just de html code instead the formated text.

    EDIT: If i print a web page from the web browser like chrome it gets well printed but If i download the web page with the browser option "Save web page as" and then issue *lp -d test_printer index.html* occours the same i mentioned before, just the html code gets printed.

    Please help on this. what I want is to get the formated text it is posible. It is also possible to print HTML+CSS?.

Thank you very much guys.

Regards.

PD: sorry about my english.

like image 816
Alvarob Avatar asked Apr 17 '13 18:04

Alvarob


1 Answers

Remember Linux gets it's instructions on which applications to open which types of files from /etc/mailcap. Also, any type of file that is printed needs to be "rendered" or "compiled" by an application that is able to do so, hence the reference to /etc/mailcap. An e-mail application cannot "render" an Excel file, and Photoshop cannot open HTML files :)

By the looks of it, you do not have an entry in your /etc/mailcap for an application to handle Excel, Word or HTML files, that is why the raw content is printed and not the "rendered" page (if you are printing from Linux).

Are you printing from Linux or from Windows?. If you print from Windows (through the cups server on your Linux box) and it prints normal, then you know the problem is not the printer but /etc/mailcap on Linux.

like image 80
Danny Avatar answered Sep 18 '22 11:09

Danny