public Rectangle getPagedViewClippingBounds(CssContext cssCtx, int additionalClearance) { Rectangle result = new Rectangle( additionalClearance + getMarginBorderPadding(cssCtx, CalculatedStyle.LEFT), getPaintingTop() + getMarginBorderPadding(cssCtx, CalculatedStyle.TOP), getContentWidth(cssCtx), getContentHeight(cssCtx)); return result; }
public int getContentWidth(CssContext cssCtx) { return getWidth(cssCtx) - getMarginBorderPadding(cssCtx, CalculatedStyle.LEFT) - getMarginBorderPadding(cssCtx, CalculatedStyle.RIGHT); }
public int getContentHeight(CssContext cssCtx) { return getHeight(cssCtx) - getMarginBorderPadding(cssCtx, CalculatedStyle.TOP) - getMarginBorderPadding(cssCtx, CalculatedStyle.BOTTOM); }
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 PdfDestination createDestination(RenderingContext c, Box box) { PdfDestination result = null; PageBox page = _root.getLayer().getPage(c, getPageRefY(box)); if (page != null) { int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() + box.getMargin(c).top() - page.getTop(); result = new PdfDestination(PdfDestination.XYZ, 0, page.getHeight(c) / _dotsPerPoint - distanceFromTop / _dotsPerPoint, 0); result.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1)); } return result; }
first.getContentWidth(layout), first .getContentHeight(layout)))); rootBox.layout(layout); page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT); page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT); page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT); Rectangle content = page.getPrintClippingBounds(c); c.getOutputDevice().clip(content); int top = -page.getPaintingTop() + page.getMarginBorderPadding(c, CalculatedStyle.TOP); int left = page.getMarginBorderPadding(c, CalculatedStyle.LEFT);
public com.lowagie.text.Rectangle createTargetArea(RenderingContext c, Box box) { PageBox current = c.getPage(); boolean inCurrentPage = box.getAbsY() > current.getTop() && box.getAbsY() < current.getBottom(); if (inCurrentPage || box.isContainedInMarginBox()) { return createLocalTargetArea(c, box); } else { Rectangle bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); PageBox page = _root.getLayer().getPage(c, bounds.y); float bottom = getDeviceLength(page.getBottom() - (bounds.y + bounds.height) + page.getMarginBorderPadding(c, CalculatedStyle.BOTTOM)); float left = getDeviceLength(page.getMarginBorderPadding(c, CalculatedStyle.LEFT) + bounds.x); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle(left, bottom, left + getDeviceLength(bounds.width), bottom + getDeviceLength(bounds.height)); return result; } }
private Rectangle getInitialExtents(LayoutContext c) { PageBox first = Layer.createPageBox(c, "first"); return new Rectangle(0, 0, first.getContentWidth(c), first.getContentHeight(c)); }
public Rectangle getPrintClippingBounds(CssContext cssCtx) { Rectangle result = new Rectangle( getMarginBorderPadding(cssCtx, CalculatedStyle.LEFT), getMarginBorderPadding(cssCtx, CalculatedStyle.TOP), getContentWidth(cssCtx), getContentHeight(cssCtx)); result.height -= 1; return result; }
protected void exportPageBoxText(RenderingContext c, Writer writer, int yPos) throws IOException { c.getPage().exportTrailingText(c, writer); List pages = c.getRootLayer().getPages(); PageBox next = (PageBox)pages.get(c.getPageNo()+1); c.setPage(next.getPageNo(), next); while (next.getBottom() < yPos) { next.exportLeadingText(c, writer); next.exportTrailingText(c, writer); next = (PageBox)pages.get(c.getPageNo()+1); c.setPage(next.getPageNo(), next); } next.exportLeadingText(c, writer); }
public Point getPaintingPosition( RenderingContext c, PageBox page, int additionalClearance, short mode) { int left = additionalClearance + page.getWidth(c) - (int)page.getMargin(c).right(); int top; if (mode == Layer.PAGED_MODE_SCREEN) { top = page.getPaintingTop(); } else if (mode == Layer.PAGED_MODE_PRINT) { top = 0; } else { throw new IllegalArgumentException("Illegal mode"); } return new Point(left, top); } }
public Rectangle getFixedRectangle() { Rectangle result; if (! isPrint()) { result = sharedContext.getFixedRectangle(); } else { result = new Rectangle(0, -this.page.getTop(), this.page.getContentWidth(this), this.page.getContentHeight(this)-1); } result.translate(-1, -1); return result; }
public Point getPaintingPosition( RenderingContext c, PageBox page, int additionalClearance, short mode) { int left = additionalClearance + page.getWidth(c) - (int)page.getMargin(c).right(); int top; if (mode == Layer.PAGED_MODE_SCREEN) { top = page.getPaintingBottom() - (int)page.getMargin(c).bottom(); } else if (mode == Layer.PAGED_MODE_PRINT) { top = page.getHeight(c) - (int)page.getMargin(c).bottom(); } else { throw new IllegalArgumentException("Illegal mode"); } return new Point(left, top); } }
private Rectangle getBorderEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); Rectangle result = new Rectangle(left + (int) margin.left(), top + (int) margin.top(), getWidth(cssCtx) - (int) margin.left() - (int) margin.right(), getHeight(cssCtx) - (int) margin.top() - (int) margin.bottom()); return result; }
private int calculateWidth(RenderingContext c, PageBox firstPage) { if (isScaleToFit()) { int pageWidth = firstPage.getWidth(c); Rectangle pageRec = firstPage.getPrintClippingBounds(c); if(_dim.getWidth() > pageRec.getWidth()) { RectPropertySet margin = firstPage.getMargin(c); pageWidth = (int) (_dim.getWidth() + margin.left() + margin.right()); } return pageWidth; } else { return firstPage.getWidth(c); } }
public Rectangle getScreenPaintingBounds(CssContext cssCtx, int additionalClearance) { return new Rectangle( additionalClearance, getPaintingTop(), getWidth(cssCtx), getPaintingBottom()-getPaintingTop()); }
public Point getPaintingPosition( RenderingContext c, PageBox page, int additionalClearance, short mode) { int left = additionalClearance + (int)page.getMargin(c).left(); int top; if (mode == Layer.PAGED_MODE_SCREEN) { top = page.getPaintingTop(); } else if (mode == Layer.PAGED_MODE_PRINT) { top = 0; } else { throw new IllegalArgumentException("Illegal mode"); } return new Point(left, top); } }