• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

printing a form

 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello.

i'm kinda new at this and i would just like to ask how print.
i have a form in my browser and I would just like to kind of like export that to microsoft word for printing.

how is that done?

thanks
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, i thought of that but its really difficult to format the data especially if its a table and some other stuff.

can't i like export the generated data to word or something? because i need to generate printable reports.

thanks
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by shuini gustav:
yes, i thought of that but its really difficult to format the data especially if its a table and some other stuff.

can't i like export the generated data to word or something? because i need to generate printable reports.

thanks



HTML output is hell on paper. Page breaks never quite work well.

Check out JasperReports
http://jasperreports.sourceforge.net/

Now something I'm looking into is printing directly from the tomcat server (intranet wise) to a shared printer. Any ideas?
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Scott Selikoff
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gerardo Tasistro:
HTML output is hell on paper. Page breaks never quite work well.


Not if your HTML is structured well enough.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Scott Selikoff:

Not if your HTML is structured well enough.



Care to share your insights on this?
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Scott Selikoff:

Not if your HTML is structured well enough.



And meets some limitations and is read always on the same browser and printed on the same type of paper. For everything else there is PDF.
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i always have a hard time printing tables directly from html. it doesn't fit on one paper and you can't control the fonts and margins.

thanks. i'll try iText. hope it's eaasy to use though
 
Scott Selikoff
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:


Care to share your insights on this?


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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic