You need to sign in to do that
Don't have an account?
Naming the pdf file controller is fine in Sandbox but not working in production
Hello, Good afternoon.
anyone cound help me please. My code is below
public class Tsuchisho_Name {
public Lead ld {get; set;}
public Tsuchisho_Name(ApexPages.StandardController stdController){
ld = new Lead();
ld = (Lead)stdController.getRecord();
ld = [SELECT Id, Name FROM Lead LIMIT 1];
String pdfName = ld.Name + '.pdf';
Apexpages.currentPage().getHeaders().put( 'content-disposition', 'inline; filename=' + pdfName);
}
}
and TestClass is
@isTest
public class TsuchishoNameTest {
@isTest
static void Tsuchisho_Name(){
Lead l = new Lead();
l.FirstName = 'leadname';
l.LastName = 'lastName';
l.AnnualIncomePresentationAmount__c = 1000;
l.DateOfAcceptance__c = system.today();
l.Notice_Date__c = system.today();
l.Company = 'next';
insert l;
ApexPages.StandardController stdController = new ApexPages.StandardController(new Lead());
Tsuchisho_Name tsuchi = new Tsuchisho_Name(stdController);
Test.startTest();
tsuchi.ld = l;
Lead led = tsuchi.ld;
String Name = led.Name;
Test.stopTest();
}
}
With regards Rai
Thank you
What is the error and at which line?
Thanks!
Using above controller I can set a dynamic filename of PDF(Visualforce page). but only Japanese characters are not shown
e.g. when PDF file name is 'あああ'
Myhdfs Account Login (https://www.myhdfs.net/)