第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

如何將PDF從遠(yuǎn)程服務(wù)嵌入到html頁面中?

如何將PDF從遠(yuǎn)程服務(wù)嵌入到html頁面中?

慕勒3428872 2022-09-29 16:33:06
我正在開發(fā)一個(gè)與現(xiàn)有后端服務(wù)接口的 UI。UI 需要調(diào)用后端服務(wù)器以獲取 PDF 文件,該文件將顯示在現(xiàn)有頁面或新選項(xiàng)卡中。我已經(jīng)嘗試了我在SO上看到的所有選項(xiàng):<iframe src="http://localhost:3131/Reports.aspx?reportName=testReport&clientid=23" width="800px" height="100%"></iframe><embed type="application/pdf" src="//http://samelinkasabove" width="800px" height="100%"><object type="application/pdf" data="http://myreportlink" width="800px" height="100%" /><a href="http://localhost:32/Reports.aspx?reportName=testReport&clientid=23" target="_blank">View Report</a>在每種情況下,pdf最終都是下載,而不是顯示在瀏覽器窗口中。有沒有一種本機(jī)方式來顯示PDF,或者是否需要java腳本來實(shí)現(xiàn)這一點(diǎn)?
查看完整描述

2 回答

?
飲歌長嘯

TA貢獻(xiàn)1951條經(jīng)驗(yàn) 獲得超3個(gè)贊

我這里有一個(gè)代碼圍欄,它使用免費(fèi)的Adobe DC視圖SDK準(zhǔn)確顯示了此功能。除非覆蓋本機(jī)瀏覽器查看器,否則無法控制 PDF 體驗(yàn)。我示例的相關(guān)代碼如下。在我的示例中,PDF 是從另一個(gè)域獲取的,但“content”參數(shù)將接受解析為 PDF 內(nèi)容的數(shù)組緩沖區(qū)的任何 Promise。您的PDF可以存儲在任何地方或動態(tài)創(chuàng)建,然后顯示在HTML頁面中。

document.addEventListener("adobe_dc_view_sdk.ready", function () {

  /*

  The clientId is tied to a specific domain. To display a PDF hosted 

  on a different domain using the Adobe View SDK, we need to fetch the file 

  first then pass it to the "content" parameter as a Promise. 

  */

  fetch("https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf")

    .then((res) => res.blob())

    .then((blob) => {

      var adobeDCView = new AdobeDC.View({

        // This clientId can be used for any CodePen example

        clientId: "YOUR_CLIENT_ID", 

        // The id of the container for the PDF Viewer

        divId: "adobe-dc-view" 

      });

      adobeDCView.previewFile(

        {

          // The file content

          content: { promise: Promise.resolve(blob.arrayBuffer()) },

          metaData: { fileName: "Bodea Brochure.pdf" }

        },

        {

          embedMode: "FULL_WINDOW", // possible values are "FULL_WINDOW", "SIZED_CONTAINER" and "IN_LINE"

          defaultViewMode: "FIT_WIDTH", // possible values are  "FIT_WIDTH" and "FIT_PAGE"

          showDownloadPDF: true,

          showPrintPDF: true,

          showLeftHandPanel: true,

          showAnnotationTools: true

        }

      );

    });

});


查看完整回答
反對 回復(fù) 2022-09-29
?
冉冉說

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超1個(gè)贊

我發(fā)現(xiàn)服務(wù)器正在使用水晶報(bào)告來生成PDF并“導(dǎo)出”它。它使用了一個(gè)函數(shù),方法調(diào)用中的第三個(gè)參數(shù)是 。ExportToHttpResponse(...)bool asAttachment

該參數(shù)被設(shè)置為 true。我將其更改為 false,并且響應(yīng)開始設(shè)置為,并且上述顯示方法開始工作。inline


查看完整回答
反對 回復(fù) 2022-09-29
  • 2 回答
  • 0 關(guān)注
  • 126 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號