+ Start a Discussion
Shaker Kuncham 1Shaker Kuncham 1 

Getting blank PDF without content (using VF Template )

Original question:
Hi All

I have creaed approval process on custom object where i need to submit a PDF document for approval process. Once I attached the PDF file and submitted for Approval, am geeting email  with PDF, however without content, getting blank PDF.
Below is my code for VF email template. Please suggest....

<messaging:emailTemplate subject="Document Submitted" recipientType="User" relatedToType="Compliance_Documents__c">
<apex:image url="/servlet/servlet.FileDownload?file=015W0000000Dmru"
height="64" width="64"/>
    <messaging:htmlEmailBody >
        <html>
        <img src="http://www.XXXX.com/ucmprdpub/groups/public/documents/logo/logo_png.png"/>
            <body>
            <p>Dear {!recipient.name},</p>
            
            <p>Attached is document related to Compliance Document "{!relatedTo.Compliance_Document_Name__c} ". </p>
            <p>Please Review the document and <B> Approve/Reject.</B> To approve or reject this item, click this link </p>
            <P>
                <apex:outputLink value="https://cs13.salesforce.com/{!relatedTo.id}">
                    Approve / Reject
                </apex:outputLink>
                <Br/><Br/>or <Br/><Br/>
                <B> To Approve through email :</B> reply to this email with one of these words in the first line of the email message: APPROVE, APPROVED.
                <Br/><Br/>
                <B> To Reject :</B> Please click on the above link.
                <Br/><Br/>
                <B>For Comments: </B>
If replying via email, you can also add comments on the second line. Comments will be stored with the approval request in Salesforce CRM.
            </P>
            <br/> <br/>
           <b> Previous approval history </b>

        <c:ApprovalItem recordId="{!relatedTo.Id}" />
         <br/>
          <br/>
        
            Kind Regards, <br/>
            Document Compliance Team
            
            </body>
        </html>
    </messaging:htmlEmailBody>
    
    <messaging:attachment filename="{!relatedTo.name}" renderAs="PDF">
        <apex:repeat var="cx" value="{!relatedTo.id}">
        </apex:repeat> 
    </messaging:attachment>
</messaging:emailTemplate>