pdf.js

In PDF.js, how do you hide the canvas and display the underlying text at full opacity?

耗尽温柔 提交于 2020-01-14 03:40:28
问题 When PDF.js processes a PDF to HTML5, it lays a <canvas> over all the <div> elements containing the text. This canvas is a proper render of the PDF, while the text underneath is quite rough (but sufficient for certain purposes such as searching for words). Using the PDF.js demo page, I can make the underlying text visible by: Deleting the <canvas> element. Disabling the color: transparent property on the .textLayer class, which acts upon the underlying text. ... However, the text remains low

Access PDF.js Viewer functions / events

老子叫甜甜 提交于 2020-01-13 05:53:29
问题 I am looking into putting together a small site that reads a few PDF files and loads them in the PDF.js viewer. (I want to use the viewer specifically) I still want all of the viewer UI and functionality present, just adding a sidebar with a list of files to chose from. Alas I have not been able to really understand the PDF.js code (or a lot of the Viewer.js code provided for that matter) Currently I am looking for a way to pass the PDF.js viewer a new file to open. (Without reloading the

php使用pdf.js前端输出pdf

夙愿已清 提交于 2020-01-06 21:04:42
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 今天做项目时遇到一个问题 , 需要在页面显示pdf文件 , 并且不能下载和打印 . 这个技术真的没有尝试过 , 所以就开始了我的百度之旅 , 翻看了几篇博客 几乎所有的博客都提到了一个pdfobject.js的框架 , 所以我就去下载了这个框架 网址是https://pdfobject.com/ 点击git后自主下载吧 , 不会玩git的程序员不是好程序员. 将你下载下来的js文件放到你框架里面的js文件夹里 然后引入你要使用的位置 我用的tp5.1 pdfobject.js是不需要经过后台的 直接前端使用就行 我用的是layui 直接用layui.open就好了 然后就可以正常浏览了 对 就是这么简单 如果你想要屏蔽 这两个按钮的话 在模板文件里 加入 style属性就好了 就这么简单 来源: oschina 链接: https://my.oschina.net/u/4196676/blog/3152454

Prevent simultanous function calls when using pdf.js?

£可爱£侵袭症+ 提交于 2020-01-04 02:33:11
问题 I use pdf.js to show pdf files, but the result is not good, please have a look at my code. My codes are as follows. var aaa = function (pdf, page_number) { pdf.getPage(page_number).then(function(page) { var scale = 1.5; var viewport = page.getViewport(scale); var canvas = $('.pdf-view')[page_number-1]; var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; var renderContext = { canvasContext: context, viewport: viewport }; page.render

How to set range header from client with pdf.js?

て烟熏妆下的殇ゞ 提交于 2020-01-03 17:11:10
问题 I am quite new to client side programming. I am trying to view my pdf in my web using pdf.js. By following the steps in documentation i tried loading pdf with pdf.js. The entire pdf file is getting downloaded in a single request. Now, I would like to do progressive loading (downloading by specifying the range). I have done the following things at my client and server side. My client contains two files form.js and index.html CLIENT form.js 'use strict'; var PDF_PATH = ""; //Path of pdf file in

how to improve the print quality with pdf.js to print pdf document?

最后都变了- 提交于 2020-01-02 02:48:07
问题 The Issue: When I use pdf.js to print PDF documents, the text on paper is not very clear like print PDF directly. How to resolve it? 回答1: PDF.js renders the PDF to a HTML canvas and then sends the rendered image to the printer. To improve the quality of the image being sent to the printer, you need to increase the DPI or resolution of the image. There have been several bugs raised about the issue: https://github.com/mozilla/pdf.js/issues/7094 https://github.com/mozilla/pdf.js/issues/7041

flask render_template with url parameter

女生的网名这么多〃 提交于 2020-01-01 14:20:09
问题 I use pdf.js to render pdf in web. The format of the target url like this: http://www.example.com/book?file=abc.pdf My problem is: I use flask template to generate page using: return render_template('book.html', paraKey=paraValue) But how to attach url parameter "file=abc.pdf" to url? The parameter will be read by viewer.js(included in book.html) that uses it to read file for rendering pdf. I'm new to flask, hoping guys giving me some help! 回答1: You could use redirect function, which can

Jump to page in PDF.js with javascript

放肆的年华 提交于 2020-01-01 00:43:09
问题 I'm trying to use PDF.js' viewer to display pdf files on a page. I've gotten everything working, but I would like to be able to 'jump to' a specific page in the pdf. I know you can set the page with the url, but I would like to do this in javascript if it's possible. I have noticed that there is a PDFJS object in the global scope, and it seems that I should be able to get access to things like page setting there, but it's a rather massive object. Anyone know how to do this? 回答1: You can set

How to make PDF undownloadable using pdf.js

耗尽温柔 提交于 2019-12-31 14:58:52
问题 I found the pdf.js project, which is very useful. However, I am unable to figure out how to remove the "Download" option. 回答1: Here are the steps: Add jQuery library to shared folder. Include jQuery library to viewer.html file Add this on the header section: <script> $(function(){ $('#download').hide(); }); </script> Done! 回答2: Just deleting the buttons breaks pdf.js. You need to add a "hidden" class to them (https://github.com/mozilla/pdf.js/issues/2611) 回答3: just add this in viewer.css

PDF.js Message: file origin does not match viewer's (Amazon S3)

守給你的承諾、 提交于 2019-12-31 05:25:30
问题 In a Rails app, using the pdfjs_viewer-rails gem (https://github.com/senny/pdfjs_viewer-rails), I keep seeing this error: PDF.js v1.3.91 (build: d1e83b5) Message: file origin does not match viewer's I presume this is because the PDF is hosted on Amazon S3, and I have read through the discussion of CORS here (https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-xhr). However, I have been unable to assemble a COSR configuration that works. My current bucket configuration is: <