使用 Syncfusion 将 Blob Storage 绑定到 AngularJS 中的 PDF



我正在尝试使用与输入同步作为 blob sorage URL 的 pdf 查看器,但在使用它时抛出了 CORS 错误。 我的核心如下

 blobService.getFileFromBlobByURI(objBlobStorageModel).then(function (result) {
        $scope.ShowprofileSpinner = false;
        $scope.serviceurl = $sce.trustAsResourceUrl(result.data);
        $scope.serverActionSettings = {
            load: 'LoadAction', fileUpload: 'FileUploadAction',
            download: 'DownloadAction'
        }
    });

PDF的html如下

 <div id="container" style="width: 100%; height: 680px" ej-pdfviewer e-serviceurl="serviceurl" e-serverActionSettings="serverActionSettings"></div>

根据提供的详细信息,我们怀疑您正在服务URL中传递PDF文档数据。属性设置 Web 服务 Url 而不是 PDF 文档数据。 请参阅下面的 UG 以使用 Web 服务显示 PDF 文档。

https://help.syncfusion.com/angularjs/pdfviewer/getting-started#displaying-pdf-document-using-web-api

如果你的要求是从 blob 存储加载 PDF 文档,请参考下面的知识库文章,https://www.syncfusion.com/kb/8737/how-to-load-a-pdf-document-from-url-into-pdf-viewer-from-client-side

您还可以在控件初始化期间使用 documentPath API 加载 PDF 文档。请参阅以下链接中的"在控件初始化期间加载文档"部分,
https://help.syncfusion.com/angularjs/pdfviewer/getting-started#initialize-and-configure-the-control

问候

拉米亚·

最新更新