[
https://issues.apache.org/jira/browse/PDFBOX-5120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17297138#comment-17297138
]
Tilman Hausherr commented on PDFBOX-5120:
-----------------------------------------
Is this all about passing your own rendering hints? There is a method
{{setRenderingHints()}}.
> 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: [email protected]
For additional commands, e-mail: [email protected]