+ Start a Discussion
acrozieracrozier 

When changing from ContentType="application/msword" to renderAs="pdf" document does not open.

Hello,

 

I have a page that I am trying to get to renderAs PDF, but the page never loads.  When I use application/msword the document can be opened and everything appears to work.  Does someone see anything in the code below that would bomb out a PDF?

 

<apex:page standardController="Job__c" extensions="AdvIncentEXT,Incent" showHeader="false" renderAs="pdf"> 
<head>
<style type="text/css">
table 
    {
    page-break-inside: avoid;
    }
</style>
</head>
<center>

<body>
         <table align="center" style="font-face: arial sans-sarif; font-size:16px;">

         <tr>
            <td>
                <center><img src="http://www.schlesingerassociates.com/logos/logosmall.jpg"/></center>
            </td>
         </tr> 
        
        <tr align="center">
            <td>
                <u>Advance Incentive Invoice</u>
                
            </td>
        </tr>
        
       </table>
    
       
<br />
<br />
        <table style="font-family: Calibri, sans-serif; font-size: 12px" align="center" width="100%">
        
        <tr>
        
            <td width="10%">
                <strong>BILL TO:</strong>
            </td>
            <td width="35%">
                {!Job__c.Contact__r.MailingStreet}<br />
                {!Job__c.Contact__r.MailingCity},{!Job__c.Contact__r.MailingState},{!Job__c.Contact__r.MailingPostalCode}
            </td>
            <td width="50%">
                <table style="font-family: Calibri, sans-serif; font-size: 12px" border="1" width="100%">
                
                    <tr>
                        <td width="35%">
                            <strong>Invoice #</strong>        
                        </td>
                        <td width="65%">
                        
                        </td>
                    </tr>
                    <tr>
                        <td width="35%">
                            <strong>Invoice Date</strong>           
                        </td>
                        <td width="65%">
                        
                        </td>
                    </tr>
                    <tr>
                        <td width="35%">
                            <strong>PO #</strong>          
                        </td>
                        <td width="65%">
                        
                        </td>
                    </tr>
                    
                </table>
             </td>
        </tr>
        
        
        </table>


        <table style="font-family: Calibri, sans-serif; font-size: 12px" border="1" align="center" width="100%">

        <tr>
        
            <td bgcolor="#a0cf69">
                <strong>Research Date(s)</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Client Project #</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Project #</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Location</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Terms</strong>
            </td>
            <td bgcolor="#a0cf69">
                <strong>Tax ID</strong>
            </td>
          
        </tr>
        <tr height="50%">
        
            <td>
                <apex:dataTable style="font-family: Calibri, sans-serif; font-size: 12px" value="{!Job__c}" var="j" cellpadding="4" rowClasses="odd,even">
    
               		<apex:column >
                   		<apex:outputtext value="{0,date,MM/dd/yyyy}">
                        	<apex:param value="{!j.Job_Start_Date__c}" />
                   		</apex:outputtext>
 -                 
                   		<apex:outputtext value="{0,date,MM/dd/yyyy}">
                        	<apex:param value="{!j.Job_End_Date__c}" />
                   		</apex:outputtext>
               		</apex:column>
            
    			</apex:dataTable>    

            </td>
            <td>
                {!Job__c.Client_Ref__c} 
            </td>
            <td>
                {!Job__c.Name}    
            </td>
            <td>
                {!Job__c.Other_Location__c}   
            </td>
            <td>
                   
            </td>
            <td>
                    
            </td>
            
            
        </tr>
            
    
    </table>

<br />

    <apex:dataTable Value="{!Incents}" Var="I">
        <apex:column headerValue="QTY">
            <apex:outputField value="{!I.QTY__c}"/>
        </apex:column>
        <apex:column headerValue="Description">
            <apex:outputField value="{!I.Description__c}"/>
        </apex:column>
        <apex:column headerValue="Honoraria">
            <apex:outputField value="{!I.Honoraria__c}"/>
        </apex:column>
    </apex:dataTable> 
    
    
    
<br />
<br />
    <table align="center" style="font-family: Calibri, sans-serif; font-size: 12px" width="100%">
    
        <tr>
            <td align="center">
                {!LocAddr}<br />
                <strong>Phone:</strong> {!LocPhone} <strong>Fax:</strong> {!LocFax} <strong>Toll Free</strong> {!LocTollFree} <strong>E-Mail</strong> {!UserEmail}
                 <a href="http://www.schlesingerassociates.com">http://www.SchlesingerAssociates.com</a>
            </td>                
        </tr>
       
    </table> 
    
    <table align="center" style="font-family: Calibri, sans-serif; font-style: italic; font-size: 12px" border="1" width="100%"> 
    
        <tr>
            <td align="center">
               <img src="http://www.schlesingerassociates.com/logos/cc.jpg" /><br />If paying by credit card a 4% service charge is added to the balance.  If you wish to pay via credit card, please contact Anna Schultz at 732-906-1122 or vis e-mail at anna@schlesingerassociates.com for a Credit Card Authorization Form.                       
            </td>
            
        </tr>    
      
        <tr>
            <td>
               <center>
                www.SchlesingerAssociates.com  Toll free in the US: 866-549-3500<br></br>
                US:  Atlanta  Boston  Chicago/Downtown  Chicago/O Hare  Dallas  Houston  Los Angeles  New Jersey  New York  Orlando  Philadelphia/Center City  Philadelphia/Bala
                Cynwyd  Phoenix  San Francisco<br></br>
                UK:  Central London  Wimbledon
               </center>
            </td>
        </tr>
          
    </table>
    
    <table align="center">
        
        <tr>
            <td>
                - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
            </td>
        </tr>
        <tr>
            <td>
                
            </td>
        </tr>
        
    </table>
    
    <center style="font-family: Calibri, sans-serif; font-size: 12px"><strong>REMITTANCE</strong> - PLEASE SEND TO THE ADDRESS ABOVE:</center>
    
    <table style="font-family: Calibri, sans-serif; font-size: 12px" align="center" border="1" width="80%">
    
        <tr>
            <td>
                <strong>Invoice #</strong>
            </td>
            <td>
                - Please include this number on your check.
            </td>
        </tr>
        <tr>
            <td>
               <strong>Client</strong>
            </td>
            <td>
                {!Job__c.Account__c}
            </td>
        </tr>
        <tr>
            <td>
                <strong>Date</strong>
            </td>
            <td>
            
            </td>
        </tr>  
        <tr>
            <td>
                <strong>Amount Enclosed</strong>
            </td>
            <td>
            
            </td>
        </tr>
        
    </table>    

           
</body>                 
</center>

</apex:page>

 

Rahul SharmaRahul Sharma

try updating the version of page to latest one if its not.

Ispita_NavatarIspita_Navatar

Hi,                     

  If renderAs PDF does not work when page loads , the issue can be the source code of your page(VF code) , may be assignment of the table is not in a proper hierarchy.Please cross check the visual force code, I have worked a lot in renderAs pdf , this issue comes when there are issues in HTML code or any syntax error in the source code.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.