Image quality in pdf is not good

1.2k views Asked by At

I am using icePdf to as a pdf viewer. I have a sample PDF file which has an Image. When i open it with icePdf viewer , the image quality is not very good. Image is not very clear. Here is the code. Can anybody suggest me how to increase the image quality in 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);
    }


}
0

There are 0 answers