Is there a way to explicitly tell the CUPS server that the file you are sending is text/html thus overriding the mime.types lookup?
Is there a way to explicitly tell the CUPS server that the file you
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, there is.
Use this commandline:
Update (in response to comments)
I provided an exact answer to the OP’s question.
However, this (alone) does not guarantee that the file will be successfully printed. To achieve that, CUPS needs a filter which can process the input of MIME type
text/html.Such a filter is not provided by CUPS itself. However, it is easy to plug your own filter into the CUPS filtering system, and some Linux distributions ship such a filter capable to consume HTML files and convert them to a printable format.
You can check what happens in such a situation on your system. The
cupsfiltercommand is a helper utility to run available/installed CUPS filters without the need to do actual printing through the CUPS daemon:Now on a system with no HTML consuming filter ready, you’d get this response:
On a different system (like on a Mac), you’ll see this:
You can even force input and output MIME types to see which filters CUPS would run automatically when asked to print this file an a printer supporting that particular output MIME type (
-isets the input MIME type,-mthe output):Here it would first convert HTML to PDF using
xhtmltopdf, then transform the resulting PDF to PostScript usingcgpdftops.If you skip the
--list-filtersparameter, the command would actually even go ahead and do the conversion by actively running (not just listing) the two filters and emit the result to<stdout>.You could write your own CUPS filter based on a Shell script. The only other ingredient you need is a command line tool, such as
htmldocorwkhtmltopdf,which is able to process HTML input and produce some format that in turn could be consumed by the CUPS filtering chain further down the road.Be aware, that some (especially JavaScript-heavy) HTML files cannot be successfully processed by simple command line tools into print-ready formats.
If you need more details about this, just ask another question…