mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.59k stars 9.99k forks source link

How to remove `window re-size` event? #5858

Closed 3gwebtrain closed 9 years ago

3gwebtrain commented 9 years ago

In my app, i am using the stable width and height dimension to show the rendered pdf file. some time, when i open the console panel that triggers the windows resize event.

because of that, my form, which i show over the text layer, resets itself. even some of background this resets in the textlayer, what i set.

so, how can i disable the window resize event from viever.js or pdf.js

any one help me?

Snuffleupagus commented 9 years ago

The resize event is fired by the browser, see https://developer.mozilla.org/en-US/docs/Web/Events/resize, so it is not possible to prevent it from firing. You can of course remove the event handling code from viewer.js#L1817 in your implementation, but please note that doing so would prevent certain functions of the viewer from working.

Closing as answered (and out of scope for the default viewer).

3gwebtrain commented 9 years ago

Yes, it works. can you tell me a way to disable or remove the toolbar and thumb at the left as well... I am doing using css. Is this correct way?

Additionally, I would like to make user to select my pdf text after all are rendered. exactly how to put some trigger saying that all page contents are rendered. (my case pdf will have only one page)

Snuffleupagus commented 9 years ago

It sounds like your implementation doesn't actually need most of the features of the default viewer. Hence I would suggest that you look into using the viewer components instead, see https://github.com/mozilla/pdf.js/tree/master/examples/components. In response to your second question, I suggest searching the code for the pagerendered and textlayerrendered events.

3gwebtrain commented 9 years ago

Thanks for your great advice. What I exactly required is, I would like to show the pdf, in which user can select the text once that done, i would like to hightlight the selected area wrapping the text in span element say : `Some selected text, so i can filter the areas whatever the user selected and send to back-end.

In case user require to delete the selected text, i will keep delete button, which can re-wrap the span element. Can you tell me extactly which components require to use this please? Onload let me show them pdf1 on click on next and previous button let me update the pdfs. for to show the selected text again to user i am storing the textlayer in javascript object to replace when the user come back from pdf2 to pdf1.

Thanks in advance. If i get any suitable answer for this questions, it mean you have saved me a week time..!

I find there is components listed, but I don't understand their purpose of use.