Below is my controller
public class MyController {
public Letter__C letter{get;set;}
public String isPDF { get; set; }
public Boolean bolPrintableView {get;set;}
public MyController(){
letter = [SELECT Id,Name__c
WHERE Id = :ApexPages.currentPage().getParameters().get('Id') LIMIT 1];
IF(letter != null && obj.Status__c == 'Approved'){
isPDF = 'pdf';
}else{
isPDF = 'html';
}
}
public void init() {
String strPrintableView =
ApexPages.currentPage().getParameters().get('print');
bolPrintableView = (strPrintableView == '1');
}
}
VF Page:
<apex:page controller="MyController" renderAs="{!isPDF}" applyBodyTag="false" >
<head>
<style>
body { font-family: 'Arial Unicode MS'; }
@page{
size: letter;
margin:20%;
@top-center{
content: "TTD Letter";
font-family: Helvetica, Arial, sans-serif;
font-size: 24px;
font-weight: bolder;
}
@bottom-right{
content: "Yours Sincerely,";
font-family: Helvetica, Arial, sans-serif;
font-size: 10px;
}
}
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
}
</style>
</head>
<div align="right"><strong>Date</strong>: {!DAY(Today())} {!CASE(MONTH(Today()), 1, 'January', 2, 'February', 3, 'March', 4, 'April', 5, 'May', 6, 'June', 7, 'July', 8, 'August', 9, 'September', 10, 'October', 11, 'November', 12, 'December', 'Unknown')} {!YEAR(Today())}</div>
<div align="left">Dear,</div>
<p>My Text</p>
<p>My Text</p>
</apex:page>
When I have clicked on my PDF button I got the printable view of the current page but not of my PDF.
{!isPDF}
from therenderAs
attribute with justpdf
?