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
CARBCARB 

Visualforce e-mail template, PDF attached is resizing the image (dynamic url)

I have a visualforce e-mail template quote with the logo on it. Before I had a logo uploaded in the documents and I was inserting the link from the document for my PDF attached quote. Like this:

<img src="http://url-to-the-image" alt="Name" style="width:100%; max-width:150px; color:#767676; font-size:30px; font-weight:bold;" />
EVERYTHING was fine.

Now we are using the same quote for different companies. Based on the company the logo is changing. For this I created a field in Opportunity "Logo" with a picklist. In the picklist I have links to URL from the documents for these images. 

<apex:image url="{!relatedTo.Logo__c}" style="width:100%; max-width:150px; color:#767676; font-size:30px; font-weight:bold;"/>
 

Here is part of my code:

<messaging:attachment renderAs="pdf" filename="{!relatedTo.name}">
        <html>

        <head>
            <meta charset="utf-8" />
            <title>DEVIS</title>
        </head>

        <body>
            <div style="max-width:950px;         margin:auto;                  font-size:14px;         line-height:20px;         font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;">
                <br/>
                <table cellpadding="0" cellspacing="0" style="width:100%; line-height:inherit; padding-bottom:5px;">
                    <tr>
                        <td style="padding:5px; vertical-align:top;">
                            <a href="http://{!relatedTo.Company_link_for_website__c}" style="text-decoration: none;" target="_blank">
                                <apex:image url="{!relatedTo.Logo__c}" style="width:100%; max-width:150px; color:#767676; font-size:30px; font-weight:bold;"/>
                            </a>
                            <br/>
                        </td>
 


...............

 

So, the issue it:

When I send the quote the image is inserting correctly. HTML letter is showing the correct logo with a correct size as it is stated in html code. But when I open PDF attached I see a little image (logo) with the dimensions of 10px - 10 px. I cannot get it why is it changing the size. What I tried:

1. I tried to make the code without <apex:

<img src="{!relatedTo.Logo__c}" alt="{!relatedTo.Genre__c}" style="width:100%; max-width:150px; color:#767676; font-size:30px; font-weight:bold;" />

2. I tried to remove : width:100%;

3. I tried to write the size without the "px" : max-width:150;

4. I tried to remove this: width:100%; max-width:150px;      and to put instead: width: 100; height: 100;
5. To remove  font-size:30px;

I always see my logo like that (little blue line on the left)

Little blue line on the left is my logo

What am I doing wrong?

When I use the hard-core URL to the image, it works fine:

<img src="http://url-to-the-image" alt="Name" style="width:100%; max-width:150px; color:#767676; font-size:30px; font-weight:bold;" />