Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)

JxBrowser allows displaying PDF document using Chromium PDF Viewer plugin. You can display PDF file available on a remote web server (using URL of the PDF file) or a PDF file located on your local file system.(JxBrowser允许使用Chromium PDF Viewer插件显示PDF文档。您可以显示远程Web服务器上可用的PDF文件(使用PDF文件的URL)或本地文件系统上的PDF文件。)


import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;

import javax.swing.*;
import java.awt.*;

 * The sample demonstrates capability of JxBrowser to display PDF documents using
 * built-in Chromium PDF Viewer.
public class PDFViewerSample {
    public static void main(String[] args) {
        Browser browser = new Browser();
        BrowserView view = new BrowserView(browser);

        JFrame frame = new JFrame();
        frame.add(view, BorderLayout.CENTER);
        frame.setSize(800, 600);