[ 
https://issues.apache.org/jira/browse/PDFBOX-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson closed PDFBOX-2506.
-------------------------------
    Resolution: Not a Problem

Setting hints in PageDrawer works fine - what possible mechanism would there be 
for it not working? It's just a Graphics2D.

PageDrawer sets hints at numerous points, including disabling anti-aliasing at 
various other points during rendering. In general, anti-aliasing does not work 
well in 1.8 and fixing it is not as simple as just enabling the hints, as this 
causes other rendering issues. This has all been fixed in the 2.0 version on 
SVN.

> Antialiasing Hints set into Graphics2D does not seem to work after it was 
> already used.
> ---------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-2506
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2506
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Ankit Khanal
>
> The following in Pagedrawer.java does not seem to work.
> {code}
> public void drawPage( Graphics g, PDPage p, Dimension pageDimension ) throws 
> IOException
>     {
>         graphics = (Graphics2D)g;
> //hints set here does not seem to work
>         graphics.setRenderingHint( RenderingHints.KEY_ANTIALIASING, 
> RenderingHints.VALUE_ANTIALIAS_ON );
>         graphics.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, 
> RenderingHints.VALUE_FRACTIONALMETRICS_ON );
> {code}
> In PDPage.java, the Graphics2D object is first manipulated before bing passed 
> over to PageDrawer. Setting of hints into Graphics2D in PageDrawer does not 
> seem to work.
> {code}
>     public BufferedImage convertToImage(int imageType, int resolution) throws 
> IOException
>     {
>         Graphics2D graphics = (Graphics2D)retval.getGraphics();
> //possible fix: hints set here works
>         graphics.setBackground( TRANSPARENT_WHITE );
>         graphics.clearRect( 0, 0, retval.getWidth(), retval.getHeight() );
>         graphics.translate(translateX,translateY);
>         graphics.rotate((float)Math.toRadians(rotationAngle));
>         graphics.scale( scaling, scaling );
>         PageDrawer drawer = new PageDrawer();
>         drawer.drawPage( graphics, this, pageDimension );
>         drawer.dispose();
>         graphics.dispose();
>         return retval;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to