Below is my lightning component which calls a VF Page

<aura:component implements="force:lightningQuickAction" >

   <!-- attribute to accept Visualforce page's javascript method -->
   <aura:attribute name="TTDLetter" type="object"/>

   <!-- Button component to invoke PDF download -->
   <lightning:button label="PDF" 
        onclick="{!c.PDF}" />

My VF page

<apex:page controller="MyController" renderAs="pdf" applyBodyTag="false">
body { font-family: 'Arial Unicode MS'; }

    size: letter;
        content: "Dear,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 12px;
        content: "Yours Sincerely,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 10px;

body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 11px;
    <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>
    <h1> Letter</h1>

For the Lightning component If have created a quick action called "PDF", when I have clicked on PDF button from my object , I got a error stating :

A Component Error has occurred!.

Can anyone just state me where I got my error as i got stuck here

  • normally, there is an actual error message other than "a component error has ocurred" mind sharing it VErbatim? additionally, have you tried anything to troubleshoot? it will help narrow down where you might be getting this error and will help others help you. Additionally, I dont see how your VF page is related to your lightning component
    – glls
    Jul 21, 2018 at 15:03

1 Answer 1


Before creating your lightning component, have you tried creating a new custom button with a 'Visualforce Page' content source ?

Displaying VF pages rendered as PDF via this button works fine for me in LEX.

You will have to make a few changes to your VF Page in order to make it available for your button :

<apex:page controller="MyController" renderAs="pdf" applyBodyTag="false">


<apex:page standardcontroller="yourObjectApiName" extensions="MyController" renderAs="pdf" applyBodyTag="false">

I hope this helps you.

  • yes i have a onclick JS button : window.open("apex/Letter?Id={!_Letter__c.Id}","_blank");
    – sf123
    Jul 21, 2018 at 15:22
  • Where should this button appear ? Onclick JS buttons are not supported in LEX Jul 21, 2018 at 15:28
  • Yes, this button is for Classic as it doesn't support LEX I have written the lightning action n created a quick action "pdf" for that, but it is unable to generate the PDF which was generated through my VF page
    – sf123
    Jul 21, 2018 at 15:33
  • Okay, I understand that you keep your onclick JS button for Classic. Are you trying to access the VF Page to render as a PDF in your component's JS controller ? Jul 21, 2018 at 15:37
  • Yes, I'm trying to do that. But I got stuck with this as I'm unable to find out where I got the mistake. The error message was: Uncaught Unknown controller action 'PDF'
    – sf123
    Jul 21, 2018 at 15:40

You must log in to answer this question.

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