Alex Rivera | Logout

HTML print with absolute postitions

Asked 2012-06-05T18:21:56.237
28

Is it possible to print a HTML page with truly absolute positioned elements to paper? It seems all browsers are doing a big mess here. It is easy to define a body by absolute units (eg. cm) and place elements by position: absolute inside. However, every browser seem to try to make it impossible to print such a page. FF for example is adding print margins, even when printing to a PDF on linux despite 0-margin page settings. Chrome seems to shrink the page in every case. So how to print something with absolute positioning, eg. paper form fields, markings etc.? Have I overlooked something?

Edit
Report

1 Answer

1

set the margin with page setup is the first and primary solutions for printing the HTML page or a DIV .

After all not expected result will come then you need some digs on your HTML page.

Make a window without title bar or any custom bar using java script.And put all Original data into that window with a position:relative and also set the media type as print.

position:relative;
media:print;

Hope it will helpful.

answered 2012-07-26T13:00:13.433

Your Answer