Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Bug
-
None
-
None
-
None
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() )
// 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)
}
}}
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.