1

尝试使用 PDF 查看器(服务器)并在浏览器控制台中不断收到上述错误。它一直工作到今天,并且没有很多代码与之配套。有没有人遇到过这个?

<SfPdfViewerServer @ref="pdfViewer" ToolbarSettings="@ToolbarSettings" EnableFormFields="false" DocumentPath="@DocumentPath" EnableNavigationToolbar="false" EnableAnnotationToolbar="false" EnableToolbar="true" Height="100%" Width="100%">
     <PdfViewerCustomStampSettings EnableCustomStamp="true" IsAddToMenu="true" Width="194" Height="75" MaxHeight="75" MaxWidth="194" MinHeight="75" MinWidth="194" CustomStamps="@CustomStamps"></PdfViewerCustomStampSettings>
     <PdfViewerContextMenuSettings EnableContextMenu="false" />
     <PdfViewerAnnotationSettings IsLock="false" />
     <PdfViewerEvents AnnotationAdded="@AnnotationAdded" DocumentLoaded="@DocumentLoaded" AnnotationRemoved="@AnnotationRemoved" AnnotationSelected="@AnnotationSelected" />
</SfPdfViewerServer>

上面的代码是加载查看器的简单代码。以下代码是加载文档的内容。

byte[] byteArray = await webClient.DownloadDataTaskAsync(new Uri(docpath));
DocumentPath = "data:application/pdf;base64," + Convert.ToBase64String(byteArray);
4

1 回答 1

0

该站点需要在 https 中运行。一旦我将它更改为安全运行,它就开始工作了。

于 2021-07-15T18:58:12.173 回答