Articles in this section
Category / Section

How to load PDF document as base64 string into PDF Viewer in JavaScript platform?

4 mins read

You can load the PDF document as base64 string into JavaScript PDF Viewer using the documentPath
API exposed in PDF viewer. Refer to the following code snippet.

HTML

<ej-pdfviewer [(serviceUrl)]="service" id="pdfviewer1" [(documentPath)]="docPath" style="width:100%;min-height:600px;display:block" >
        </ej-pdfviewer>

TS

import { Component } from '@angular/core';
 
@Component({
    selector: 'ej-app',
    templateUrl: './pdfviewer.component.html',
})
export class PdfViewerComponent {
     service: string;  
  docPath: string;
    constructor() {
        this.service = 'http://js.syncfusion.com/demos/ejservices/api/PdfViewer';
     //Provide your base64 string in docPath.
        this.docPath = '   '; 
   } 
}

 

Note:

We have provided base64 string of the PDF document in the below sample

 

Sample link:https://www.syncfusion.com/downloads/support/directtrac/general/ze/PDF_Viewer_Angular-120812323


Conclusion

I hope you enjoyed learning how to load PDF document as base64 string into PDF viewer in Angular platform.

You can refer to our JavaScript PDF Viewer feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript PDF Viewer example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!



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