I have created a Visualforce PDF and fully tested in Sandbox and looks fine. When deployed to production the formatting is off in one section. Does anyone know what is going on here? I have tried to open PDF in both Edge and Chrome and the production PDF is not wrapping text and is missing a boarder.
This is the page set up / start of code
<apex:page cache="false" extensions="AccEngageClass" renderAs="pdf" standardController="Account" applyBodyTag="false" applyHtmlTag="false" showHeader="false"> <head> <style> @page { size: A4 landscape; } html,body { margin: 0 0 0 0; font-family: 'Arial', sans-serif; font-size: 16px; font-weight: normal; color: black; } .center-table { width: 95%; border: 1px solid #000; border-collapse: collapse; margin-left: 20px; margin-right: 20px; } .center-table th, .center-table td { padding: 8px; border: 1px solid #ddd; text-align: left; } .cell-heading { background-color: #5e5e5e; color: white; } </style> </head> <div style="text-align: center;"><apex:image url="{!URLFOR($Resource.Logo)}" width="150px"/> </div> <h1 style="text-align: center; margin-bottom: 150px;"> </h1> <h1 style="text-align: center; margin-bottom: 20px;">{!Account.Name}</h1> <h1 style="text-align: center; margin-bottom: 20px;">Intermediary Engagement Summary </h1>
This is the section that is missing the right boarder and not wrapping text in Details column:
<p style="page-break-after: always;" ></p> <div style="text-align: center;"> </div> <h2 style="text-align: center; margin-bottom: 20px;">All Related Activities </h2> <apex:outputPanel > <br/> <apex:pageBlock > <apex:dataTable style="-Fs-table-paginate: paginate;text-align: center" value="{!act1}" var="o" border="1" styleClass="print-friendly" width="100%"> <apex:column styleClass="inBorder" > <apex:facet name="header">Assigned</apex:facet> <apex:outputText >{!o.Assigned_2__c}</apex:outputText> </apex:column> <apex:column styleClass="inBorder" > <apex:facet name="header">Contact</apex:facet> <apex:outputText >{!o.Who.name}</apex:outputText> </apex:column> <apex:column styleClass="inBorder" > <apex:facet name="header">Activity Date</apex:facet> <apex:outputText value="{0,date,dd/MM/yyyy}"> <apex:param value="{!o.ActivityDate}"/></apex:outputText> </apex:column> <apex:column styleClass="inBorder" > <apex:facet name="header">Subject</apex:facet> <apex:outputText >{!o.Subject}</apex:outputText> </apex:column> <apex:column styleClass="inBorder" > <apex:facet name="header">Description</apex:facet> <apex:outputText >{!o.Description}</apex:outputText> </apex:column> </apex:dataTable> </apex:pageBlock> </apex:outputPanel>
#Salesforce Developer
Could you please try the following approach:
<apex:page renderAs="pdf" showHeader="false" standardController="Your_Object__c">
<style type="text/css">
table.center-table {
width: 100%;
border-collapse: collapse;
-fs-table-paginate: paginate;
}
table.center-table th, table.center-table td {
border: 1px solid #ddd;
padding: 4px;
text-align: center;
vertical-align: top;
}
.desc-col {
text-align: left !important;
white-space: normal !important;
}
</style>
<apex:outputPanel layout="block">
<apex:dataTable value="{!records}" var="rec" styleClass="center-table">
<apex:column headerValue="Name">
<apex:outputText value="{!rec.Name}"/>
</apex:column>
<apex:column headerValue="Description" styleClass="desc-col">
<apex:outputText value="{!rec.Description__c}"/>
</apex:column>
</apex:dataTable>
</apex:outputPanel>
</apex:page>
For more details, please refer to:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_output_pdf_renderas.htmThanks!