This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Print PDF with no left margins

Odelya wrote on 2011-11-10:
Hi!

In the attached PDF you can see there is a left margin.

Is there a way to create it with no left margin?

My code is:

fileStream = new FileOutputStream("C:\\PDFCrowd.pdf");
client.setVerticalMargin(0);
client.setHorizontalMargin(0);
client.setPageHeight(-1);
client.setPageWidth(-1);
client.convertHtml("<h2>Norwegian Mountain Trip</h2><img border='0' src='http://yingquan.files.wordpress.com/2008/05/216-the-feeling-is-good.jpg' alt='Pulpit rock' width='304' height='228' /><h2>Forever young</h2>", fileStream);
fileStream.close();
support wrote on 2011-11-10:
Hi,

the trick is to set the body's margin to 0:

<body style="margin:0">

<h2>Norwegian Mountain Trip</h2>
<img border='0' 
        src='http://yingquan.files.wordpress.com/2008/05/216-the-feeling-is-good.jpg' 
        alt='Pulpit rock' 
        width='304' height='228' />
<h2>Forever young</h2>

</body>