I’m using JPedal 7 with Java Swing. PDFs containing just vector data are displayed fine. But we also have PDFs containing 1-bit bitmaps: black & white scans, bitmaps inside PDFs (included images, converted text). If they are downscaled I see aliasing effects resulting in hard readable documents. Such images are not anti-aliased but just scaled to 1-bit colordepth.
Is there a way to change this. Is there a function to activate anti-aliasing on scaling 1-bit-bitmaps or a handler similar to CustomPrintHintingHandler for display?
You are able to set the hinting to be used on page rendering using the static variable BaseDisplay.userHints.
This variable is a RenderingHints object which will allow you to set the hints you wish to use.
Is this what you require?
Thank you Kieran,
thank you for the hint.
I tried this in a static initializer or the constructor of my panel wich includes the PdfDecoder:
RenderingHints renderingHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); renderingHints.add( new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON ) ); renderingHints.add( new RenderingHints( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON ) ); BaseDisplay.userHints = renderingHints;
It doesn’t change much, in the end I get worse results. The main thing is, black and white bitmaps are just scaled to black and white bitmaps with no applied anti-aliasing. Is there a way to tell the Decoder to scale bitmaps to colour or grayscale images and apply anti-aliasing?
Another question: Are features like the BaseDisplay class documented anywhere so I can find any information about them? The JavaDoc does not include the render package.
The BaseDisplay class is not documented as it is intended as an internal class, the userHints variable is present for those who need to alter the default RenderingHints. I believe I misunderstood your original message and these hints would be of no use to you as you discovered.
Could you submit a bug report with the file in question so we can see the behaviour and best advise you on how the desired behaviour can be achieved.