Discussion Locked

dos-based printing in Java

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi friends,

Mr Bojidar had given the right answer. But by mistake I rejected the answer and closed the question. Sorry for the inconvenience Mr Bojidar.

Re : I am facing the problem of slow printing when using the Window based printing. I think it will be faster if I go for draft printing, but am confused about how to specify the font-style in my css.

In my style sheet, I tried like this -
BODY
{
font-style: 'draft 10 cpi';
}

but there seems no effect.

Actually, my problem is to get DOS-type printing through my JSP application. The clarity (dots-per-inch) can be as low as possible.

You can also suggest any alternative solution.

Regards.
Nise

5 replies

by jay eckles

JSP is not JSP on the client - it's HTML and whatever other client-side code you decide to throw in (like Javascript or VBScript). JSP gets executed on the server and is no different than a servlet. I assume you're talking about printing on the client, and not on the server.

To print on the client, you have precisely one option, and that is the javascript window.print() method. Otherwise, the client has to download and run a Java application. Your CSS idea is a good one, but unfortunately most browsers don't fully support CSS. Also, what you should do is look at @media - you can use it to change the font face, style, size, etc. when the document is being printed (as opposed to being displayed on screen). Read about it in the CSS2 spec at http://www.w3.org/TR/REC-CSS2/media.html, especially section 7.2.1, "The @media rule".

If you're interested in printing something on the server, that's a different matter. What you should do is look at the Java 1.4 printing API - don't waste your time beating your head against a wall trying to make the 1.3 API work; it's vastly improved in 1.4.

by nise_k

Thanx for telling me this. I never cared about the @media attribute. It seems it is useful one. I may try it later.

This discussion is closed to new replies.