0

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.

0

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 '18 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.