You need to sign in to do that
Don't have an account?
renderas pdf with landscape page is not working
Hi all,
I'm trying to create a pdf with VF page and open it as landscape. I'm NOT rendering it on VF page but in apex method otherwise, my VF page does not convert to pdf. Here's my VF page code:
<apex:page standardController="Expenses__c" extensions="PDFGenerator" renderAs="pdf">
<apex:form >
<apex:pageBlock title="Expense Report">
<apex:repeat var="p" value="{!LI}">
<apex:pageblockSection>
<apex:outputText value="{!p.Name}"/>
<apex:outputText value="{!p.Date_Submitted__c}"/>
</apex:pageblockSection>
<table border='1' style="border-collapse: collapse;">
<apex:repeat var="m" value="{!p.Expense_Line_Items__r}">
<tr > <td> <apex:outputText value="{!m.Name}"/> </td>
<td> <apex:outputText value="{!m.Amount__c}"/> </td>
<td> <apex:outputText value="{!m.Date_of_Expense__c}"/></td>
<td> <apex:outputText value="{!m.Payee__c}"/> </td>
<td> <apex:outputText value="{!m.Contact__c}"/> </td>
<td> <apex:outputText value="{!m.Code__c}"/> </td>
<td> <apex:outputText value="{!m.Office__c}"/> </td>
<td> <apex:outputText value="{!m.Job_Number__c}"/> </td>
</tr>
</apex:repeat>
</Table>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
Here's is the code from Apex method which makes the vforce to pdf. Is there anyway I can make the report to landscape?
body = pdf.getContentaspdf();
you will need add style resource, in your case, add ExpensePDF.CSS with below cose
save above code as .css file, and then upload into your static resource name as "ExpensePDF", and then add the style in your page
All Answers
you will need add style resource, in your case, add ExpensePDF.CSS with below cose
save above code as .css file, and then upload into your static resource name as "ExpensePDF", and then add the style in your page
Thanks that was perfect!