[ https://issues.apache.org/jira/browse/PDFBOX-5120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Migowski updated PDFBOX-5120: ------------------------------------ Description: Currently using the following function to create my PageDrawer Parameters: {{ private static PageDrawerParameters createPageDrawerParameters(PDPage page) { Class<PageDrawerParameters> clazz = PageDrawerParameters.class; Constructor<PageDrawerParameters> c; try { c = clazz.getDeclaredConstructor(PDFRenderer.class, PDPage.class, boolean.class, RenderDestination.class, RenderingHints.class); if( !c.isAccessible() ) { c.setAccessible(true); } // TODO: Play with other rendering hints Map<Key,Object> hints = new HashMap<>(); hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); hints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); return c.newInstance(null,page,true,RenderDestination.VIEW,new RenderingHints(hints)); } catch (Exception e) { throw new RuntimeException("Could not instantiate PageDrawerParameters.",e); } } }} Isn't there a better way to achive this? Why isn't the constructor public at all? I need this to create my own PageDrawer because I am writing a PDF Viewer GUI in SWT that uses PDFBox for the rendering and to render I thought it would be nice to be able to use the PageDrawer. was: Currently using the following function to create my PageDrawer Parameters: {{ private static PageDrawerParameters createPageDrawerParameters(PDPage page) { Class<PageDrawerParameters> clazz = PageDrawerParameters.class; Constructor<PageDrawerParameters> c; try { c = clazz.getDeclaredConstructor(PDFRenderer.class, PDPage.class, boolean.class, RenderDestination.class, RenderingHints.class); if( !c.isAccessible() ) { c.setAccessible(true); } // TODO: Play with other rendering hints Map<Key,Object> hints = new HashMap<>(); hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED); hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE); hints.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); hints.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); return c.newInstance(null,page,true,RenderDestination.VIEW,new RenderingHints(hints)); } catch (Exception e) { throw new RuntimeException("Could not instantiate PageDrawerParameters.",e); } }}} Isn't there a better way to achive this? Why isn't the constructor public at all? I need this to create my own PageDrawer because I am writing a PDF Viewer GUI in SWT that uses PDFBox for the rendering and to render I thought it would be nice to be able to use the PageDrawer. > Need to do strange stuff to create my own PageDrawer Parameters > --------------------------------------------------------------- > > Key: PDFBOX-5120 > URL: https://issues.apache.org/jira/browse/PDFBOX-5120 > Project: PDFBox > Issue Type: Bug > Components: Rendering > Reporter: Daniel Migowski > Priority: Major > > Currently using the following function to create my PageDrawer Parameters: > {{ > private static PageDrawerParameters createPageDrawerParameters(PDPage page) { > Class<PageDrawerParameters> clazz = PageDrawerParameters.class; > Constructor<PageDrawerParameters> c; > try { > c = clazz.getDeclaredConstructor(PDFRenderer.class, PDPage.class, > boolean.class, > RenderDestination.class, > RenderingHints.class); > if( !c.isAccessible() ) { > c.setAccessible(true); > } > // TODO: Play with other rendering hints > Map<Key,Object> hints = new HashMap<>(); > hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, > RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED); > hints.put(RenderingHints.KEY_ANTIALIASING, > RenderingHints.VALUE_ANTIALIAS_ON); > hints.put(RenderingHints.KEY_COLOR_RENDERING, > RenderingHints.VALUE_COLOR_RENDER_SPEED); > hints.put(RenderingHints.KEY_DITHERING, > RenderingHints.VALUE_DITHER_DISABLE); > hints.put(RenderingHints.KEY_FRACTIONALMETRICS, > RenderingHints.VALUE_FRACTIONALMETRICS_ON); > hints.put(RenderingHints.KEY_INTERPOLATION, > RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR); > hints.put(RenderingHints.KEY_RENDERING, > RenderingHints.VALUE_RENDER_SPEED); > hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, > RenderingHints.VALUE_TEXT_ANTIALIAS_ON); > return c.newInstance(null,page,true,RenderDestination.VIEW,new > RenderingHints(hints)); > } catch (Exception e) { > throw new RuntimeException("Could not instantiate > PageDrawerParameters.",e); > } > } > }} > Isn't there a better way to achive this? Why isn't the constructor public at > all? I need this to create my own PageDrawer because I am writing a PDF > Viewer GUI in SWT that uses PDFBox for the rendering and to render I thought > it would be nice to be able to use the PageDrawer. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org