Cups Linux: Help Printing These Media Types: Ms Excel, Ms Word and HTML

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

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.

What is a correct MIME type for .docx, .pptx, etc.?

Here are the correct Microsoft Office MIME types for HTTP content streaming:

Extension MIME Type
.doc application/msword
.dot application/msword

.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template
.docm application/vnd.ms-word.document.macroEnabled.12
.dotm application/vnd.ms-word.template.macroEnabled.12

.xls application/vnd.ms-excel
.xlt application/vnd.ms-excel
.xla application/vnd.ms-excel

.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template
.xlsm application/vnd.ms-excel.sheet.macroEnabled.12
.xltm application/vnd.ms-excel.template.macroEnabled.12
.xlam application/vnd.ms-excel.addin.macroEnabled.12
.xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12

.ppt application/vnd.ms-powerpoint
.pot application/vnd.ms-powerpoint
.pps application/vnd.ms-powerpoint
.ppa application/vnd.ms-powerpoint

.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
.potx application/vnd.openxmlformats-officedocument.presentationml.template
.ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow
.ppam application/vnd.ms-powerpoint.addin.macroEnabled.12
.pptm application/vnd.ms-powerpoint.presentation.macroEnabled.12
.potm application/vnd.ms-powerpoint.template.macroEnabled.12
.ppsm application/vnd.ms-powerpoint.slideshow.macroEnabled.12

.mdb application/vnd.ms-access

For further details check out this TechNet article and this blog post.

Why is it `text/html` but `application/json` in media types?

This is described on the MIME types page of the mozilla documentation.

application refers to any kind of binary data while text is theoretically human readable.

type/subtype

The structure of a MIME type is very simple; it consists of a type and
a subtype, two strings, separated by a '/'. No space is allowed. The
type represents the category and can be a discrete or a multipart
type. The subtype is specific to each type.

A MIME type is case-insensitive but traditionally is written all in lower case.

Further down the page you can find a table containing the discrete types:

Type          Description
text Represents any document that contains text and is theoretically human readable
image Represents any kind of images. Videos are not included, though animated images (like animated gif) are described with an image type.
audio Represents any kind of audio files
video Represents any kind of video files
application Represents any kind of binary data.

To answer your question about JSON, while you'll frequently come across JSON that is human readable it's primarily used for containing data and isn't necessarily intended to simply be read. Meanwhile a machine can always easily convert the data from JSON into an object (assuming the JSON is correctly formatted).

How to use Microsoft.Office.Interop.Excel on a machine without installed MS Office?

You can't use Microsoft.Office.Interop.Excel without having ms office installed.

Just search in google for some libraries, which allows to modify xls or xlsx:

  • http://code.google.com/p/excellibrary/
  • http://simpleooxml.codeplex.com/ (only xlsx)


Related Topics



Leave a reply



Submit