2

I'm attempting to add my company logo to a visual force page, which is then being rendered as a pdf, but have not been successful

Logo.zip is a static ressource images.jpg is the logo within the zip file

<DIV TYPE="HEADER">
    <P ALIGN="RIGHT" STYLE="margin-bottom: 0.45in; line-height: 100%">
        <apex:image url="{!URLFOR($Resource.Logo,'images.jpg')}"  WIDTH="113" HEIGHT="65" />
    </P>
</DIV>

Any idea?

5
  • 1
    I usually use something like <img src="{!URLFOR($Resource.Logo,'images.jpg')}" WIDTH="113" HEIGHT="65" /> and have this working in pdf docs. Could it be a problem with your <P> style? Apr 17, 2014 at 9:20
  • I put it outside <P> style, No change!
    – LoveLace
    Apr 17, 2014 at 9:24
  • 1
    Did you check the image url carefully? if it's just one image try putting <apex:image id="logo1" url="{!$Resource.imglogo}"/> where imglogo should direclty your file.
    – highfive
    Apr 17, 2014 at 9:25
  • Yes right! that's what I've told myself too !! And yes its showing up now, thank you @highfive
    – LoveLace
    Apr 17, 2014 at 9:35
  • Yep with pleasure :)
    – LoveLace
    Apr 17, 2014 at 10:40

2 Answers 2

2

When using URLFOR($Resource.Logo,'images.jpg') be careful to put the correct image url. In my opinion if you have only one file, it's better to directly add a static resource to that and set the path as below.

<apex:image id="logo1" url="{!$Resource.imglogo}"/>
0

Here's a version I have that works for me.

<apex:page  showHeader="false" renderas="pdf" applyHtmlTag="false" standardStylesheets="false">
<html>
<head>
<style>
@page
{
    size: A4 landscape;
    padding-top:80px;
    margin-bottom: 20px;
    margin-top: 20px;

    @bottom-center
    {
        font-family:Arial, Helvetica, sans-serif;
        content: "Page " counter(page);
        font-size: 10pt;
    }
    @top-left{
        content: element(pageHeader);
    }
}

#pageHeader{
    position:running(pageHeader);
    display: block;
    text-align:left;
    width:100%;
    padding-top:20px;
    padding-right:20px;
}
body{
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 10pt;
    padding:30px;


}

</style>
</head>
<body>

<div id="pageHeader">
    <img src="{!URLFOR($Resource.Logo)}" width="100px;"/>
</div>


</body>
</html>
</apex:page>

Does the image show up correctly in an html rendered page? change renderAs to html to check.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .