You need to sign in to do that
Don't have an account?
Kelsey Duncan
logo on Visualforce PDF
Hello,
I am trying to add a logo to the top of a Visualforce PDF. I was originally able to do this using
<center><apex:image url="{!$Resource.PM_Invoice}" width="300" height="150"/></center>
However I now need the logo to show based on the logo on the Customer Account - as we use this PDF to generate orders for 2 clients.
I have created a custom URL field on the Account (Logo_URL__c) and a second field Logo Image with the formula below:
IF(LEN(Logo_URL__c)=0,"", IMAGE(Logo_URL__c,"Company Logo"))
This shows the logo on the accounts.
I have then referenced both these fields in my Apex Class Controller.
I am now struggling to get the logo to show on the invoice - I have tried using many variations of the below
<center><apex:image url="{!accountDetails.Logo_URL__c}" width="300" height="150"/></center>
and each time just have a greyed out box where the logo should show.
Does anyone have any ideas?
Thanks,
Kelsey
I am trying to add a logo to the top of a Visualforce PDF. I was originally able to do this using
<center><apex:image url="{!$Resource.PM_Invoice}" width="300" height="150"/></center>
However I now need the logo to show based on the logo on the Customer Account - as we use this PDF to generate orders for 2 clients.
I have created a custom URL field on the Account (Logo_URL__c) and a second field Logo Image with the formula below:
IF(LEN(Logo_URL__c)=0,"", IMAGE(Logo_URL__c,"Company Logo"))
This shows the logo on the accounts.
I have then referenced both these fields in my Apex Class Controller.
I am now struggling to get the logo to show on the invoice - I have tried using many variations of the below
<center><apex:image url="{!accountDetails.Logo_URL__c}" width="300" height="150"/></center>
and each time just have a greyed out box where the logo should show.
Does anyone have any ideas?
Thanks,
Kelsey
I created a custom text field Privacy_Policy__c which contains generic text 'Please see our Privacy Policy for more details' - the words in bold are then hyperlinked to each of the clients privacy policy.
I have then used the below to include this in the VF PDF and it has worked perfectly - depending on the account the invoice is created for, the hyperlink is different
<apex:outputField value="{!accountDetails.Privacy_Policy__c}" />
I have tried different variations of this for Logo_URL__c and still face the same issue of a grey box
Thanks
Just wanted to know more about the issue , when you remove the renderAs="pdf" attribute does the image show or is it still as broken?
Is it only happening in pdf generation?
You can try just adding the {!accountDetails.Logo_URL__c} field on vf pdf page to check if the formula is returning you url , or not.
Hope this helps.
You can also try changing the attribute to see whether this might be issue of the attribute.
to
Hope this helps.
Thank you for your suggestions! Unfortunately I still couldn't get the image to show on the Invoice.
So I have taken a different approach and created a Text(Rich) custom field on the account called 'Invoice_Logo__c' and inserted the image direct into there.
Then I referenced it similar to my 'Privacy_Policy__c' field and everything is working as it should!! :-)
<center><apex:outputField value="{!accountDetails.Invoice_Logo__c}" /></center>
Thanks again for your help.
Kelsey
You'd need to store the image as a static resource and then reference the resource in your VF page. To access the static resources:
>Setup>Develop>Static Resources
Note that the Cache needs to be set to Public
Once you've placed the static resource you can then use your html markup to reference the image:
Example-> Static Resource's name = Test_Image
<img src="{!$Resource.Test_Image}"></img>
Should do the trick!