Articles in this section
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.

Web API: http://www.syncfusion.com/downloads/support/directtrac/general/ze/WebAPI_service830758858https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebAPI_service830758858

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.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied