Java 类net.sf.jasperreports.engine.export.JRGraphics2DExporterParameter 实例源码

项目:openbravo-pos    文件:JRPrinterAWT300.java   
/**
 *
 */
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
    if (Thread.currentThread().isInterrupted())
    {
        throw new PrinterException("Current thread interrupted.");
    }

    pageIndex += pageOffset;

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
        return Printable.NO_SUCH_PAGE;
    }

    try
    {
        JRGraphics2DExporter exporter = new JRGraphics2DExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.exportReport();
    }
    catch (JRException e)
    {
        e.printStackTrace();
        throw new PrinterException(e.getMessage());
    }

    return Printable.PAGE_EXISTS;
}
项目:openbravo-pos    文件:JRPrinterAWT300.java   
/**
 *
 */
private Image printPageToImage(int pageIndex, float zoom) throws JRException
{
    Image pageImage = new BufferedImage(
        (int)(jasperPrint.getPageWidth() * zoom) + 1,
        (int)(jasperPrint.getPageHeight() * zoom) + 1,
        BufferedImage.TYPE_INT_RGB
        );

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());
    exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom));
    exporter.exportReport();

    return pageImage;
}
项目:wifepos    文件:JRPrinterAWT300.java   
/**
 *
 */
private Image printPageToImage(int pageIndex, float zoom) throws JRException
{
    Image pageImage = new BufferedImage(
        (int)(jasperPrint.getPageWidth() * zoom) + 1,
        (int)(jasperPrint.getPageHeight() * zoom) + 1,
        BufferedImage.TYPE_INT_RGB
        );

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());
    exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom));
    exporter.exportReport();

    return pageImage;
}
项目:micro-Blagajna    文件:JRPrinterAWT300.java   
/**
 *
 */
private Image printPageToImage(int pageIndex, float zoom) throws JRException
{
    Image pageImage = new BufferedImage(
        (int)(jasperPrint.getPageWidth() * zoom) + 1,
        (int)(jasperPrint.getPageHeight() * zoom) + 1,
        BufferedImage.TYPE_INT_RGB
        );

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());
    exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom));
    exporter.exportReport();

    return pageImage;
}
项目:unicenta    文件:JRPrinterAWT300.java   
/**
 *
 */
private Image printPageToImage(int pageIndex, float zoom) throws JRException
{
    Image pageImage = new BufferedImage(
        (int)(jasperPrint.getPageWidth() * zoom) + 1,
        (int)(jasperPrint.getPageHeight() * zoom) + 1,
        BufferedImage.TYPE_INT_RGB
        );

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());
    exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom));
    exporter.exportReport();

    return pageImage;
}
项目:OpenbravoPOS    文件:JRPrinterAWT300.java   
/**
 *
 */
private Image printPageToImage(int pageIndex, float zoom) throws JRException
{
    Image pageImage = new BufferedImage(
        (int)(jasperPrint.getPageWidth() * zoom) + 1,
        (int)(jasperPrint.getPageHeight() * zoom) + 1,
        BufferedImage.TYPE_INT_RGB
        );

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());
    exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom));
    exporter.exportReport();

    return pageImage;
}
项目:wifepos    文件:JRPrinterAWT300.java   
/**
 *
 */
   @Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
    if (Thread.currentThread().isInterrupted())
    {
        throw new PrinterException("Current thread interrupted.");
    }

    pageIndex += pageOffset;

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
        return Printable.NO_SUCH_PAGE;
    }

    try
    {
        JRGraphics2DExporter exporter = new JRGraphics2DExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.exportReport();
    }
    catch (JRException e)
    {
        throw new PrinterException(e.getMessage());
    }

    return Printable.PAGE_EXISTS;
}
项目:micro-Blagajna    文件:JRPrinterAWT300.java   
/**
 *
 */
   @Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
    if (Thread.currentThread().isInterrupted())
    {
        throw new PrinterException("Current thread interrupted.");
    }

    pageIndex += pageOffset;

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
        return Printable.NO_SUCH_PAGE;
    }

    try
    {
        JRGraphics2DExporter exporter = new JRGraphics2DExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.exportReport();
    }
    catch (JRException e)
    {
        throw new PrinterException(e.getMessage());
    }

    return Printable.PAGE_EXISTS;
}
项目:omr    文件:ParticipationHelper.java   
/**
 * Cria arquivos de imagens das provas. Utilizado exclusivamente em depuracao de codigo
 * @param jp
 * @param eventVO 
 */
