1

我正在使用 icePdf 作为 pdf 查看器。我有一个包含图像的示例 PDF 文件。当我用 icePdf viewer 打开它时,图像质量不是很好。图像不是很清晰。这是代码。谁能建议我如何提高icePDF中的图像质量

import javax.swing.JFrame;

import javax.swing.JPanel;

import org.icepdf.ri.common.ComponentKeyBinding;
import org.icepdf.ri.common.SwingController;
import org.icepdf.ri.common.SwingViewBuilder;
import org.icepdf.core.pobjects.fonts.*;
import org.icepdf.core.*;

public class ViewerComponentExample 
{
    public static void main(String args[]) 
    {
        String filepath = "C:/Users/vishalt/Workspaces/Eclipse 4.2 Java/htmltopdf/src/XML/output/hk.pdf";


        // build a controller
        SwingController controller = new SwingController();

        // Build a SwingViewFactory configured with the controller
        SwingViewBuilder factory = new SwingViewBuilder(controller);
        JPanel viewerComponentPanel = factory.buildViewerPanel();

        // add copy keyboard command
        ComponentKeyBinding.install(controller, viewerComponentPanel);

        // add interactive mouse link annotation support via callback
        controller.getDocumentViewController().setAnnotationCallback(
        new org.icepdf.ri.common.MyAnnotationCallback(
        controller.getDocumentViewController()));

        // Use the factory to build a JPanel that is pre-configured
        //with a complete, active Viewer UI.
        // Create a JFrame to display the panel in
        JFrame window = new JFrame("Metrics Wizard Help");
        window.getContentPane().add(viewerComponentPanel);
        window.pack();
        window.setVisible(true);
        System.getProperties().put("org.icepdf.core.scaleImages", "true"); 
        // Open a PDF document to view
         controller.openDocument(filepath);
    }


}
4

0 回答 0