Search code examples
javapdfjxbrowser

JxBrowser 6.19.1 Issue on PDF printing


I am currently updating the JxBrowser from 6.14.2 to 6.19.1 and currently found the JxBrowser malfunction when clicking print button in the chromium extension pdf. Here are the sample code:

Browser browser = new Browser();
BrowserView browserView = new BrowserView(browser);

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.add(browserView, BorderLayout.CENTER);
frame.setSize(700, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);

browser.loadURL("https://abc.xyz/investor/");

Just open some of the pdf files, which will open a new screen. And opening these pdf files (with says, at least 6 ~ 7 pdf files, opened), and click print button on one of them, then some of the pdf file cannot be printed while some of the pdf file can be printed.

Remarks: these pdf files which cannot be printed = printing dialog does not prompt out

Here are the exception being thrown:

    04:14:01 SEVERE: Failed to execute task
java.lang.IllegalArgumentException: The '6' frame ID doesn't exist.
    at com.teamdev.jxbrowser.chromium.Browser.a(SourceFile:2873)
    at com.teamdev.jxbrowser.chromium.Browser.getDocument(SourceFile:1534)
    at com.teamdev.jxbrowser.chromium.e.run(SourceFile:4056)
    at com.teamdev.jxbrowser.chromium.internal.r.run(SourceFile:65)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
04:14:02 SEVERE: Failed to execute task
java.lang.IllegalArgumentException: The '12' frame ID doesn't exist.
    at com.teamdev.jxbrowser.chromium.Browser.a(SourceFile:2873)
    at com.teamdev.jxbrowser.chromium.Browser.getDocument(SourceFile:1534)
    at com.teamdev.jxbrowser.chromium.e.run(SourceFile:4056)
    at com.teamdev.jxbrowser.chromium.internal.r.run(SourceFile:65)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

These are referring 2 of the clicks that cannot be responsed correctly. Seems there are some bugs in the JxBrowser. Please let me know if this is my error or I need to do some setting before using it correctly.

However, it should be noted that 6.14.2 seems does not have such issue.

Hope someone can help me solve the issue. Coz my company uses pdf functionality a lot. Thanks.

Btw, I am using Windows 7 for current development. Thanks.


Solution

  • The described behavior is a known issue in JxBrowser 6.19.1. Unfortunately, there is no way to workaround it in your application.

    This issue is expected to be fixed in the next version of JxBrowser.