Skip to content
Franco Mussopower pages
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”.

Retrieve file column and display PDF in iframeJavaScript
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);
    }
});

Search

Book a discovery call

30 minutes. Bring your trickiest Power Pages problem — I’ll tell you honestly whether I’m the right fit.