Image not getting displayed in PDF though I tried doing this.Can Anyone Please correct me what is wrong? I tried using it both in div.header and in @page.Both doesn't work fine?
Visualforce:
<apex:page standardController="Opportunity" extensions="testpportunity1" showHeader="false" sidebar="false" docType="html-5.0" applyBodyTag="false" applyHtmlTag="false" renderAs="PDF">
<html lang="en-us" dir="ltr">
<head>
<style type="text/css" media="print">
@page {
@bottom-center {
content: "Page " counter(page) " of " counter(pages);
}
div.header{
position:running(header);
}
}
</style>
</head>
<body>
</body>
</html>
<div class="header">
<img src="{!$Resource.IconSample}" width="25%" />
</div>
<!--<apex:image url="{!$Resource.IconSample}" width="220" height="150" />-->
<br/>
<apex:outputText style="text-align:left; width : 100%;font-size: 16px;" value="Address"></apex:outputText><br/>
<apex:outputText style="text-align:left; width : 100%;font-size: 16px; " value="Street"></apex:outputText><br/>
<apex:outputText style="text-align:left; width : 100%;font-size: 16px; " value="City"></apex:outputText><br/>
<apex:form >
<apex:pageBlock >
<table>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
</table>
<apex:pageblocksection columns="1" title=" Opportunity Information">
<table width="100%" style="font-family: Arial, Helvetica, sans-serif;">
<apex:repeat value="{!oppList}" var="opp">
<tr>
<tr>
<td align="right" style="color: #808080;">
OpportunityOwner
</td>
<td>
{!opp.Owner.Name}
</td>
<td align="right" style="color: #808080;">
OpportunityName
</td>
<td>
{!opp.Name}
</td>
</tr>
<tr>
<td align="right" style="color: #808080; ">
Account Name
</td>
<td>
{!opp.Account.Name}
</td>
<td align="right" style="color: #808080;">
Type
</td>
<td>
{!opp.Type}
</td>
</tr>
<tr>
<td align="right" style="color: #808080; ">
StageManagement
</td>
<td>
{!opp.Stage_Management__c}
</td>
<td align="right" style="color: #808080; ">
Stage
</td>
<td>
{!opp.StageName}
</td>
</tr>
<tr>
<td align="right" style="color: #808080; ">
CloseDate
</td>
<td>
{!opp.CloseDate}
</td>
<td align="right" style="color: #808080; ">
Probability
</td>
<td>
{!opp.Probability}
</td>
</tr>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
</apex:repeat>
</table>
</apex:pageblocksection>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageblocksection columns="1" title=" Product Details">
<table width="800px" height="1200px" >
<apex:variable value="{!1}" var="i"/>
<tr style="background-color:{!IF(mod(i,2)==0, ' #C0C0C0', '#C0C0C0')};">
<th>Product Name</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total Price</th>
</tr>
<apex:variable value="{!i+1}" var="i" />
<apex:variable value="{!1}" var="i"/>
<apex:repeat value="{!prodList }" var="prod">
<tr style="background-color:{!IF(mod(i,2)==0, ' #C0C0C0', '#C0C0C0')};">
<td>{!prod.pricebookentry.product2.name}</td>
<td> {!prod.quantity}</td>
<td> {!prod.quantity}</td>
<td> {!prod.TotalPrice}</td>
</tr>
<apex:variable value="{!i+1}" var="i" />
</apex:repeat>
</table>
</apex:pageblocksection>
</apex:pageBlock>
<style>
</style>
</apex:form>
<apex:outputText >xyz</apex:outputText><br/><br/>
<apex:outputText value="order:" style="text-align:center; width : 100%;font-size: 16px; font-weight: bold ; color :#000000"> </apex:outputText> <apex:outputText >Salsforce</apex:outputText><br/>
<apex:outputText > Visualforce</apex:outputText><br/>
<br/><apex:outputText style="text-align:left;font-weight: bold;" value="Best Regards,"></apex:outputText><br/>
<br/><div style="text-align:center;font-size: 15px;">
<apex:outputText style="text-align:center;font-weight:bold;" value="Thank you"></apex:outputText></div>
<br/><br/><div style="text-align:center;font-size: 25px;">
<apex:outputText style="text-align:center;font-weight:bold;" value="SALESFORCE"></apex:outputText></div>
<p class="par">
This is Opportunity page.
</p>
</apex:page>
Controller:
public class testpportunity1{
public List <Opportunity> oppList{get;set;}
public List <OpportunityLineItem> prodList{get;set;}
public user cuser{get;set;}
public testpportunity1(ApexPages.StandardController controller) {
oppList = new List <Opportunity>();
oppList = [SELECT name, owner.name,Account.Name, stagename, amount,ExpectedRevenue,NextStep,LeadSource,Probability, CloseDate,Type,Stage_Management__c
FROM Opportunity
WHERE id = '789456123'];
System.debug('opportunity list------->'+oppList);
prodList =new List <OpportunityLineItem>();
prodList = [SELECT PricebookEntry.Product2.Name, quantity, unitprice, totalprice
FROM OpportunityLineItem
WHERE OpportunityID='789456123'];
cuser=[select id,Username,Signature__c from user where id=:UserInfo.getUserId()];
System.debug('User list------->'+cuser);
}
}