/** * */ public boolean print( JasperPrint jasperPrint, int firstPageIndex, int lastPageIndex, boolean withPrintDialog ) throws JRException { return new JRPrinterAWT(jasperReportsContext, jasperPrint).printPages( firstPageIndex, lastPageIndex, withPrintDialog ); }
/** * */ public Image printToImage( JasperPrint jasperPrint, int pageIndex, float zoom ) throws JRException { return new JRPrinterAWT(jasperReportsContext, jasperPrint).printPageToImage(pageIndex, zoom); }
/** */ protected void refreshPage() { if ( jasperPrint == null || jasperPrint.getPages() == null || jasperPrint.getPages().size() == 0 ) { pnlPage.setVisible(false); btnSave.setEnabled(false); btnPrint.setEnabled(false); btnActualSize.setEnabled(false); btnFitPage.setEnabled(false); btnFitWidth.setEnabled(false); btnZoomIn.setEnabled(false); btnZoomOut.setEnabled(false); cmbZoom.setEnabled(false); if (jasperPrint != null) { JOptionPane.showMessageDialog(this, getBundleString("no.pages")); } return; } pnlPage.setVisible(true); btnSave.setEnabled(true); btnPrint.setEnabled(true); btnActualSize.setEnabled(true); btnFitPage.setEnabled(true); btnFitWidth.setEnabled(true); btnZoomIn.setEnabled(zoom < MAX_ZOOM); btnZoomOut.setEnabled(zoom > MIN_ZOOM); cmbZoom.setEnabled(true); Dimension dim = new Dimension( (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image (int)(jasperPrint.getPageHeight() * realZoom) + 8 ); pnlPage.setMaximumSize(dim); pnlPage.setMinimumSize(dim); pnlPage.setPreferredSize(dim); long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE); boolean renderImage; if (maxImageSize <= 0) { renderImage = false; } else { long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom); renderImage = imageSize <= maxImageSize; } lblPage.setRenderImage(renderImage); if (renderImage) { setPageImage(); } pnlLinks.removeAll(); linksMap = new HashMap(); createHyperlinks(); if (!renderImage) { lblPage.setIcon(null); pnlMain.validate(); pnlMain.repaint(); } }
/** */ protected void refreshPage() { if ( jasperPrint == null || jasperPrint.getPages() == null || jasperPrint.getPages().isEmpty() ) { pnlPage.setVisible(false); btnSave.setEnabled(false); btnPrint.setEnabled(false); btnActualSize.setEnabled(false); btnFitPage.setEnabled(false); btnFitWidth.setEnabled(false); btnZoomIn.setEnabled(false); btnZoomOut.setEnabled(false); cmbZoom.setEnabled(false); if (jasperPrint != null) { JOptionPane.showMessageDialog(this, getBundleString("no.pages")); } return; } pnlPage.setVisible(true); btnSave.setEnabled(true); btnPrint.setEnabled(true); btnActualSize.setEnabled(true); btnFitPage.setEnabled(true); btnFitWidth.setEnabled(true); btnZoomIn.setEnabled(zoom < MAX_ZOOM); btnZoomOut.setEnabled(zoom > MIN_ZOOM); cmbZoom.setEnabled(true); Dimension dim = new Dimension( (int)(jasperPrint.getPageWidth() * realZoom) + 8, // 2 from border, 5 from shadow and 1 extra pixel for image (int)(jasperPrint.getPageHeight() * realZoom) + 8 ); pnlPage.setMaximumSize(dim); pnlPage.setMinimumSize(dim); pnlPage.setPreferredSize(dim); long maxImageSize = JRProperties.getLongProperty(VIEWER_RENDER_BUFFER_MAX_SIZE); boolean renderImage; if (maxImageSize <= 0) { renderImage = false; } else { long imageSize = JRPrinterAWT.getImageSize(jasperPrint, realZoom); renderImage = imageSize <= maxImageSize; } lblPage.setRenderImage(renderImage); if (renderImage) { setPageImage(); } pnlLinks.removeAll(); linksMap = new HashMap(); createHyperlinks(); if (!renderImage) { lblPage.setIcon(null); pnlMain.validate(); pnlMain.repaint(); } }