- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hello,
I managed to do this in another way (will share how, in case more people need it).
I was using the code in a JavaScript and using a webApp variable to pass the content from the JS to the page item.
This was solved by executing the javascript code in the page itself.
Apparently we can't store the result of a PDF in a var because there are some EOF text that can corrupt the result. So the final code is:
<head>
<%
var url = 'https://www.soundczech.cz/temp/lorem-ipsum.pdf';
var http = new HttpClientRequest(url);
http.method = "GET";
http.execute();
%>
</head>
<body style="" class="">
<p>Stuff:</p>
<a href="data:application/pdf;base64, <%= http.response.body.toBase64() %>" target="_blank" download=""> pdf </a>
This will enable the user to download the PDF.