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;"/>

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.

1 Answer 1


I think applyHtmlTag="false" and applyBodyTag="false" should be there as apex:page attributes to open the page in pdf.

  • I tried the same. Doesn't work.
    – Ramy
    Nov 11, 2018 at 21:46

You must log in to answer this question.

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