Forum How do I...?

Create a border around the pdf document

s.hardjadinata
Hi! I'm converting a standard HTML code into pdf. Anyone knows how to add a border so that when the pdf is printed, all four sides of the paper is outlined by solid black lines?

Tried to do it manually with CSS stylesheet using:
margin-top, margin-left, margin-right, margin-bottom properties
but cant manage to get the lines to the outermost edge of the paper. There is always a gap between the border and the paper edge.

Thx in advance!
mikeday
Try putting a border on the page, reducing the page margin to zero, and adding some padding instead, like this:
@page {
    border: solid black thick;
    margin: 0;
    padding: 2cm
}
s.hardjadinata
Thanks but the border still appears around the middle. There is still whitespace between the border and the edge of paper.
(Or maybe I didn't understand your code completely)

The CSS code:
table{
width:600px;
height:500px;
border: solid black thick;
margin: 0;
padding: 2cm;
}


HTML code:
[i]<html>
<body>
<table>
<tr>
<td>
Roof is on Fire</td>
</tr>
</table>
</body>
</html>[/i
]


What I'm trying to do is to get the border sitting exactly on the paper edge so there is no whitespace between the border and paper circumference.

Cheers!!
mikeday
Then you need to get rid of the default page margin, using this rule:
@page { margin: 0 }
s.hardjadinata
Thanks... :)