Skip to main content
2 of 2
added 160 characters in body
glls
  • 20.3k
  • 19
  • 49
  • 83

Lightning component button not working

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}" />
</aura:component>

My VF page

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

@page{
    size: letter;
    margin:10%;
    @top-left{
        content: "Dear,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 12px;
    }
    @bottom-right{
        content: "Yours Sincerely,";
        font-family: Helvetica, Arial, sans-serif;
        font-size: 10px;
    }
}

body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 11px;
}
    </style>
</head>
    <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>
<center>
    <h1> Letter</h1>
    </center>
    <p>{!custom_object__C.Name__C}</p>    
</apex:page>

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

sf123
  • 37
  • 1
  • 11