How to generate/view PDF using Lightning Components?

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?


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 use lightning component to display the PDF. See details here .Entire source
    code can be found here.

Let me know if this helps!

Source : Link , Question Author : user36778 , Answer Author : Hemant Jain

Leave a Comment