Category / Section
How to use the custom service URL to load a PDF document in PDF viewer
1 min read
PDF viewer Angular component supports loading the PDF document from the custom service URL. To do this, run the Web API service first, then that URL should be provided to the serviceURL property of the PDF viewer control in Typescript file. Refer to the following code sample.
HTML
<ej-pdfviewer [(serviceUrl)]="service" id="pdfviewer1" style="width:100%;min-height:600px;display:block" > </ej-pdfviewer>
Typescript
import { Component } from '@angular/core'; @Component({ selector: 'ej-app', templateUrl: './pdfviewer.component.html' }) export class PdfViewerComponent { service: string; constructor() { //Provide your hosted Web service Url in ‘this.service’ this.service = ‘XYZ’; } }
Refer to the following sample.
PDF viewer control: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PDF_Viewer-1134533272
Note:
- You can also customize the action method in the server using the serverActionSettings API.
- The serviceURL should be provided to map the Web API controller class and not to the load method in the controller.