Forum How do I...?

How do I make an image stretch across a whole PDF page?

roychen
Hello, I'd like to make an image take up all the space on the first page of my PDF.

Currently, I'm using this HTML tag for my image:

<p style=text-align: center;><img src="test.jpg" height="100%" width="100%"/></p>


I've included a @page rule in my CSS styles for the HTML page:

@page:first { margin: 0pt; } 


The image stretches fine across the entire first page of the output PDF, but part of it is missing from the page, like the image is not correctly centered.

Is there anyway I can correct this?

Thanks.
mikeday
If you want it to fill the entire page, make sure you've specified zero margin on the containing <p> element and any other elements. Also, the image will need to be the same aspect ratio as the page, otherwise part of the image will be clipped off if it is too tall, or a gap will be left at the bottom of the page if it is too wide.