当前位置: 首页>>代码示例>>Java>>正文


Java JRGraphics2DExporter.setConfiguration方法代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.export.JRGraphics2DExporter.setConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java JRGraphics2DExporter.setConfiguration方法的具体用法?Java JRGraphics2DExporter.setConfiguration怎么用?Java JRGraphics2DExporter.setConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jasperreports.engine.export.JRGraphics2DExporter的用法示例。


在下文中一共展示了JRGraphics2DExporter.setConfiguration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: print

import net.sf.jasperreports.engine.export.JRGraphics2DExporter; //导入方法依赖的package包/类
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
	if (Thread.interrupted())
	{
		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(jasperReportsContext);
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
		output.setGraphics2D((Graphics2D)graphics);
		exporter.setExporterOutput(output);
		SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration();
		configuration.setPageIndex(pageIndex);
		exporter.setConfiguration(configuration);
		exporter.exportReport();
	}
	catch (JRException e)
	{
		if (log.isDebugEnabled())
		{
			log.debug("Print failed.", e);
		}

		throw new PrinterException(e.getMessage()); //NOPMD
	}

	return Printable.PAGE_EXISTS;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:40,代码来源:JRPrinterAWT.java

示例2: printPageToImage

import net.sf.jasperreports.engine.export.JRGraphics2DExporter; //导入方法依赖的package包/类
/**
 *
 */
public Image printPageToImage(int pageIndex, float zoom) throws JRException
{
	PrintPageFormat pageFormat = jasperPrint.getPageFormat(pageIndex);
	
	Image pageImage = new BufferedImage(
		(int)(pageFormat.getPageWidth() * zoom) + 1,
		(int)(pageFormat.getPageHeight() * zoom) + 1,
		BufferedImage.TYPE_INT_RGB
		);

	JRGraphics2DExporter exporter = new JRGraphics2DExporter(jasperReportsContext);
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
	output.setGraphics2D((Graphics2D)pageImage.getGraphics());
	exporter.setExporterOutput(output);
	SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration();
	configuration.setPageIndex(pageIndex);
	configuration.setZoomRatio(zoom);
	exporter.setConfiguration(configuration);
	exporter.exportReport();
	
	return pageImage;
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:27,代码来源:JRPrinterAWT.java

示例3: printPageToImage

import net.sf.jasperreports.engine.export.JRGraphics2DExporter; //导入方法依赖的package包/类
/**
 *
 */
public Image printPageToImage(int pageIndex, float zoom) throws JRException
{
	PrintPageFormat pageFormat = jasperPrint.getPageFormat(pageIndex);
	
	int rasterWidth = (int) Math.ceil(pageFormat.getPageWidth() * zoom);
	int rasterHeight = (int) Math.ceil(pageFormat.getPageHeight() * zoom);
	Image pageImage = new BufferedImage(
		rasterWidth,
		rasterHeight,
		BufferedImage.TYPE_INT_RGB
		);
	
	Graphics imageGraphics = pageImage.getGraphics();
	Graphics graphics = imageGraphics.create();
	//filling the image background here because JRGraphics2DExporter.exportPage uses the page size
	//which can be smaller than the image size due to Math.ceil above
	graphics.setColor(Color.white);
	graphics.fillRect(0, 0, rasterWidth, rasterHeight);

	JRGraphics2DExporter exporter = new JRGraphics2DExporter(jasperReportsContext);
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
	output.setGraphics2D((Graphics2D) imageGraphics);
	exporter.setExporterOutput(output);
	SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration();
	configuration.setPageIndex(pageIndex);
	configuration.setZoomRatio(zoom);
	configuration.setWhitePageBackground(false);
	exporter.setConfiguration(configuration);
	exporter.exportReport();
	
	return pageImage;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:37,代码来源:JRPrinterAWT.java

示例4: renderPage

import net.sf.jasperreports.engine.export.JRGraphics2DExporter; //导入方法依赖的package包/类
private Image renderPage() throws Throwable {
	JasperPrint jr = rViewer.getReport();
	BufferedImage img = new BufferedImage((int) (jr.getPageWidth() * zoom) + 1, (int) (jr.getPageHeight() * zoom) + 1, BufferedImage.TYPE_INT_RGB);

	Graphics2D g2d = (Graphics2D) img.getGraphics();
	try {
		JRGraphics2DExporter exporter = new JRGraphics2DExporter(jContext);
		exporter.setExporterInput(new SimpleExporterInput(jr));

		SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
		output.setGraphics2D(g2d);
		exporter.setExporterOutput(output);

		SimpleGraphics2DReportConfiguration grxConfiguration = new SimpleGraphics2DReportConfiguration();
		grxConfiguration.setPageIndex(rViewer.getPageIndex());
		grxConfiguration.setZoomRatio(zoom);
		exporter.setConfiguration(grxConfiguration);

		exporter.exportReport();

		g2d.setColor(Color.black);
		g2d.setStroke(new BasicStroke(1));
		g2d.drawRect(0, 0, (int) (img.getWidth() / zoom), (int) (img.getHeight() / zoom));
	} finally {
		g2d.dispose();
	}
	return UIUtils.awt2Swt(img);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:29,代码来源:ViewerCanvas.java

示例5: print

import net.sf.jasperreports.engine.export.JRGraphics2DExporter; //导入方法依赖的package包/类
/**
 *
 */
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
	if (Thread.interrupted())
	{
		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(jasperReportsContext);
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
		output.setGraphics2D((Graphics2D)graphics);
		exporter.setExporterOutput(output);
		SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration();
		configuration.setPageIndex(pageIndex);
		exporter.setConfiguration(configuration);
		exporter.exportReport();
	}
	catch (JRException e)
	{
		if (log.isDebugEnabled())
		{
			log.debug("Print failed.", e);
		}

		throw new PrinterException(e.getMessage()); //NOPMD
	}

	return Printable.PAGE_EXISTS;
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:42,代码来源:JRPrinterAWT.java


注:本文中的net.sf.jasperreports.engine.export.JRGraphics2DExporter.setConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。