Basic idea of implementing webviewer server

WebViewer Version:10.0.1

I wanted to try implementing the webviewer server. But I am not able to load the pdf file. And also i m not sure if it make use of the webviewer server.

Please correct me where I have done wrong in following implementation. Below are the steps I followed.

  1. I have run the docker container of the pdftron web viewer server image. and its url is ‘http:localhost:8090’.

  2. I m using the angular for front end. And I have initialized the webviewer constructor as
    WebViewer({
    path: ‘…/assets/lib’,
    webviewerServerURL:‘http://localhost:8090/’,
    //fullAPI: true,
    disabledElements: [
    ‘annotationPopup’,
    ‘header’,
    ‘toolsHeader’
    ]
    }, this.viewerRef.nativeElement).then(async instance => {
    this.viewerInstance = instance
    this.loadPdf(1)
    }

  3. When the webviewer constructor is initialized, it calls for the this.loadPdf(1) that will make the http request to web api endpoint to fetch the pdf file and it returns the bytearray of the pdf file.

loadPdf method look like

async loadPdf(fileId: number) {
this.http.get(‘http://localhost:6984/vod/services/viewer/image/’ + fileId, { responseType: ‘blob’ }).subscribe((blob: Blob) => {
const file = new File([blob], ‘project.pdf’, { type: ‘application/pdf’ });
this.viewerInstance.UI.loadDocument(file)
});

I m able to upload the file and view the file in the demo application that is hosted in docker container. (http://localhost:8090/demo)

Hi there,

Thank you for contacting WebViewer forums,

We have a guide on setting up WebViewer server with docker here:

Please follow the guide and let us know if you are experiencing any issues.

Best regards,
Kevin Kim