Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controls doesn't work when loading two different pdfs #139

Open
korteee opened this issue Jul 27, 2016 · 4 comments
Open

Controls doesn't work when loading two different pdfs #139

korteee opened this issue Jul 27, 2016 · 4 comments

Comments

@korteee
Copy link

korteee commented Jul 27, 2016

I got two controllers in two different html files each of one changes $scope.pdfUrl.
When I load them for first time I got the wanted result (both of them load the correct pdf). But when I have once loaded both of them when I go back to the firstly loaded and try to use its controls I got the following error:

Error: this.messageHandler is null
WorkerTransport_getPage@http://localhost:8100/lib/pdfjs-dist/build/pdf.js:9970:11
PDFDocumentProxy_getPage@http://localhost:8100/lib/pdfjs-dist/build/pdf.js:8883:14
.link/scope.renderPage@http://localhost:8100/lib/angular-pdf/dist/angular-pdf.js:67:11
.link/<@http://localhost:8100/lib/angular-pdf/dist/angular-pdf.js:195:13
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:8100/lib/ionic/js/ionic.bundle.js:30239:23
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8100/lib/ionic/js/ionic.bundle.js:30503:13
@http://localhost:8100/lib/ionic/js/ionic.bundle.js:65426:7
defaultHandlerWrapper@http://localhost:8100/lib/ionic/js/ionic.bundle.js:16787:3
createEventHandler/eventHandler@http://localhost:8100/lib/ionic/js/ionic.bundle.js:16775:9
triggerMouseEvent@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2953:3
tapClick@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2942:3
tapMouseUp@http://localhost:8100/lib/ionic/js/ionic.bundle.js:3018:5

@simobasso
Copy link
Collaborator

Hi @korteee. Can you elaborate this one? Can you show your code or replicate on jsfiddle?

@dennybiasiolli
Copy link
Collaborator

Hi @korteee, do you have an example on jsfiddle for us?

@rhyskoedijk
Copy link

rhyskoedijk commented Apr 11, 2017

I experienced this issue myself, mine was caused because both my directives (and the <canvas> within them) shared the same IDs, which causes all the control buttons to apply to every PDF viewer on the page. With the current directive you need to specify the canvasId, which is hard to make unique in angular due to the directives reliance on the link() function to bootstrap the PDF.

In the end, I made a change so that the directive works using class names rather than element ids, it solved my issue and removed the need for element ids all together. I plan on submitting a PR for this once the new version is out.

Not sure if your problem is exactly the same as mine, but it might help.

@simobasso
Copy link
Collaborator

@rhyskoedijk #184 is merged! feel free to submit your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants