Angular Syncfusion PdfViewer-直接从blob加载数据
我的问题是如何直接从blob加载pdf。我不想调用API来获得响应。问题是我们在加载时调用api的代码。为什么以及如何避免它 打字稿:Angular Syncfusion PdfViewer-直接从blob加载数据,angular,typescript,syncfusion,Angular,Typescript,Syncfusion,我的问题是如何直接从blob加载pdf。我不想调用API来获得响应。问题是我们在加载时调用api的代码。为什么以及如何避免它 打字稿: public service = 'http://localhost:4200/api/'; public load() { this.gdvService.getData(this.data.id, this.data.configuration) .subscribe(gdvData => { const respo
public service = 'http://localhost:4200/api/';
public load() {
this.gdvService.getData(this.data.id, this.data.configuration)
.subscribe(gdvData => {
const responseData = gdvData[this.data.configuration.dataColumn];
const blob = new Blob([responseData], { type: 'application/pdf' });
const reader = new FileReader();
reader.readAsBinaryString(blob);
reader.onloadend = () => {
const base64data = reader.result;
const pdfviewer = (document.getElementById('pdfViewer') as any).ej2_instances[0];
pdfviewer.load(base64data, null);
};
});
}
HTML:
Syncfusion PDF查看器控件同时面向服务器和客户端。PDF viewer控件在服务器端(使用.NET环境开发)处理PDF文档,并使用web服务将处理后的PDF数据发送到客户端,以呈现PDF文档并在PDF viewer中进行进一步操作。因此,目前无法在没有服务器端的情况下在PDF Viewer中加载PDF文档
问候,,
阿克沙亚