I keep getting the exception -
netscape.javascript.JSException: ReferenceError: Can't find variable: PDFViewerApplication
at line no 276 of PDFDisplayer.java
Googling says it could be because line 276 is getting executed before the js has been fully loaded. However, in your code, it seems you have taken care of that .... So, beats me.
I am using Azul 13 runtime; am loading pdf.js, viewer.html, viewer.js etc from a local file; and loading a local pdf as well.
In desperation, I have downloaded the library on my machine and built it. But, same result. Here's the stacktrace :
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: netscape.javascript.JSException: ReferenceError: Can't find variable: PDFViewerApplication
at com.dansoftware.pdfdisplayer.PDFDisplayer$2.changed(PDFDisplayer.java:283)
at com.dansoftware.pdfdisplayer.PDFDisplayer$2.changed(PDFDisplayer.java:263)
at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.base/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:74)
at javafx.base/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102)
at javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
at javafx.base/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
at javafx.web/javafx.scene.web.WebEngine$LoadWorker.updateState(WebEngine.java:1251)
at javafx.web/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1366)
at javafx.web/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1231)
at javafx.web/com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2514)
at javafx.web/com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2359)
at javafx.web/com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method)
at javafx.web/com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:871)
at javafx.web/com.sun.webkit.network.URLLoader.lambda$didFinishLoading$5(URLLoader.java:862)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: netscape.javascript.JSException: ReferenceError: Can't find variable: PDFViewerApplication
at javafx.web/com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:157)
at javafx.web/com.sun.webkit.WebPage.twkExecuteScript(Native Method)
at javafx.web/com.sun.webkit.WebPage.executeScript(WebPage.java:1514)
at javafx.web/javafx.scene.web.WebEngine.executeScript(WebEngine.java:972)
at com.dansoftware.pdfdisplayer.PDFDisplayer$2.changed(PDFDisplayer.java:276)
Hi Dan,
I keep getting the exception - netscape.javascript.JSException: ReferenceError: Can't find variable: PDFViewerApplication at line no 276 of PDFDisplayer.java
Googling says it could be because line 276 is getting executed before the js has been fully loaded. However, in your code, it seems you have taken care of that .... So, beats me.
I am using Azul 13 runtime; am loading pdf.js, viewer.html, viewer.js etc from a local file; and loading a local pdf as well.
In desperation, I have downloaded the library on my machine and built it. But, same result. Here's the stacktrace :
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: netscape.javascript.JSException: ReferenceError: Can't find variable: PDFViewerApplication at com.dansoftware.pdfdisplayer.PDFDisplayer$2.changed(PDFDisplayer.java:283) at com.dansoftware.pdfdisplayer.PDFDisplayer$2.changed(PDFDisplayer.java:263) at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181) at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80) at javafx.base/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:74) at javafx.base/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102) at javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113) at javafx.base/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147) at javafx.web/javafx.scene.web.WebEngine$LoadWorker.updateState(WebEngine.java:1251) at javafx.web/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1366) at javafx.web/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1231) at javafx.web/com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2514) at javafx.web/com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2359) at javafx.web/com.sun.webkit.network.URLLoader.twkDidFinishLoading(Native Method) at javafx.web/com.sun.webkit.network.URLLoader.notifyDidFinishLoading(URLLoader.java:871) at javafx.web/com.sun.webkit.network.URLLoader.lambda$didFinishLoading$5(URLLoader.java:862) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174) at java.base/java.lang.Thread.run(Thread.java:830) Caused by: netscape.javascript.JSException: ReferenceError: Can't find variable: PDFViewerApplication at javafx.web/com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:157) at javafx.web/com.sun.webkit.WebPage.twkExecuteScript(Native Method) at javafx.web/com.sun.webkit.WebPage.executeScript(WebPage.java:1514) at javafx.web/javafx.scene.web.WebEngine.executeScript(WebEngine.java:972) at com.dansoftware.pdfdisplayer.PDFDisplayer$2.changed(PDFDisplayer.java:276)