Angular Synfcusion PDF Viewer Custom Service URL (Append "Load" method automatically to end the URL)

Hi,
How do i specify CustomserviceURL to Angular PDF viewer component
Example:
constructor() {
//this.service = 'https://js.syncfusion.com/ejServices/api/PdfViewer';
this.service = 'http://localhost:3000/loadPDF';
}

if i specify this url http://localhost:3000/loadPDF the syncfusion pdf viewer automatically append Load at the end
like below
http://localhost:3000/loadPDF/Load this cause 404 not found error
If anyone has a solution please let me know,
Thanks,
Roshan

1 Reply

KK Karthik Krishnaraj Syncfusion Team September 27, 2018 02:13 PM UTC

Hi Roshan, 

PDF viewer 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() { 
       //If the hosted custom service URL is http://localhost:57971/, then serviceURL should be as follows 
        this.service = 'http://localhost:57971/api/PdfViewer'; 
    } 
} 

Refer to the following samples. 


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. 

Regards, 
Karthik. 


Loader.
Up arrow icon