protected static void logPrintImages(JasperPrint jp, EventVO eventVO) {
    if(!log.isDebugEnabled()){
        return;
    }

    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/evento_"+eventVO.getPK()+"_pg_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            file.mkdirs();

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 900, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:OMRModelTest.java   
/**
 * @param jp
 */
protected void printImages(JasperPrint jp) {
    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/pagina_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 800, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:ParticipationHelper.java   
/**
 * Cria arquivos de imagens das provas. Utilizado exclusivamente em depuracao de codigo
 * @param jp
 * @param eventVO 
 */
protected static void logPrintImages(JasperPrint jp, EventVO eventVO) {
    if(!log.isDebugEnabled()){
        return;
    }

    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/evento_"+eventVO.getPK()+"_pg_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            file.mkdirs();

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 900, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:OMRModelTest.java   
/**
 * @param jp
 */
protected void printImages(JasperPrint jp) {
    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/pagina_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 800, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:ParticipationHelper.java   
/**
 * Cria arquivos de imagens das provas. Utilizado exclusivamente em depuracao de codigo
 * @param jp
 * @param eventVO 
 */
protected static void logPrintImages(JasperPrint jp, EventVO eventVO) {
    if(!log.isDebugEnabled()){
        return;
    }

    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/evento_"+eventVO.getPK()+"_pg_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            file.mkdirs();

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 900, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:OMRModelTest.java   
/**
 * @param jp
 */
protected void printImages(JasperPrint jp) {
    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/pagina_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 800, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:ParticipationHelper.java   
/**
 * Cria arquivos de imagens das provas. Utilizado exclusivamente em depuracao de codigo
 * @param jp
 * @param eventVO 
 */
protected static void logPrintImages(JasperPrint jp, EventVO eventVO) {
    if(!log.isDebugEnabled()){
        return;
    }

    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/evento_"+eventVO.getPK()+"_pg_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            file.mkdirs();

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 900, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:omr    文件:OMRModelTest.java   
/**
 * @param jp
 */
protected void printImages(JasperPrint jp) {
    try {

        int pageCount = jp.getPages().size();

        for (int i = 0; i < pageCount; i++) {

            File file = new File("result/pagina_" + (i + 1) + "."+ JazzOMRImageParser.IMG_EXT);

            JRGraphics2DExporter graphics2dExporter = new JRGraphics2DExporter();
            BufferedImage bi = new BufferedImage(600, 800, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics graphics = bi.createGraphics();
            graphics2dExporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
            graphics2dExporter.setParameter(JRGraphics2DExporterParameter.PAGE_INDEX, i);
            graphics2dExporter.exportReport();

            ImageIO.write(bi, JazzOMRImageParser.IMG_EXT, file);
        }

    } catch (JRException e1) {
        throw new RuntimeException("erro", e1);
    } catch (IOException e) {
        throw new RuntimeException("erro", e);
    }
}
项目:unicenta    文件:JRPrinterAWT300.java   
/**
 *
 */
   @Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
    if (Thread.currentThread().isInterrupted())
    {
        throw new PrinterException("Current thread interrupted.");
    }

    pageIndex += pageOffset;

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
        return Printable.NO_SUCH_PAGE;
    }

    try
    {
        JRGraphics2DExporter exporter = new JRGraphics2DExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.exportReport();
    }
    catch (JRException e)
    {
        throw new PrinterException(e.getMessage());
    }

    return Printable.PAGE_EXISTS;
}
项目:OpenbravoPOS    文件:JRPrinterAWT300.java   
/**
 *
 */
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
    if (Thread.currentThread().isInterrupted())
    {
        throw new PrinterException("Current thread interrupted.");
    }

    pageIndex += pageOffset;

    if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
    {
        return Printable.NO_SUCH_PAGE;
    }

    try
    {
        JRGraphics2DExporter exporter = new JRGraphics2DExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.exportReport();
    }
    catch (JRException e)
    {
        e.printStackTrace();
        throw new PrinterException(e.getMessage());
    }

    return Printable.PAGE_EXISTS;
}
项目:openbravo-pos    文件:JRViewer300.java   
/**
 * 
 */
protected void paintPage(Graphics2D grx)
{
    if (pageError)
    {
        paintPageError(grx);
        return;
    }

    try
    {
        if (exporter == null)
        {
            exporter = getGraphics2DExporter();
        }
        else
        {
            exporter.reset();
        }

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx.create());
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(realZoom));
        exporter.setParameter(JRExporterParameter.OFFSET_X, new Integer(1)); //lblPage border
        exporter.setParameter(JRExporterParameter.OFFSET_Y, new Integer(1));
        exporter.exportReport();
    }
    catch(Exception e)
    {
        pageError = true;
        e.printStackTrace();

        paintPageError(grx);
        SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
                JOptionPane.showMessageDialog(JRViewer300.this, getBundleString("error.displaying"));
            }
        });
    }

}
项目:wifepos    文件:JRViewer300.java   
/**
 * 
    * @param grx
    * @param grx
 */
