Code snippet
Retrieve file column and display PDF in iframe
Copy it with the button on the code. For the why and the walkthrough, see “How to retrieve File columns using Power Pages’ Portal Web API”.
webapi.safeAjax({
type: "GET",
url: "/_api/msevtmgt_events({{ request.params.id }})/musdyn_brochure",
contentType:"application/json",
success: function(res) {
console.log(res);
$('#main').append('<iframe src="data:application/pdf;base64,' + res.value + '" frameborder="0" height="100%" width="100%"></iframe>');
},
error: function(xhr, status, error){
var errorMessage = xhr.status + ': ' + xhr.statusText;
console.log(errorMessage);
}
});