Forum How do I...?

Page formatting help

parisi
I have the following code:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PDF Page</title>
<style type="text/css">
@page {
size: 450px 750px landscape;
margin: 0px;
}
</style>
</head>
<body style="margin: 0px;">
<table cellspacing="0" cellpadding="0" border="1">
<tbody>
<tr>
<td valign="top"><p><img width="450px" alt="ImageName" src="http://upload.wikimedia.org/wikipedia/commons/6/6c/Greenfield_California.JPG"></p></td>
<td valign="top"><table width="300px" border="0">
<tbody>
<tr>
<td valign="top" style="margin-top: 20 px;"><p></p>
<p> Text to dispaly</p>
<p></p></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</body>
</html>


What gets created is a PDF with a white margin across the whole the top edge and a page that is not the full width, so the right cell gets cut off.

What am I missing?

Thanks,
Paul.
  1. 19f3cd308f1455b3fa09a282e0d496f4(3).jpg136.7 kB
    Image of PDF

Edited by parisi

dauwhe
Try setting the image width to "450" rather than "450px". The width attribute value should be an integer.
parisi
I just tried that and I have attached a copy of the PDF. Still seems to not size the image as the HTML designates. Also, I changed the margin to 0 and now I have margins on both top and bottom.
  1. 19f3cd308f1455b3fa09a282e0d496f4(4).pdf39.5 kB
    Example
parisi
I found the top and bottom margin were being caused because I had wrapped the image in <p></p>

But I have discovered t that PXML is not resizing the image as one would expect.

I changed the image to read:

<img width="450px" height="100px" alt="ImageName" src="http://upload.wikimedia.org/wikipedia/commons/6/6c/Greenfield_California.JPG">

This displays fine in HTML but the image comes through at full size.

How do you size an image with PXML?
mikeday
Specify width="450" height="100", or style="width: 450px; height: 100px".