import { LightningElement, track, wire,api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; export default class lexPreviewPDF extends LightningElement { @api recordId; IsLoading=true; @wire(CurrentPageReference) getStateParameters(currentPageReference){ if(currentPageReference){ const IdValue=currentPageReference.state.recordId; if(IdValue){ let str=`${IdValue}`; this.recordId=str; } } } connectedCallback(){ this.PreviewPDF().then(res=>{ this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }); } async PreviewPDF(){ window.open("/apex/ContentPreview?id="+this.recordId, "_blank"); } }