Printing is not a simple feat when it comes to web programming of any kind. The most common way people print, is just to use built-in printing that prints the generated html such as right-clicking in IE and selecting 'Print'.
You can print via Word/PDF format but you first have to convert the input data into one of these files, then let the user download it. There's no guarentee after the user has downloaded that they will print the data, though. There are a number of plugins (free?) that support document conversion.
My suggestion is when you want to print the data create a report-like HTML page that opens in a new browser window and displays the data neatly on the screen (without web page menu bars for example). Then, the user can just print that page.
For printing, the best format would be PDF. You could allow your users to download PDF versions of your reports. There are free PDF Java API's out there. You might want to check out the Other Open Source Projects forum for suggestions.
Now something I'm looking into is printing directly from the tomcat server (intranet wise) to a shared printer. Any ideas?
Bernard Sigmund Gustav
Joined: Dec 20, 2005
i have no idea how to do that
it's just really difficult to try and print my form directly from the browser, it can't be formatted properly.
i googled for free java pdf api's and here's some of what i got. can anyone tell me which of these is the best to use? i haven't had any experience from any of them. like, which one is the easiest to use and make a program of?
Big Faceless Java PDF Library(this is commercial though) iText Orinoco Smart JPrint
can anyone else suggest anything? it has to be free of course.
thanks a lot
Joined: Feb 08, 2005
I have a friend who used iText. He used it to do exactly that print PDFs. Actually generate them. The printing came from the browser as it opened the PDF.
Depends what your developing on it. One of the best tests is knowing how well your page will shrink and grow based on the browser size. If you page displays nicely on 800x600 as well as 1600x1200, then printing shouldnt be too much of atrouble. Also, focus more on text formats than graphical images. Take a page from other websites that do this alot like mapquest and travel sites. They often can print out pages that look exactly like their web pages. [ February 03, 2006: Message edited by: Scott Selikoff ]