cancel
Showing results for 
Search instead for 
Did you mean: 

How to download pdf file in Ui5?

former_member185620
Participant
0 Kudos

Hi everyone,

I'm working on SRM new UI add-on shopping cart.

I'm uploading .pdf and .doc file with file upload control.

I can download .doc file directly. But I can't download .pdf file directly.

When I push pdf file open a new tab. I want to download file directly.

How can I solve this problem?

Best regards

Burak Oral.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185620
Participant
0 Kudos

I solve this problem . But this method does not work in internet explorer. This work in chrome.

How can I solve this problem in internet explorer?

Answers (3)

Answers (3)

former_member185620
Participant
0 Kudos

Also I wrote file path to my browser with manual, It opens again display mode.

henriquemattos
Employee
Employee
0 Kudos

This should be set through header request from the browser to the server and back, but assuming you won't have control of server-side configuration, you can try the download attribute for anchor element:

<a href="https://answers.sap.com/path/to/file.pdf" download="file.pdf" target="_blank">Download Button</a>

former_member185620
Participant
0 Kudos

Thank you for your suggestion but Internet Explorer does not support this attribute.

HTML a download Attribute

SergioG_TX
Active Contributor
0 Kudos

Burak,

use <a href="URL" target="_blank" > your pdf name </a>

do not include the download attribute in the a tag..

former_member185620
Participant
0 Kudos

I tried but Unfortunately, my problem wasn't resolved.

SergioG_TX
Active Contributor
0 Kudos

Burak,

have you tried adding a HTML anchor <a href="<URL_TO_PDF">[Your PDF NAME]</a>

you should be able to open it like that

former_member185620
Participant
0 Kudos

I didn't try html a href tag.

I use below code :

template: new sap.ui.commons.Link({text : "{PHIO_FNAME}" , href : "http://myserver:8000/sap/mypdffile.pdf" , target : "_blank"})

I will try thank you Sergio.