• 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

how to make a printer friendly page?

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam having an html page which contains a table of more than 50 rows.
Can any one tell me how to make this page a printer friendly.
When i use normal print option the table is breaking in the middle i.e. i mean half row in one page and another half row in another page.
I dont want this to happen instead if these is no space for a row it should move to another page and print the rest of the table.
Please give me some suggestions..
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look into CSS print media and page break.

Eric
 
Abhishek Reddy
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply..
i have tried that one but iam unable to understand where to keep this pagebreak exactly.
My html page contains table of more than 40 rows and the table position in a page is not fixed.
how to know at which table row the page ends ?
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't have to decide where the page break will occur. That's the browser's job. As with everything else in CSS, your job is to provide information to help the browser do things the way you want them done.

In your case, you want to tell the browser not to put a page break inside a particular box. And for that there's the "page-break-inside" element. One of its possible values is "avoid". I encourage you to look at the CSS2 Reference for more information about pagination; it isn't a simple thing at all.
 
Abhishek Reddy
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply, i have tried that one but did not worked. I have come to know that page-break-inside property was not supported in IE browser.
Can you suggest me other alternatives?
 
Abhishek Reddy
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the alternative for "page-break-inside=avoid" option in Internet Explorer.
how to implement this functionality so that the table wont get splitted in between the rows while printing?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Abhishek,
How you resolve the printer friendly page problem ? I think You got the solution for that problem.Could you Please give me the solution for that problem.

Thanks & Regards,
Vasu.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solve this problem thus.

I mark HTML the elements, before which it is possible to make the gap of page. For the table this can be simply elements TR. Then I keep all marked elements in the array. After this, I go around all elements of the array in the cycle and calculate coordinate "top". If coordinate is greater than the height of page - I return to the previous element and forcedly put the break of page.

Further the height of page is measured from this element. The necessary height of page was selected experimentally.
 
vasu Sanaboina
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andrey,
If you don't mind could you elaborate the solution.

Thanks & Regards,
Vasu
 
Andrey V. Ovcharenko
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vasu Sanaboina:
...could you elaborate the solution.


With x.js - library:
 
reply
    Bookmark Topic Watch Topic
  • New Topic