I need to view/generate PDF in Lightning component. How can I achieve that?
Do I have to user VF page with “renderAs” attribute inside Lightning Component? Or is there any other way to achieve this?
Answer
There are two methods to show a PDF in Lightning Component
.
-
First, you can create a
Visualforce page
and embed it in the
Lightning component
. See detailed example here -
Second is, usage of
PDF.JS
library to directly uselightning component
to display thePDF
. See details here .Entire source
code can be found here.
Let me know if this helps!
Attribution
Source : Link , Question Author : user36778 , Answer Author : Hemant Jain