function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amit BangadAmit Bangad 

Email Attachment (VF Template) rendered as PDF border Issues

Hi All,

I have been fighting this problem from the past 8 hours now :( .I have created an Email Template(Visualforce) and generated an email attachment PDF using an apex:component something like :

<messaging:emailTemplate subject="Invoice {!relatedTo.Inv__c}" recipientType="Contact" relatedToType="kognoz1__Invoice2__c" replyTo="noreply@abc.com">
<messaging:htmlEmailBody >  
    <html>
        <body>
            <c:StandardInvoiceTemplate/>
        </body>
        <BR/><BR/>
    </html>
</messaging:htmlEmailBody>
<messaging:attachment renderAs="PDF" filename="Invoice {!relatedTo.Inv__c}"> 
<c:StandardInvoiceTemplate/>
</messaging:attachment>   
<messaging:plainTextEmailBody >
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

SO you can see both body and attachment are same for testing purpose, my plan is to clear the body later.

In the component I have applied style for a table and its <tr> like :

.pageBlockCss {
        border-collapse:collapse;
        border-width: 1px;
        border-color: black;
        border-style:solid;
    }
    .pageBlockCss tr{
        border-width: 1px;
        border-color: black;
        border-style:solid;
        
    }

Issue is : when I send I preview it, in the browser preview the borders appear just fine but in the PDF ands email body that comes to me, the borders just wipe out.

When I remove border-collapse:collapse; table borders are restored but the tr borders still dont appear.

I found couple of post to include style tag in head tag. I tried all but in vain !!

What is that I am missing here?

thanks,
Amit
Prady01Prady01
Hey Hi Amit, I also had faced similar kind of problem, Not the same, I mean similar, The rendering was not good in email anyhow, Could you try this with inline CSS.

Hope this helps!
Prady
Amit BangadAmit Bangad
Hi Prady, I had tried inline CC before and even now. Still the same issue. border-collapse:collapse; ?is messing things up. What I dont understand is it shows perfect in preview but breaks in actual email body and the PDF attachment. Any other work-around you can think of? thanks, Amit