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!
cancel
Showing results for 
Search instead for 
Did you mean: 
ferrygun18
Contributor
2,855
In this tutorial, we'll learn how we can create a custom widget to display a PDF document in SAC Analytic App.



sap.m.PDFViewer


We will leverage the SAPUI5 library sap.m.PDFViewer and call the code in the custom widget WebComponents code.


Here is the code for the XML view:
<mvc:View controllerName="myView.Template" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" height="100%">
<ScrollContainer height="100%" width="100%" horizontal="true" vertical="true">
<PDFViewer id="pdf" source="{/Source}" title="{/Title}" height="{/Height}" loaded="onloaded" error="onerror" sourceValidationFailed="onsourceValidationFailed">
<layoutData>
<FlexItemData growFactor="1" />
</layoutData>
</PDFViewer>
</ScrollContainer>
</mvc:View>

Custom Widget


Create an Analytic App and insert the custom widget PDFViewer_1. Also insert the input area InputField_1 and button PDFViewer_1. With that we can load and display the PDF document from the URL.


On the Button_1: onClick() property, enter the following code to call the custom widget setPDFURL() function with the input the URL to the PDF document.



And that's it.

References



 
5 Comments
Labels in this area