0

Component :

    <aura:component implements="force:lightningQuickAction,force:hasRecordId" controller="Quote_Preview_LE">
    <style>
      .forceChatterLightComponent .bodyWrapper{height:0%;width:0%;padding:0;box-sizing:border-box}
      .slds-modal__close{height:0%;width:0;padding:0;display:none;}
     </style>
     <aura:attribute name="ProfileId" type="String"/>
     <aura:handler name="init" action="{!c.CheckPreview}" value="{!this}" />
    <aura:attribute name="quo" type="Quote__c" default="{'sobjectType': 'Quote__c'}" />
</aura:component>

controller :

({
    CheckPreview : function(component, event, helper){
            var qid=component.get("v.recordId");   
            //alert(qid);
            var action = component.get("c.getquoteid");
            action.setParams({ "recordId" : qid });          
            action.setCallback(this, function(a) {
            parent.location.href =parent.location.href; 
            window.open("/apex/QuotePreview?id="+qid,"_blank");    
        });
        $A.get("e.force:closeQuickAction").fire()
            $A.enqueueAction(action);
    }
})

quote preview is a pdf page. It is opening in classic and lightning desktop.

1

This knowledge article Open a PDF with Salesforce for Android and iOS app says:

Opening Dynamically Generated PDFs

If you're trying to dynamically build and display your PDF file, you will want to generate and save this file via your controller then navigate to the new ID accordingly. Generating and saving it on the server side, will eliminate conflicts noticed with the webview incorrectly handling content types across different platforms, or other rendering related issues that may occur. With this approach and navigating to the file directly, it should provide a more consistent user experience in our supported mobile environments.

NOTE: Salesforce Support cannot offer assistance in building out the functionality to dynamically generate PDFs, but we are able to assist if there is a specific error observed when attempting to render the dynamically generated PDFs.

plus using the e.force:navigateToSObject event to open the PDF.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.