Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing JRAbstractSvgRenderer (JRRenderable) in fillReport
    primarykey
    data
    text
    <p>I'm passing a simple implementation of JRAbstractSvgRenderer (taken from the ireports pdf manual) as one of the parameters using JasperFillManager.fillReport. </p> <pre><code>public class CustomImageRenderer extends JRAbstractSvgRenderer { @Override public void render(Graphics2D g2d, Rectangle2D rect) throws JRException { System.out.println("CustomImageRenderer.render"); // Save the Graphics2D affine transform AffineTransform savedTrans = g2d.getTransform(); Font savedFont = g2d.getFont(); // Paint a nice background... g2d.setPaint(new GradientPaint(0, 0, Color.ORANGE, 0, (int) rect.getHeight(), Color.PINK)); g2d.fillRect(0, 0, (int) rect.getWidth(), (int) rect.getHeight()); Font myfont = new Font("Arial Black", Font.PLAIN, 50); g2d.setFont(myfont); FontRenderContext frc = g2d.getFontRenderContext(); String text = new String("JasperReports!!!"); TextLayout textLayout = new TextLayout(text, myfont, frc); Shape outline = textLayout.getOutline(null); Rectangle r = outline.getBounds(); // Translate the graphic to center the text g2d.translate( (rect.getWidth() / 2) - (r.width / 2), rect.getHeight() / 2 + (r.height / 2)); g2d.setColor(Color.BLACK); g2d.draw(outline); // Restore the Graphics2D affine transform g2d.setFont(savedFont); g2d.setTransform(savedTrans); } } </code></pre> <p>...</p> <pre><code>Map parameters = new HashMap(); parameters.put("IMAGEPARAM", new CustomImageRenderer()); </code></pre> <p>... </p> <pre><code>JasperPrint jasperPrint = JasperFillManager.fillReport(path, parameters, conn); </code></pre> <p>I have linked an Image component in my report to this parameter but the image does not display. What am I missing here?</p> <p>What I'd like to accomplish is to eventually pass an already created Java2D image to my report but I don't want pass it as a raster image.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload