PDF Viewer Add-on

A JavaScript object can be utilized to showcase PDF content within standalone applications.

It is important to note that due to its nature and reliance as a JS worker, rendering extensive documents will inevitably be slower compared to employing the device’s native PDF viewer.

Supporting browsers and operating systems:

  • Internet Explorer 11+

  • Chrome

  • Safari

  • iOS

  • Android

  • WinPhone 8

Procedure

In Neptune Application Designer (NAD) head to Settings and select Addon-PDF Viewer and add the PDFView object into your page.

You can modify the pdfData variable with your own data. The PDF stream should be encoded as base64 data. The provided code example demonstrates the implementation within the ajaxSuccess function, which handles the reception of the data.

// Navigate
App.to(PagePDF);

// Get Data from Model
var data = modelPageList.getData();

// Trigger PDFView
PDFView.Show(data.PDF);

Important facts:

  • If you have a separate page like on the example above, navigate to the page before triggering the PDF Display.

  • data.PDF contains the base64 encoded PDF data coming from the backend ABAP class.

  • Exporting an App with Neptune Application Designer will include the PDF Viewer library.

Below you will find a list of methods that can be used with PDFView:

PDFView.Render(); // - Only redraw the PDF Document. Perfect to use on the sap.m.App event orientationChange

PDFView.ZoomIn(); // - Zoom in PDF Document

PDFView.ZoomOut(); // - Zoom out PDF Document

PDFView.Show(pdfData); // - Loads PDFViewer with new PDF Document