Discussion on:

12
Comments

Join the conversation!

Follow via:
RSS
Email Alert
0 Votes
+ -
Message has been deleted.
dandan79 Updated - 29th Oct 2010
0 Votes
+ -
Page breaks
Mundo209 2nd Nov 2010
Nice one JJa. Did you find a way to reliably avoid splitting images over page breaks? Did you experiment with page-break-before, -inside, -after?
0 Votes
+ -
Contributr
Nope, sorry
Justin James 2nd Nov 2010
I didn't do anything with that since in my application, the only images are tiny or in parts of the page that I do "display: none" on anyways like the header.

J.Ja
0 Votes
+ -
If your project is Java you can use the Flying Saucer jar to create pdf. See https://xhtmlrenderer.dev.java.net/
I've been using something based on it in Grails projects. It works well. All one needs is a print.css, media="print". In my case it sets certain areas of the page invisible and uses a serif font. It does print images and, of course, gets the page breaks right.

CSS3 will have a page size attribute. See http://www.w3.org/TR/css3-page/#page-size
Just for starters, you really need to read this: http://en.wikipedia.org/wiki/Span_and_div
Pay particular attention to the section on "divitis".
From there, educate yourself on the concepts of what is called "the semantic web".
0 Votes
+ -
Contributr
Using about 5 - 6 divs like I suggest doing to create a header section, a content section, etc. is quite appropriate. Note that I didn't say to use a div for every single thing...

That being said, there are a couple of places in my app (particularly the menu) where I would normally consider some changes, but in my current system, it's not going to happen for technical reasons, and using div was simply a better choice.

J.Ja
0 Votes
+ -
I've been using print style sheets for .. oh .. probably a decade or close to that. But I am not surprised that a lot of people don't know what they are. My initial prime reason for doing so was to remove non-essential items from web page printing - things like navigation that have no use on a printed page.
0 Votes
+ -
Contributr
For me...
Justin James 2nd Nov 2010
... it was the first time that I didn't use a layout that translated nicely to print on it's own. That's one really nice thing about a fluid layout with no large images, it goes straight to the printer pretty well. In this case, I've moved to a much more fixed layout, which really requires a printer-specific style.

I still see a lot of sites that print like garbage, so hopefully this reached a few of 'em. happy

J.Ja
That was great Justin. that was realy helpful. I don't normally leave read messages in my inbox but am going to leave this one future referencing. Am currently working on a website for my school and I will need these tips for the report printing side of my project.
Thanks
0 Votes
+ -
PDF is easier?
old graham 6th Nov 2010
I must read this a bit more closely. I could never get my head around this up to now and just copy the whole lot to a pdf and link to that for a printable page. A bit of a cop out I am afraid.
0 Votes
+ -
A PDF might be easier, but it's also not accessible by default, and automatically generated PDFs aren't accessible and don't meet web accessibility standards.
With most modern browsers one gets given a choice whether to save the file or open it. Depending on how the browser is set up, the file may be automatically opened. That's on Windows, Linux and most likely also Mac.

How easy it is to get a pdf will depend on the technology one uses. With Grails, which I use, it is quite easy, provided the page to be turned into pdf is valid xhtml. Why do things the difficult way if there is an easy way to get the same results?
Keyboard Shortcuts:
Prev
Next
Toggle
Join the conversation
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.