pdf.js

Pdf.js and viewer.js. Pass a stream or blob to the viewer

◇◆丶佛笑我妖孽 提交于 2019-11-26 09:29:22
问题 I\'m having troubles in finding a solution for this: I retrieve a PDF blob from a SQL filestream field using Javascript in this way (it\'s a lightswitch project) var blob = new Blob([screen.WebReportsPdfFilesStream.selectedItem.Pdf], { type: \"application/pdf;base64\" }); I have the blob and I can even convert it in a filestream or to base64(\"JVBERi0.....\" or \"%PDF 1.6 ......\", etc.) No problem so far. Now I need to display it in a viewer. I prefer the viewer to open in a new window but i

Pdf.js: rendering a pdf file using a base64 file source instead of url

时光怂恿深爱的人放手 提交于 2019-11-26 05:49:56
问题 I\'m trying to render a page from a pdf with pdf.js Normally, using a url, I can do this: PDFJS.getDocument(\"http://www.server.com/file.pdf\").then(function getPdfHelloWorld(pdf) { // // Fetch the first page // pdf.getPage(1).then(function getPageHelloWorld(page) { var scale = 1.5; var viewport = page.getViewport(scale); // // Prepare canvas using PDF page dimensions // var canvas = document.getElementById(\'the-canvas\'); var context = canvas.getContext(\'2d\'); canvas.height = viewport