Forum How do I...?

Content positioning

PatrickMounteney
It's my first day evaluating Prince, and after installing it on my iMac, plus the php interface I am able to generate a pdf from a very simply HTML page. So far so good!

But my problem is that the content, which I would expect to start at the top left of the pdf - as in the HTML page - stubbornly remains printing some 70px down and 90px in from the left.

My page size needs to be A4 as the project involves print-ready pdfs. But that's in the future - right now I would be happy to find out how to fill my HTML page so that it fills the resulting A4 pdf.

CSS:

@page {
marks: crop;
size: A4;
}

img{
position: absolute;
top: 0px;
left: 0px;
width: 681px;
height: 148px;
}


Example of generated pdf attached.


Many thanks,

Regards,

Patrick

  1. test.pdf29.6 kB
    My test file showing offset image
mikeday
Clear the page margin:
@page { margin: 0 }
PatrickMounteney
Thanks Mike - so simple too!

I had tried setting the margin on the body as I'd normally do in CSS, but I guess I was expecting that the content origin in the resulting pdf would be as I was seeing in my browser.

It's just a case of getting my head around the way Prince works. Let's see what day two has in store!