Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bvanzyl/eaa6834f15dca86dced6ce61d9648bb1 to your computer and use it in GitHub Desktop.
Save bvanzyl/eaa6834f15dca86dced6ce61d9648bb1 to your computer and use it in GitHub Desktop.
[Inject PDF in SAPUI5 View] #tags:SAPUI5,PDF,View,HTML
oModel = new sap.ui.model.json.JSONModel("./model/mockdata2/Smartform.json");
oModel.attachRequestCompleted(function(some){
var htmlTag = this.getView().byId("html_tag");
if(this.getView().getModel("pdfModel").oData[0].Smartform){
htmlTag.setContent("<iframe src=\"data:application/pdf;base64," +
this.getView().getModel("pdfModel").oData[0].Smartform +
" \" width=\"100%\" height=\"600px%\" />");
}
htmlTag.setBusy(false);
}.bind(this));
this.getView().setModel(oModel, "pdfModel");
<core:HTML id="html_tag" visible="{device>/system/desktop}" busy="true" />
<core:HTML
visible="{device>/system/desktop}"
content='&lt;iframe src=&quot;http://www.pdf995.com/samples/pdf.pdf&quot; width=&quot;100%&quot; height=&quot;600px%&quot; /&gt;' />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment