You need to sign in to do that
Don't have an account?
Reduce Margins on Render As PDF
I have a Visualforce page rendering as PDF. I have two problems:
1) One of the pages has text that fits completely on the page, but for whatever reason the page wraps to a new blank page. How can I make the pdf stop after that last element.
<table width="100%" cellspacing="0" cellpadding="0" class="signaturebox1">
<tr>
<td colspan="2" width="46%" class="signatureheading1">
Authorized Agent for LetterLogic, Inc.:<br /><br />
</td>
<td> </td>
<td colspan="2" width="46%" class="signatureheading1">
Authorized Agent for {!opportunity.account.name}:<br /><br />
</td>
</tr>
<tr>
<td class="signatureline1">Signature<br /><br /></td>
<td class="signatureline1">Date<br /><br /></td>
<td> </td>
<td class="signatureline1">Signature<br /><br /></td>
<td class="signatureline1">Date<br /><br /></td>
</tr>
<tr>
<td class="signatureline1bot">Name</td>
<td class="signatureline1bot">Title</td>
<td> </td>
<td class="signatureline1bot">Name</td>
<td class="signatureline1bot">Title</td>
</tr>
</table>
</apex:page>
2) I would like to reduce the margins of at least that page to be more like 0.25 inches or 0.50 inches. Seems like the default is 0.75 inches. The PDF is cutting off the text.
Thank you!
Hello Blake;
I am not very much clear about your first question. However you can change the page margin by adding following part at the top of your page.
If I have correctly understood your first question, it also would be fixed by changing the page margin.
<apex:page renderAs="pdf" standardController="Opportunity">
<head>
<style>
@page{
margin:0.25in;
}
</style>
</head>
Thanks prageeth! This is exactly what I needed.
Hi Blake,
There is a great resource on setting PDF document properties at: www.antennahouse.com/CSSInfo/CSS-Page-Tutorial-en.pdf. Download the PDF and use it as a reference. It really helped me when I had to render a visualforce page as a PDF on A4 paper size.
Thanks so much for posting the link to that guide, Blake. It is really helpful!
body { box-sizing: border-box; height: 11in; margin: 0 auto; overflow: hidden; padding: 0.5in; width: 8.5in; }
here i am using width and height with auto value.