c.setPage(pageNo, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);
public void paintPage(Graphics2D g, int pageNo) { Layer root = getRootLayer(); if (root == null) { throw new RuntimeException("Document needs layout"); } if (pageNo < 0 || pageNo >= root.getPages().size()) { throw new IllegalArgumentException("Page " + pageNo + " is not between 0 " + "and " + root.getPages().size()); } RenderingContext c = newRenderingContext(g); PageBox page = (PageBox)root.getPages().get(pageNo); c.setPageCount(root.getPages().size()); c.setPage(pageNo, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Shape working = g.getClip(); Rectangle content = page.getPrintClippingBounds(c); g.clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT); g.translate(left, top); root.paint(c); g.translate(-left, -top); g.setClip(working); }
bounds.height += 1; if (working.intersects(bounds)) { page.paintBackground(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN); page.paintMarginAreas(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN); page.paintBorder(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN);
bounds.height += 1; if (working.intersects(bounds)) { page.paintBackground(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN); page.paintMarginAreas(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN); page.paintBorder(c, pagePaintingClearanceWidth, Layer.PAGED_MODE_SCREEN);
private void paintPage(RenderingContext c, PdfWriter writer, PageBox page) { provideMetadataToPage(writer, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Shape working = _outputDevice.getClip(); Rectangle content = page.getPrintClippingBounds(c); _outputDevice.clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT); _outputDevice.translate(left, top); _root.getLayer().paint(c); _outputDevice.translate(-left, -top); _outputDevice.setClip(working); }
private void paintPage(RenderingContext c, PdfWriter writer, PageBox page) throws IOException { provideMetadataToPage(writer, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Shape working = _outputDevice.getClip(); Rectangle content = page.getPrintClippingBounds(c); if (isScaleToFit()) { int pageWidth = calculateWidth(c, page); content.setSize(pageWidth, (int) content.getSize().getHeight());//RTD - to change } _outputDevice.clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT); _outputDevice.translate(left, top); _root.getLayer().paint(c); _outputDevice.translate(-left, -top); _outputDevice.setClip(working); }
private void paintPage(RenderingContext c, PdfWriter writer, PageBox page) { provideMetadataToPage(writer, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Shape working = _outputDevice.getClip(); Rectangle content = page.getPrintClippingBounds(c); _outputDevice.clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT); _outputDevice.translate(left, top); _root.getLayer().paint(c); _outputDevice.translate(-left, -top); _outputDevice.setClip(working); }
bounds.height += 1; if (working.intersects(bounds)) { page.paintBackground(c, PAGE_PAINTING_CLEARANCE, Layer.PAGED_MODE_SCREEN); page.paintMarginAreas(c, PAGE_PAINTING_CLEARANCE, Layer.PAGED_MODE_SCREEN); page.paintBorder(c, PAGE_PAINTING_CLEARANCE, Layer.PAGED_MODE_SCREEN);
private void paintPage(RenderingContext c, PdfWriter writer, PageBox page) { provideMetadataToPage(writer, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Shape working = _outputDevice.getClip(); Rectangle content = page.getPrintClippingBounds(c); _outputDevice.clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT); _outputDevice.translate(left, top); _root.getLayer().paint(c); _outputDevice.translate(-left, -top); _outputDevice.setClip(working); }
private void paintPage(RenderingContext c, PdfWriter writer, PageBox page) { provideMetadataToPage(writer, page); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Shape working = _outputDevice.getClip(); Rectangle content = page.getPrintClippingBounds(c); _outputDevice.clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT); _outputDevice.translate(left, top); _root.getLayer().paint(c); _outputDevice.translate(-left, -top); _outputDevice.setClip(working); }
page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);