protected void paintPage(Graphics2D grx)
{
    if (pageError)
    {
        paintPageError(grx);
        return;
    }

    try
    {
        if (exporter == null)
        {
            exporter = getGraphics2DExporter();
        }
        else
        {
            exporter.reset();
        }

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx.create());
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(realZoom));
        exporter.setParameter(JRExporterParameter.OFFSET_X, new Integer(1)); //lblPage border
        exporter.setParameter(JRExporterParameter.OFFSET_Y, new Integer(1));
        exporter.exportReport();
    }
    catch(Exception e)
    {
        pageError = true;

        paintPageError(grx);
        SwingUtilities.invokeLater(new Runnable()
        {
               @Override
            public void run()
            {
                JOptionPane.showMessageDialog(JRViewer300.this, getBundleString("error.displaying"));
            }
        });
    }

}
项目:micro-Blagajna    文件:JRViewer300.java   
/**
 * 
    * @param grx
    * @param grx
 */
protected void paintPage(Graphics2D grx)
{
    if (pageError)
    {
        paintPageError(grx);
        return;
    }

    try
    {
        if (exporter == null)
        {
            exporter = getGraphics2DExporter();
        }
        else
        {
            exporter.reset();
        }

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx.create());
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(realZoom));
        exporter.setParameter(JRExporterParameter.OFFSET_X, new Integer(1)); //lblPage border
        exporter.setParameter(JRExporterParameter.OFFSET_Y, new Integer(1));
        exporter.exportReport();
    }
    catch(Exception e)
    {
        pageError = true;

        paintPageError(grx);
        SwingUtilities.invokeLater(new Runnable()
        {
               @Override
            public void run()
            {
                JOptionPane.showMessageDialog(JRViewer300.this, getBundleString("error.displaying"));
            }
        });
    }

}
项目:omr    文件:JasperTeste3.java   
public static void createImage() throws FileNotFoundException, JRException, IOException {
    // TODO Auto-generated method stub

    InputStream jrxmlStream = new FileInputStream("/home/darcio/workspace/modules/JazzAV/bsn/src/main/resources/modeloAdes1.jrxml");

    FileOutputStream out = new FileOutputStream("/home/darcio/workspace/modules/JazzAV/bsn/src/main/resources/modeloAdes1.png");


    JasperReport compiled = JasperCompileManager.compileReport(jrxmlStream);


    Map rootMap = new HashMap();
    JasperPrint jasperPrint = JasperFillManager.fillReport(compiled, rootMap, new JREmptyDataSource(1));

    int pageIndex = 0;

    BufferedImage pageImage = new BufferedImage(jasperPrint.getPageWidth() + 1, jasperPrint.getPageHeight() + 1, BufferedImage.TYPE_INT_RGB);

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());


    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, 0.6f);


    exporter.exportReport();
    ImageIO.write(pageImage, "png", out);
}
项目:unicenta    文件:JRViewer300.java   
/**
 * 
    * @param grx
    * @param grx
 */
