private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle((float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.itextpdf.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.itextpdf.text.Rectangle result = new com.itextpdf.text.Rectangle((float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle((float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle( (float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + getDeviceLength(bounds.height)); return result; }
private com.lowagie.text.Rectangle createLocalTargetArea(RenderingContext c, Box box, boolean useAggregateBounds) { Rectangle bounds; if (useAggregateBounds && box.getPaintingInfo() != null) { bounds = box.getPaintingInfo().getAggregateBounds(); } else { bounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); } Point2D docCorner = new Point2D.Double(bounds.x, bounds.y + bounds.height); Point2D pdfCorner = new Point.Double(); _transform.transform(docCorner, pdfCorner); pdfCorner.setLocation(pdfCorner.getX(), normalizeY((float) pdfCorner.getY())); com.lowagie.text.Rectangle result = new com.lowagie.text.Rectangle( (float) pdfCorner.getX(), (float) pdfCorner.getY(), (float) pdfCorner.getX() + getDeviceLength(bounds.width), (float) pdfCorner.getY() + 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.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; } }
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; } }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance( RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont)box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp, color); field.setDefaultAppearanceString(tp); }
private void createAppearance(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field, String value) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont) box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); PdfAppearance tp2 = (PdfAppearance) tp.getDuplicate(); tp2.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp2, color); field.setDefaultAppearanceString(tp2); tp.beginVariableText(); tp.saveState(); tp.beginText(); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); setFillColor(tp, color); tp.setTextMatrix(0, height / 2 - (fontSize * 0.3f)); tp.showText(value); tp.endText(); tp.restoreState(); tp.endVariableText(); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); }
private void createAppearance(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box, PdfFormField field, String value) { PdfWriter writer = outputDevice.getWriter(); ITextFSFont font = (ITextFSFont) box.getStyle().getFSFont(c); PdfContentByte cb = writer.getDirectContent(); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); float fontSize = outputDevice.getDeviceLength(font.getSize2D()); PdfAppearance tp = cb.createAppearance(width, height); PdfAppearance tp2 = (PdfAppearance) tp.getDuplicate(); tp2.setFontAndSize(font.getFontDescription().getFont(), fontSize); FSColor color = box.getStyle().getColor(); setFillColor(tp2, color); field.setDefaultAppearanceString(tp2); tp.beginVariableText(); tp.saveState(); tp.beginText(); tp.setFontAndSize(font.getFontDescription().getFont(), fontSize); setFillColor(tp, color); tp.setTextMatrix(0, height / 2 - (fontSize * 0.3f)); tp.showText(value); tp.endText(); tp.restoreState(); tp.endVariableText(); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { PdfContentByte cb = outputDevice.getCurrentPage(); PdfWriter writer = outputDevice.getWriter(); PdfFormField field = PdfFormField.createCheckBox(writer); Element e = box.getElement(); String onValue = getValue(e); boolean checked = isChecked(e); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker); createAppearances(cb, field, onValue, width, height, false, color, darker); field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName(getFieldName(outputDevice, e)); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setValueAsName(checked ? onValue : OFF_STATE); field.setAppearanceState(checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); } writer.addAnnotation(field); }
public void paint(RenderingContext c, ITextOutputDevice outputDevice, BlockBox box) { PdfContentByte cb = outputDevice.getCurrentPage(); PdfWriter writer = outputDevice.getWriter(); PdfFormField field = PdfFormField.createCheckBox(writer); Element e = box.getElement(); String onValue = getValue(e); boolean checked = isChecked(e); float width = outputDevice.getDeviceLength(getWidth()); float height = outputDevice.getDeviceLength(getHeight()); FSColor color = box.getStyle().getColor(); FSColor darker = box.getEffBackgroundColor(c).darkenColor(); createAppearances(cb, field, onValue, width, height, true, color, darker); createAppearances(cb, field, onValue, width, height, false, color, darker); field.setWidget(outputDevice.createLocalTargetArea(c, box), PdfAnnotation.HIGHLIGHT_INVERT); field.setFieldName(getFieldName(outputDevice, e)); field.setBorderStyle(new PdfBorderDictionary(0.0f, 0)); field.setValueAsName(checked ? onValue : OFF_STATE); field.setAppearanceState(checked ? onValue : OFF_STATE); if (isReadOnly(e)) { field.setFieldFlags(PdfFormField.FF_READ_ONLY); } writer.addAnnotation(field); }
String onValue = getValue(e); float width = outputDevice.getDeviceLength(fieldElem.getWidth()); float height = outputDevice.getDeviceLength(fieldElem.getHeight());