+ Start a Discussion
Shruti VishShruti Vish 

I want to open pdf document in lightning component

I want to open the pdf in lightning component how it can be done please help me out for this 
Bhavya Jain 17Bhavya Jain 17
Hi Shradha ,

I don't think its feasible. Also please give a brief about what you are trying to achieve. May be i will be able to resolve.

Thanks & Regards 

Bhavya Jain
Shruti VishShruti Vish
I have created the lightning component where i have button on click of that i am tring to download file which is stored in document in one folder below is my code

public class DownloadAttachment {
 public static string DownloadAttachmentMethod(Id DownloadAttachmentID)
   Document documents = [SELECT Id, FolderId, Folder.Name FROM Document WHERE Folder.Name like 'SharedDocuments%' LIMIT 1];  
    System.Debug('Document Id :'+ documents.Id);
    String fullFileURL = URL.getSalesforceBaseUrl().toExternalForm();
    String URlDownload = fullFileURL+'/sfc/servlet.shepherd/version/download/'+documents.Id;
    system.debug('Download URL:' +URlDownload);
    return URlDownload;
<aura:component controller="DownloadAttachment" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="Document" type="String" />

<a href="" data-id="01528000003UFIUAA4"  onclick = "{!c.downloadfile}" >Download</a>    

    downloadfile : function (component, event, helper){                 
    var id = event.target.getAttribute("data-id");       
    alert('Document ID:' +id);
    var actiondownload = component.get("c.DownloadAttachmentMethod");

        "DownloadAttachmentID": id

      actiondownload.setCallback(this, function(b){
        component.set("v.Document", b.getReturnValue());
        var urlEvent = $A.get("e.force:navigateToURL");
      "url": b.getReturnValue()
rishabh rathor 18rishabh rathor 18
whta is  :- data-id="01528000003UFIUAA4 ?