protected void paintPage(Graphics2D grx)
{
    if (pageError)
    {
        paintPageError(grx);
        return;
    }

    try
    {
        if (exporter == null)
        {
            exporter = getGraphics2DExporter();
        }
        else
        {
            exporter.reset();
        }

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx.create());
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(realZoom));
        exporter.setParameter(JRExporterParameter.OFFSET_X, new Integer(1)); //lblPage border
        exporter.setParameter(JRExporterParameter.OFFSET_Y, new Integer(1));
        exporter.exportReport();
    }
    catch(Exception e)
    {
        pageError = true;

        paintPageError(grx);
        SwingUtilities.invokeLater(new Runnable()
        {
               @Override
            public void run()
            {
                JOptionPane.showMessageDialog(JRViewer300.this, getBundleString("error.displaying"));
            }
        });
    }

}
项目:OpenbravoPOS    文件:JRViewer300.java   
/**
 * 
 */
protected void paintPage(Graphics2D grx)
{
    if (pageError)
    {
        paintPageError(grx);
        return;
    }

    try
    {
        if (exporter == null)
        {
            exporter = getGraphics2DExporter();
        }
        else
        {
            exporter.reset();
        }

        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx.create());
        exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
        exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(realZoom));
        exporter.setParameter(JRExporterParameter.OFFSET_X, new Integer(1)); //lblPage border
        exporter.setParameter(JRExporterParameter.OFFSET_Y, new Integer(1));
        exporter.exportReport();
    }
    catch(Exception e)
    {
        pageError = true;
        e.printStackTrace();

        paintPageError(grx);
        SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
                JOptionPane.showMessageDialog(JRViewer300.this, getBundleString("error.displaying"));
            }
        });
    }

}
项目:omr    文件:JasperTeste.java   
public static void createImage() throws FileNotFoundException, JRException, IOException {
    // TODO Auto-generated method stub

    InputStream jrxmlStream = new FileInputStream("/home/darcio/workspace/modules/JazzAV/bsn/src/main/resources/modeloAdes1.jrxml");

    FileOutputStream out = new FileOutputStream("/home/darcio/workspace/modules/JazzAV/bsn/src/main/resources/modeloAdes1.png");


    JasperReport compiled = JasperCompileManager.compileReport(jrxmlStream);


    Map rootMap = new HashMap();
    JasperPrint jasperPrint = JasperFillManager.fillReport(compiled, rootMap, new JREmptyDataSource(1));

    int pageIndex = 0;

    BufferedImage pageImage = new BufferedImage(jasperPrint.getPageWidth() + 1, jasperPrint.getPageHeight() + 1, BufferedImage.TYPE_INT_RGB);

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());


    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, 0.6f);


    exporter.exportReport();
    ImageIO.write(pageImage, "png", out);
}
项目:omr    文件:JasperTeste2.java   
public static void createImage() throws FileNotFoundException, JRException, IOException {
    // TODO Auto-generated method stub

    InputStream jrxmlStream = new FileInputStream("/home/darcio/workspace/modules/JazzAV/bsn/src/main/resources/modeloAdes1.jrxml");

    FileOutputStream out = new FileOutputStream("/home/darcio/workspace/modules/JazzAV/bsn/src/main/resources/modeloAdes1.png");


    JasperReport compiled = JasperCompileManager.compileReport(jrxmlStream);


    Map rootMap = new HashMap();
    JasperPrint jasperPrint = JasperFillManager.fillReport(compiled, rootMap, new JREmptyDataSource(1));

    int pageIndex = 0;

    BufferedImage pageImage = new BufferedImage(jasperPrint.getPageWidth() + 1, jasperPrint.getPageHeight() + 1, BufferedImage.TYPE_INT_RGB);

    JRGraphics2DExporter exporter = new JRGraphics2DExporter();
    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());


    exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, 0.6f);


    exporter.exportReport();
    ImageIO.write(pageImage, "png", out);
}