How to generate/view PDF using Lightning Components?
There are two methods to show a PDF in Lightning Component
.
First, you can create a
Visualforce page
and embed it in theLightning component
. See detailed example hereSecond 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!
You can embed a vfPage (renderas="pdf") in lightning component and utilize the component in required place.
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
<iframe src="{! '/apex/pdfPage'}" width="100%" height="500px;" frameBorder="0"/>
Hope it helps!