import { Component, OnInit } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { ModalController, NavParams } from '@ionic/angular'; @Component({ selector: 'app-view-document', templateUrl: './view-document.page.html', styleUrls: ['./view-document.page.scss'], }) export class ViewDocumentPage implements OnInit { url: string; a:string = "https://equilibrium.dyndns.info/FileShare/pdfjs/web/viewer.html?file="; viewerUrl: string; trustedUrl: any; file:any; constructor( private modalController: ModalController, private navParams: NavParams, private sanitazer: DomSanitizer, ) { this.file = this.navParams.get('file'); this.url = this.file.title_link; console.log(this.url); } ngOnInit() { this.viewerUrl = this.url.replace("webTRIX.Viewer.Branch1/pdfjs/web/viewpdf.aspx?file=/webTRIX.Viewer.Branch1/arq/637690403731947760.pdf&i", "FileShare/pdfjs/web/viewer.html?file"); this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(this.viewerUrl); console.log(this.trustedUrl); } close() { this.modalController.dismiss(); } }