Click here to Skip to main content
14,835,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to print a html page.
The page contains data which have a size of width:7cm heght:15cm
By default my html window page size is width:613px height:787px..
i used css media queries
@page :left {
  margin-left: 7cm;
  margin-right: 15cm;

@page :right {
  margin-left: 7cm;
  margin-right: 15cm;

but i cant get correct.
Reply me :)
[no name] 3-Mar-14 13:46pm
I am not clear about your exact question. you cant get correct what? the print size or the html window size. Please provide your print method also.
sivamzcet 5-Mar-14 0:36am
i used window.print() in javascript.. i cant get correct window size to print a 5x7 cm page size

1 solution

You use paging media rules under @page, but not @media rules, which are designed specially for such purposes. Please see:[^],[^].

This is the way to specify separate style set for printing.

Maciej Los 3-Mar-14 14:51pm
Thank you, Maciej.
sivamzcet 5-Mar-14 2:12am
hyy my printable paper size is width:5cm & height:5cm.. but my window size is 1280x800..
i need this for an online billing software
And could you explain why this is "but"? :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900