SAPUI5 / Javascript如何将二进制数据转换为可读格式并下载为PDF格式
我从OData Service获取二进制数据。有人请帮助我如何将二进制数据转换为可读格式。 我试着像atob这样的选项很少但是它没有成功。 以下是我的代码..
var data="JVBERi0xLjMNCiXi48/TDQolUlNUWFBERjMgUGFyYW1ldGVyczogQUJEUFJTVFhiaA0KJURldnR5cGUgSFBMSklJSUQgRm9udCBDT1VSSUVSICBib2xkIDEyMCBMYW5nIEVOIFNjcmlwdDogIDAgLT4vQzAwMQ0KMyAwIG9iag0KPDwNCi9UeXBlIC9Gb250RGVzY3JpcHRvcg0KL0FzY2VudCA3MjANCi9DYXBIZWlnaHQgNjYwDQovRGVzY2VudCAtMjcwDQovRmxhZ3MgMzINCi9Gb250QkJveCBbLTE4NCAtMjM2IDEyODcgOTI4IF0NCi9Gb250TmFtZSAvUnVwZWVGb3JhZGlhbg0KL0l0YWxpY0FuZ2xlIDANCi9TdGVtViAxMDUNCi9Gb250RmlsZTIgMiAwIFINCj4+DQplbmRvYmoNCjQgMCBvYmoNCi+DQpzdHJlYW0NCnic7chREUAhCERRKlDBClSgghWoYAUrUIEKVNgKVrAC+mK8Gc/P7tw5Z2aq6t57rSUirbUxBjOLA6jee0QUYI4bHOV3qszMvwciEruh6Hn+5gA2wCs8DQplbmRzdHJlYW0NCmVuZG9iag0KOCAwIG9iag0KODYNCmVuZG9iag0KNyAwIG9iag0KDQpbL0ZsYXRlRGVjb2RlXQ0KZW5kb2JqDQo5IDAgb2JqDQo8PA0KL1R5cGUgL1hPYmplY3QNCi9TdWJ0eXBlIC9JbWFnZQ0KL0ZpbHRlciAxMCAwIFINCi9MZW5ndGggMTEgMCBSDQovTmFtZSAvMDAwMDkNCi9XaWR0aCA1Ng0KL0hlaWdodCA0OQ0KL0JpdHNQZXJDb21wb25lbnQgOA0KL0NvbG9yU3BhY2UgWyAvSW5kZXhlZCAvRGV2aWNlUkdCIDI1NSA2IDAgUl0NCj4+DQpzdHJlYW0NCnic7da7DsMgDAXQGQ9A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FMjA+VGogPDQyNTI0MTRFNDM0ODJFPlRqIEVUIDAgZyBCVCAzMDAuNTAgMzcyLjM1IFRkIDAgVHcgL0MwMDEgMTAuMDAgVGYNCiA8MjA1NDYxNkI2NTIwNDg2RjZENjUyMDUwNjE3OTI4MzUzMTM1MzAzMDM1MzUzMTM1MzAzMDM1Mjk+VGogMCBUciBFVCAwIGcgQlQgNTEzLjI1IDM3Mi4zNSBUZCAwIFR3IC9DMDAzIDguNTAgVGYgPDMxMzMzOTJD" var bin=atob(data);
能否帮助我如何使其成为可读格式并以PDF格式下载?
好吧,有几种方法可以解决它。 最重要的信息是您拥有的字符串是PDF文件的Base64编码版本。
您可以创建一个Blob并使用一些小“技巧”下载它(对于IE,您有一个IE特定的API,对于其他浏览器,您可以使用数据URL)。 请检查以下SO问题: 使用javascript |下载base64数据 IE11 。 它的要点如下:
var a = window.document.createElement("a"); a.href = window.URL.createObjectURL(blob, { type: "application/pdf" }); a.download = "filename.pdf"; document.body.appendChild(a); a.click(); document.body.removeChild(a);
或者您可以使用内置的UI5实用程序函数sap.ui.core.util.File.save并将解码的二进制数据传递给它:
sap.ui.core.util.File.save(bin, "filename", "pdf", "application/pdf");
当然,另一种可能性是使用像download.js这样的第三方库:
download(bin, "filename.pdf", "application/pdf");
在我看来,你应该使用UI5版本,因为:
- 第一个版本使您编写一些相当低级别的,与浏览器相关的代码。
- 如果你看一下UI5函数的源代码 ,它实际上大部分都是一样的。
- 最后一个版本添加了一个可以避免的外部依赖。
唯一需要注意的是UI5function的兼容性; 专门从事此事的第三方库可能具有更好的兼容性矩阵:
macOS Safari <10.1 / iOS Safari打开一个新窗口或选项卡。 在macOS中,用户必须手动保存文件(使用组合键“CMD + S”,选择页面源格式,并指定文件名)。 在iOS中,内容可以在另一个应用程序(Mail,Notes,…)中打开,也可以复制到剪贴板。 如果弹出窗口阻止程序阻止此操作,则将引发错误,该错误可用于通知用户需要禁用弹出窗口阻止程序。
Android浏览器不支持
Windows Phone 10 Edge不支持