Hi,
I need to load a PDF file generated by another system to display it on the web. Normally, we can access or download the file through a URL, for example, www.abc.com/abc.pdf. But in my case, I have a special URL generated by another system to display, for instance, www.abc.com/abc. The question is, how can I create a function to download the file from the above URL?
Finally, I found the solution using the GetRequest_Submit action from the HTTPRequestHandler extension.
You can read the file from www.abc.com/abc, convert it to Base64 format, and store it in an OutSystems entity. Once stored, you can retrieve the file from the entity and provide it as a downloadable file whenever needed.
If the URL www.abc.com/abc is publicly accessible, you can use JavaScript to download the file directly on the client side.
Hii @Phongsakorn.P,
You can add the following JavaScript code to trigger the download or display of the file in a new browser tab or window:
window.open('https://www.abc.com/abc', '_blank');
Hope it helps you.
Regards,
Rounak Rawat
Hello @Phongsakorn.P
o handle downloading and displaying a PDF file from a special URL (e.g., www.abc.com/abc), you can make an HTTP GET request using REST API to fetch the file. Ensure the response has the Content-Type set to application/pdf. Once you retrieve the file as binary data, you can either store it temporarily or directly pass it to the front end for display.
For PDF view you can use PDF Viewer Reactive.
Thanks
Regards
Gourav Shrivastava
And if you want to do this js code you can take reference also you can modify :-