cancel
Showing results for 
Search instead for 
Did you mean: 

PDF file access using sap.m.PDFViewer Control

ashishsaxena14
Explorer

How can we access PDF file from network drive or shared drive and can open in Fiori App Tiles ,i tried using sap.m.PDFViewer Control

Accepted Solutions (1)

Accepted Solutions (1)

thalesvb
Active Contributor

Directly you can't, network drive uses SMB or NFS protocols while UI5 uses HTTP protocol to send and retrieve data. There is also the visibility, network drivers commonly are only visible in intranet, and I think your App runs on Internet.

You can use two approaches:

1st: PDFViewer control API describes that you can pass data URI (base64 encoded data) or Blob URL in source property. So you make your backend read that file from shared folder and pass it to UI handle it.

2nd (not recommended, but possible): You turn this network drive consumable in HTTP protocol, like using NGINX, Apache, or any software to serve static content. This way you need to propagate credentials to not allow unauthorized access.

Best Regards

ashishsaxena14
Explorer
0 Kudos

Thanks a lot Thales for your answer i will try 1st approach

ashishsaxena14
Explorer
0 Kudos

thalesvb Hi thanks for your reply,actually i want to access a PDF file from local shared drive on intranet on fiori app tile,its an on premise implementation,no SAP Backend is not involved, only i have to use frontend server that is SAP fiori frontend server and access the PDF fie, can you please help me with the functionality and if possible a bit of code....

thalesvb
Active Contributor
0 Kudos

Yet is called Fiori Frontend Server, I'm pretty sure it also contains SEGW TCode available, so you can code a simple service there (it will also acts as a backend) to read files from shared drive and push it to browser.

Codes and how-tos exists in blog posts, it's just a matter to search them. You'll need to read a file from file system (map shared drive on Fiori server), encode it to Base64 (using a standard function or method like cl_http_utility=>encode_x_base64) and running it inside a Gateway Service (SEGW). On UI5 side: https://blogs.sap.com/2018/05/17/how-to-view-a-base64-encoded-pdf-using-pdfviewer/

Best regards

Answers (1)

Answers (1)

ashishsaxena14
Explorer
0 Kudos

thalesvb Thanks i will try what you have suggested