pdfjs

Loading PDF in Canvas and Drawing rectangles

僤鯓⒐⒋嵵緔 提交于 2020-04-30 10:05:14
问题 I am trying to build a web page to display a PDF file inside canvas and allow user to draw rectangles. Below is the code I'm trying. The problem is mouse event is going outside canvas also. How to restrict mouse dragging event only inside the canvas. var url = 'https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/examples/learning/helloworld.pdf'; //Loaded via <script> tag, create shortcut to access PDF.js exports. var pdfjsLib = window['pdfjs-dist/build/pdf']; // The workerSrc property

How to consume an octet stream from protected endpoint using vue-pdf a vuejs implementation of pdfjs

守給你的承諾、 提交于 2020-03-05 03:21:11
问题 I want to use the vue-pdf library that is an implementation of pdfjs for vuejs 2.x in order to do the following Download a PDF from an oauth2 protected endpoint using axios Render the PDF (octet-stream) using vue-pdf library and the tricky parts are Access protected resources Render PDF that comes as octet stream Currently there are no examples in the repo to show case these. 回答1: After fiddling around with the library, I managed to do achieve the rendering of a pdf from a protected endpoint

PDFJS: error on Text rendering for the PDF

天大地大妈咪最大 提交于 2020-01-25 06:59:25
问题 Recently the PDF rendering get a messed up text layer where text gets duplicated with the grey colored overlay. No idea about how to fix it as when i remove textLayerFactory: new pdfjsViewer.DefaultTextLayerFactory() it works fine. but need this as if not is render as images which takes a lot of time for large documents Im using pdfjsViewer.PDFPageView my code as follows getPdf() { var pdfDocument; if ( this._state !== 'inDOM' ) return false; pdfjsLib.disableRange = true; pdfjsLib

Vue: use a custom libary (pdf.js) in a component

萝らか妹 提交于 2020-01-13 06:49:14
问题 How can I use a vendor libary (specifically I want to use PDF.js) in a Vue component? (I only want to load it for this specific component as they are rather larger files) I'm building an editor that needs to load a pdf. So I placed the pdf.js and pdf.worker.js in /src/assets/vendor/pdfjs Then I load both in the template-editor-page.hbs that also loads the component: <div class="content"> <div class="row fill"> <div class="col-md-2 fill br pt30"> </div> <div class="col-md-10 fill pt30 pl30

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

Flask / postgres - display pdf with PDFJS

泪湿孤枕 提交于 2019-12-24 18:39:25
问题 I have a very simple application. A user uploads a pdf file to a postgres database via the web front end. That pdf should then be rendered in the browser via pdfjs. I'm fairly certain my issue is an encoding one, but I don't think I understand encoding well enough to answer this on my own. My model: class Lesson(Base): __tablename__ = 'lessons' # Name of the lesson lesson_order = db.Column(db.Enum(LessonIndexes), nullable=False) name = db.Column(db.String(128), nullable=False) summary = db

Creating and showing pdf in Ionic

不羁的心 提交于 2019-12-19 03:21:31
问题 I am using PDFMAKE to create a base64 encoded pdf and I tried to show it with the Iframe by giving the encoded base64 to iframe src. It works on PC but it didn't work on the mobile ( android and ios ). So, finally I stumbled upon Angularjs-PDF to show the pdf. Now, I am able see the pdf in mobile. But when I try to give custom width and height respective to device it takes. But the problem arises when I use zoom functionality, the page gets zoomed but it goes out of the screen. I can not even

Search using code on Embedded PDFJS

三世轮回 提交于 2019-12-13 02:28:08
问题 I have integrated PDFJS with my webpage. I want to search using javascript. It's working fine for first time search. But then I try to search again with different keyword then it's not highlighting proper keyword. Here is what I have tried: // search with PDF.js function searchPDF(td_text) { PDFViewerApplication.findBar.open(); PDFViewerApplication.findBar.findField.value = td_text; PDFViewerApplication.findBar.highlightAll.checked= true; PDFViewerApplication.findBar.findNextButton.click(); }

How to tell JavaFX WebView to ignore 'use strict' directive?

人盡茶涼 提交于 2019-12-12 18:02:16
问题 I am trying to integrate the mozilla viewer in a JavaFx WebView by using the following code: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.web.WebView; import javafx.stage.Stage; public class TestStrict extends Application { @Override public void start(Stage primaryStage) throws Exception { WebView webView = new WebView(); String url = TestStrict.class.getClassLoader().getResource("pdfjs-1.1.366-dist/web/viewer.html").toExternalForm(); webView.getEngine

How to highlight text with PDFJS?

被刻印的时光 ゝ 提交于 2019-12-12 11:04:46
问题 I'm creating an app that shows a PDF file among others. I need to implement a search functionality so that I can search for terms in the pdf file. To display the file I'm using PDFJS. In the pdfjs library are some examples including the components example that renders a page and you can mark the text (https://github.com/mozilla/pdf.js/tree/master/examples/components). But when I'm trying to use this code in my app I'm getting the error that PDFJS.DefaultTextLayerFactory() is undefined. I