I want to open case details in PDF view when clicking on custom button in Lightning. I have a custom button(added it to standard layout) with Content Source Visualforce Page.
Below is my VF Code:
<apex:page StandardController="Case" extensions="ConvertToPDF" renderAs="pdf" applyHtmlTag="true" applyBodyTag="true" sideBar="false">
<apex:includeLightning />
<apex:outputtext value="{!CaseURL}" escape="false" style="position: absolute;top: 0;"/>
</apex:page>
In My controller:
String Id = ApexPages.currentPage().getParameters().get('Id');
String URL = '/'+Id;
return (new PageReference(URL).getContent().toString());
I am able to open new tab but the PDF is rendered as Blank.