Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
SAP UI5 has come a long way in the past few years, with the built-in PDF viewer being introduced in version 1.48. Originally, Wouter Lemaire created the Control 2018 because not all customers could use version 1..48 yet. While many users have now upgraded to a version that includes the sap.m.PDFViewer, there are still cases where a custom control might be needed.

The main differences are that Base64 strings and URL can be processed at the same time, depending on which input is used.
In addition, the PDF is not displayed in the browser's integrated PDF viewer, but is sent as images.
This is useful, for example, if there is no direct possibility to download the PDF.
A toolbar is integrated with which you can switch between the sections and zoom in.

The updated custom control is based on the PDFJS library and now offers easier integration into UI5 apps via NPM.

Getting Started

A sample app can be found here:

Live Demo with Sample PDF

Live Demo:

To begin using the updated control, follow these steps:

Install the NPM package:

npm install "ui5-cc-pdfviewer"

Configure your project's manifest.json:

"resourceRoots": {
"cc.pdfviewer": "./thirdparty/cc/pdfviewer",
"pdfjs-dist": "./thirdparty/cc/pdfviewer/pdfjs-dist/build"

Use the PDF control in your app's XML view:

<mvc:View controllerName="pdfviewer.controller.Main"
xmlns:mvc="sap.ui.core.mvc" displayBlock="true"
xmlns="sap.m" xmlns:u="sap.ui.unified" xmlns:pdf ="cc.pdfviewer">
<Page id="page" title="{i18n>title}">
<u:FileUploader id="upload" fileType="pdf" name="upload" tooltip="Upload your image" change="onFileChange" maximumFileSize="10" sameFilenameAllowed="true"></u:FileUploader>
<Button text="Open PDF in dialog" press="onOpenPDFViewer"/>
<pdf:PdfViewer id="pdfViewer" pdfSource="{/pdfsource}" height="700px"/>



For a demo of the control, navigate to the test/pdfviewer folder, execute npm install, and then run npm start. Upload a PDF file to preview it in the PDF viewer.

Or just visit:


The updated custom UI5 PDF viewer control offers an excellent alternative for those who need to work with Base64 encoded PDFs or prefer rendering PDF pages directly as images. With easy integration via NPM and a sample app to help you get started, incorporating this control into your UI5 projects has never been simpler.


Further Links

Labels in this area