Forum How do I...?

writing XHTML to position precisely text in the PDF output

Anonymous
Hello I am using absolute position in my XHTML document


#pname {
	position:absolute;
	top:135pt;
	left:44pt;
	width:136pt;
	padding:1pt;
	}



To my surprise, when I used Prince to create PDF, the text

 <div id="pname"> foo </div>



did not show up on the paper with the above measurements. it was shifted down and to the right quite substantially.

To be more exact, it started about 3 inches down the page (216 pt.) and about 1 7/8" to the right (135 pt).

Are there "hidden" margins I have to be aware of, when calculating pt size offsets? :?:

Thanks

Mark
mikeday
Hi Mark,

By default each page has a 90pt margin on the left and right and a 72pt margin on the top and bottom. This can be changed using an @page rule like this:

@page {
    margin: 20pt
}

The above rule will apply a 20pt margin on all four sides of the page.

Best regards,

Michael