List sequences = getSortedPageSequences(); int initial = 0; if (c.getInitialPageNo() > 0) { initial = c.getInitialPageNo() - 1; } if (sequences == null) { return initial + c.getPageNo(); } else { int sequenceStartIndex = getPageSequenceStart(c, sequences, c.getPage()); if (sequenceStartIndex == -1) { return initial + c.getPageNo(); } else { BlockBox block = (BlockBox)sequences.get(sequenceStartIndex); return c.getPageNo() - getFirstPage(c, block).getPageNo(); } } } public int getRelativePageCount(RenderingContext c) {
public void exportText(RenderingContext c, Writer writer) throws IOException { int baselinePos = getAbsY() + getBaseline(); if (baselinePos >= c.getPage().getBottom() && isInDocumentFlow()) { exportPageBoxText(c, writer, baselinePos); } for (Iterator i = getNonFlowContent().iterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.exportText(c, writer); } if (isContainsContent()) { StringBuffer result = new StringBuffer(); collectText(c, result); writer.write(result.toString().trim()); writer.write(LINE_SEPARATOR); } }
public void exportText(RenderingContext c, Writer writer) throws IOException { int baselinePos = getAbsY() + getBaseline(); if (baselinePos >= c.getPage().getBottom() && isInDocumentFlow()) { exportPageBoxText(c, writer, baselinePos); } for (Iterator i = getNonFlowContent().iterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.exportText(c, writer); } if (isContainsContent()) { StringBuffer result = new StringBuffer(); collectText(c, result); writer.write(result.toString().trim()); writer.write(LINE_SEPARATOR); } }
public int getRelativePageNo(RenderingContext c) { List sequences = getSortedPageSequences(); int initial = 0; if (c.getInitialPageNo() > 0) { initial = c.getInitialPageNo() - 1; } if (sequences == null) { return initial + c.getPageNo(); } else { int sequenceStartIndex = getPageSequenceStart(c, sequences, c.getPage()); if (sequenceStartIndex == -1) { return initial + c.getPageNo(); } else { BlockBox block = (BlockBox)sequences.get(sequenceStartIndex); return c.getPageNo() - getFirstPage(c, block).getPageNo(); } } }
public void exportText(RenderingContext c, Writer writer) throws IOException { if (getTable().isMarginAreaRoot()) { super.exportText(c, writer); } else { int yPos = getAbsY(); if (yPos >= c.getPage().getBottom() && isInDocumentFlow()) { exportPageBoxText(c, writer, yPos); } for (Iterator i = getChildIterator(); i.hasNext(); ) { TableCellBox cell = (TableCellBox)i.next(); StringBuffer buffer = new StringBuffer(); cell.collectText(c, buffer); writer.write(buffer.toString().trim()); int cSpan = cell.getStyle().getColSpan(); for (int j = 0; j < cSpan; j++) { writer.write('\t'); } } writer.write(LINE_SEPARATOR); } }
private void exportPageBoxText(RenderingContext c, Writer writer) throws IOException { c.getPage().exportTrailingText(c, writer); if (c.getPage() != c.getRootLayer().getLastPage()) { List pages = c.getRootLayer().getPages(); do { PageBox next = (PageBox)pages.get(c.getPageNo()+1); c.setPage(next.getPageNo(), next); next.exportLeadingText(c, writer); next.exportTrailingText(c, writer); } while (c.getPage() != c.getRootLayer().getLastPage()); } }
public void exportText(RenderingContext c, Writer writer) throws IOException { if (getTable().isMarginAreaRoot()) { super.exportText(c, writer); } else { int yPos = getAbsY(); if (yPos >= c.getPage().getBottom() && isInDocumentFlow()) { exportPageBoxText(c, writer, yPos); } for (Iterator i = getChildIterator(); i.hasNext(); ) { TableCellBox cell = (TableCellBox)i.next(); StringBuffer buffer = new StringBuffer(); cell.collectText(c, buffer); writer.write(buffer.toString().trim()); int cSpan = cell.getStyle().getColSpan(); for (int j = 0; j < cSpan; j++) { writer.write('\t'); } } writer.write(LINE_SEPARATOR); } }
private void exportPageBoxText(RenderingContext c, Writer writer) throws IOException { c.getPage().exportTrailingText(c, writer); if (c.getPage() != c.getRootLayer().getLastPage()) { List pages = c.getRootLayer().getPages(); do { PageBox next = (PageBox)pages.get(c.getPageNo()+1); c.setPage(next.getPageNo(), next); next.exportLeadingText(c, writer); next.exportTrailingText(c, writer); } while (c.getPage() != c.getRootLayer().getLastPage()); } }
public void exportText(RenderingContext c, Writer writer) throws IOException { if (c.isPrint() && isRoot()) { c.setPage(0, (PageBox)c.getRootLayer().getPages().get(0)); c.getPage().exportLeadingText(c, writer); } for (Iterator i = getChildIterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.exportText(c, writer); } if (c.isPrint() && isRoot()) { exportPageBoxText(c, writer); } }
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 void exportText(RenderingContext c, Writer writer) throws IOException { if (c.isPrint() && isRoot()) { c.setPage(0, (PageBox)c.getRootLayer().getPages().get(0)); c.getPage().exportLeadingText(c, writer); } for (Iterator i = getChildIterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.exportText(c, writer); } if (c.isPrint() && isRoot()) { exportPageBoxText(c, writer); } }
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 FSColor getEffBackgroundColor(RenderingContext c) { FSColor result = null; Box current = this; while (current != null) { result = current.getStyle().getBackgroundColor(); if (result != null) { return result; } current = current.getContainingBlock(); } PageBox page = c.getPage(); result = page.getStyle().getBackgroundColor(); if (result == null) { return new FSRGBColor(255, 255, 255); } else { return result; } }
public FSColor getEffBackgroundColor(RenderingContext c) { FSColor result = null; Box current = this; while (current != null) { result = current.getStyle().getBackgroundColor(); if (result != null) { return result; } current = current.getContainingBlock(); } PageBox page = c.getPage(); result = page.getStyle().getBackgroundColor(); if (result == null) { return new FSRGBColor(255, 255, 255); } else { return result; } }
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; } }
public com.itextpdf.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.itextpdf.text.Rectangle result = new com.itextpdf.text.Rectangle(left, bottom, left + getDeviceLength(bounds.width), bottom + getDeviceLength(bounds.height)); return result; } }
@SuppressWarnings("deprecation") @Override public void paint(RenderingContext renderingContext, ITextOutputDevice outputDevice, BlockBox blockBox) { PdfContentByte cb = outputDevice.getWriter().getDirectContent(); float width = (float) (this.cssWidth / outputDevice.getDotsPerPoint()); float height = (float) (this.cssHeight / outputDevice.getDotsPerPoint()); PdfTemplate template = cb.createTemplate(width, height); Graphics2D g2d = template.createGraphics(width, height); PrintTranscoder prm = new PrintTranscoder(); TranscoderInput ti = new TranscoderInput(this.svg); prm.transcode(ti, null); PageFormat pg = new PageFormat(); Paper pp = new Paper(); pp.setSize(width, height); pp.setImageableArea(0, 0, width, height); pg.setPaper(pp); prm.print(g2d, pg, 0); g2d.dispose(); PageBox page = renderingContext.getPage(); float x = blockBox.getAbsX() + page.getMarginBorderPadding(renderingContext, CalculatedStyle.LEFT); float y = (page.getBottom() - (blockBox.getAbsY() + this.cssHeight)) + page.getMarginBorderPadding(renderingContext, CalculatedStyle.BOTTOM); x /= outputDevice.getDotsPerPoint(); y /= outputDevice.getDotsPerPoint(); cb.addTemplate(template, x, y); }
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; } }
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; } }
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; } }