Printing?

Hey guys.. Well I think the subject says it all..

So i need to make invoice reports and the data is in tables and such on the web page but if i use just javascript print functions the format is ugly and no graphics.. I suppose you could just use print screen but I want to formatt it nicely and also have different things on the first and last pages if multiple pages are required.. So.. Any Suggestions? or where to look or any tools.. anything? Im fairly new to this so the more basic starting information the better.. thanks

[541 byte] By [jbayugaa] at [2007-11-26 16:33:08]
# 1

HTML is not the best language for printing in. Maybe you should generate a PDF document (look into XSLT and FOP).

But if you insist on doing HTML, here's a couple hints:

- Know what I mean in CSS when I say: "display: none" on print media.

- Enforce strict table sizes, down to the pixel. Do not exceed a comfortable 600 pixel width.

Lastly, when I provide a print button, I don't automatically send the job to the users print queue. I just pop the browsers print dialog box up. I use JavaScript to do that.

CowKing

IamCowKinga at 2007-7-8 22:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Hey .. No im not dead set on HTML Printing.. I would do the PDF but recommend anything? Right now im looking into jasper reports but it seems like a lot more trouble than its worth you know what i mean? But anyhow.. If you have pointers give a holla back.. :D thanks
jbayugaa at 2007-7-8 22:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Alright, I'll give you a couple pointers.

The JavaScript function you want to call, to bring up the browser print dialog, is:

window.print();

As I mentioned before, work within a 600 pixel width.

Also mentioned before... look into CSS command "display: none". You can make things disappear on your screen, but appear on the printout (or vis a vis). You just have to set the media to screen or print.

Finally, there is a way to force page breaks in CSS. Use carefully...

.pageBreakBefore {

page-break-before: always

}

.pageBreakAfter {

page-break-after: always

}

The rest is up to you to figure out. =)

CowKing

IamCowKinga at 2007-7-8 22:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thanks mate much help
jbayugaa at 2007-7-8 22:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...