1

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);
    }


}
Vishal Thakur
  • 141
  • 4
  • 16
  • 3
    Scaling is handling a little differently in ICEpdf 5.0, the system property -Dorg.icepdf.core.scaleImages=true is no longer valid. Instead -Dorg.icepdf.core.imageReference=scaled should be used. More information on the 5.0 system properties can be found here, http://www.icesoft.org/wiki/display/PDF/System+Properties . imageReference here http://www.icesoft.org/wiki/display/PDF/Imaging+Options – RossC Dec 17 '13 at 09:31
  • @Rossc that line should just be removed. the default will not scale images. –  Dec 17 '13 at 09:33
  • Oh Ok, sorry I updated my comment, but seems irrelevant to the issue at hand if that doesn't affect it directly. Information from here: http://www.icesoft.org/JForum/posts/list/21804.page#sthash.ifqkwDeJ.dpbs – RossC Dec 17 '13 at 09:33
  • I am totally new to this framework. I just tried System.getProperties().put("org.icepdf.core.scaleImages", "true") hoping it could help , but it didn't. Sorry , i didn't get the control part . is there any way toimprove the image quality?? – Vishal Thakur Dec 17 '13 at 09:35
  • 1
    maybe this can help . looks like a similar problem. http://www.icesoft.org/JForum/posts/list/22243.page#sthash.n9KLNVco.dpbs –  Dec 17 '13 at 09:39

0 Answers0