/** * Creates an independent duplicated of the instance <CODE>org</CODE>. * * @param org the original <CODE>ColumnText</CODE> * @return the duplicated */ public static ColumnText duplicate(final ColumnText org) { ColumnText ct = new ColumnText(null); ct.setACopy(org); return ct; }
/** * Creates an independent duplicated of the instance <CODE>org</CODE>. * * @param org the original <CODE>ColumnText</CODE> * @return the duplicated */ public static ColumnText duplicate(final ColumnText org) { ColumnText ct = new ColumnText(null); ct.setACopy(org); return ct; }
public FloatLayout(List<Element> elements, boolean useAscender) { compositeColumn = new ColumnText(null); compositeColumn.setUseAscender(useAscender); this.useAscender = useAscender; content = elements; }
public FloatLayout(List<Element> elements, boolean useAscender) { compositeColumn = new ColumnText(null); compositeColumn.setUseAscender(useAscender); this.useAscender = useAscender; content = elements; }
// I define a width of 200pt float width = 200; // I define the height as 10000pt (which is much more than I'll ever need) float max = 10000; // I create a column without a `writer` (strange, but it works) ColumnText ct = new ColumnText(null); ct.setSimpleColumn(new Rectangle(width, max)); for (Element e : el) { ct.addElement(e); } // I add content in simulation mode ct.go(true); // Now I ask the column for its Y position float y = ct.getYLine();
/** * Gets the width that the line will occupy after writing. Only the width of * the first line is returned. * * @param phrase the <CODE>Phrase</CODE> containing the line * @param runDirection the run direction * @param arabicOptions the options for the arabic shaping * @return the width of the line */ public static float getWidth(final Phrase phrase, final int runDirection, final int arabicOptions) { ColumnText ct = new ColumnText(null); ct.addText(phrase); ct.addWaitingPhrase(); PdfLine line = ct.bidiLine.processLine(0, 20000, Element.ALIGN_LEFT, runDirection, arabicOptions, 0, 0, 0); if (line == null) { return 0; } else { return 20000 - line.widthLeft(); } }
/** * Gets the width that the line will occupy after writing. Only the width of * the first line is returned. * * @param phrase the <CODE>Phrase</CODE> containing the line * @param runDirection the run direction * @param arabicOptions the options for the arabic shaping * @return the width of the line */ public static float getWidth(final Phrase phrase, final int runDirection, final int arabicOptions) { ColumnText ct = new ColumnText(null); ct.addText(phrase); ct.addWaitingPhrase(); PdfLine line = ct.bidiLine.processLine(0, 20000, Element.ALIGN_LEFT, runDirection, arabicOptions, 0, 0, 0); if (line == null) { return 0; } else { return 20000 - line.widthLeft(); } }
ColumnText ct = new ColumnText(canvas); float lly = -1; float ury = 2;
ColumnText ct = new ColumnText(canvas); float lly = -1; float ury = 2;
ct = new ColumnText(null); ct.setSimpleColumn(ph, rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop(), maxFontSize, Element.ALIGN_LEFT); ct.setRunDirection(runDirection); for (int k = 0; k < 50; ++k) { //just in case it doesn't converge size = (min + max) / 2; ct = new ColumnText(null); font.setSize(size); ct.setSimpleColumn(new Phrase(text, font), rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop(), size, Element.ALIGN_LEFT);
ct = new ColumnText(null); ct.setSimpleColumn(ph, rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop(), maxFontSize, Element.ALIGN_LEFT); ct.setRunDirection(runDirection); for (int k = 0; k < 50; ++k) { //just in case it doesn't converge size = (min + max) / 2; ct = new ColumnText(null); font.setSize(size); ct.setSimpleColumn(new Phrase(text, font), rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop(), size, Element.ALIGN_LEFT);
float width = box.getWidth() - 4 * offsetX - extraMarginLeft; float factor = ufont.getFontDescriptor(BaseFont.BBOXURY, 1) - ufont.getFontDescriptor(BaseFont.BBOXLLY, 1); ColumnText ct = new ColumnText(null); if (usize == 0) { usize = h / factor;
float width = box.getWidth() - 4 * offsetX - extraMarginLeft; float factor = ufont.getFontDescriptor(BaseFont.BBOXURY, 1) - ufont.getFontDescriptor(BaseFont.BBOXLLY, 1); ColumnText ct = new ColumnText(null); if (usize == 0) { usize = h / factor;
boolean createHere = false; if (compositeColumn == null) { compositeColumn = new ColumnText(canvas); compositeColumn.setAlignment(para.getAlignment()); compositeColumn.setIndent(para.getIndentationLeft() + para.getFirstLineIndent(), false); break; compositeColumn = new ColumnText(canvas); compositeColumn.setUseAscender((firstPass || descender == 0) && adjustFirstLine ? useAscender : false); compositeColumn.setInheritGraphicState(inheritGraphicState);
float signedSize = ColumnText.fitText(font, signedBy, sr2, -1, runDirection); ColumnText ct2 = new ColumnText(t); ct2.setRunDirection(runDirection); ct2.setSimpleColumn(new Phrase(signedBy, font), signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), signedSize, Element.ALIGN_LEFT); throw new IllegalStateException(MessageLocalization.getComposedMessage("a.signature.image.should.be.present.when.rendering.mode.is.graphic.and.description")); ct2 = new ColumnText(t); ct2.setRunDirection(runDirection); ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, Element.ALIGN_RIGHT); break; case GRAPHIC: ct2 = new ColumnText(t); ct2.setRunDirection(runDirection); ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, Element.ALIGN_RIGHT); ColumnText ct = new ColumnText(t); ct.setRunDirection(runDirection); ct.setSimpleColumn(new Phrase(text, font), dataRect.getLeft(), dataRect.getBottom(), dataRect.getRight(), dataRect.getTop(), size, Element.ALIGN_LEFT); Rectangle sr = new Rectangle(rect.getWidth() - 2 * MARGIN, rect.getHeight() * TOP_SECTION - 2 * MARGIN); float size = ColumnText.fitText(font, text, sr, 15, runDirection); ColumnText ct = new ColumnText(t); ct.setRunDirection(runDirection); ct.setSimpleColumn(new Phrase(text, font), MARGIN, 0, rect.getWidth() - MARGIN, rect.getHeight() - MARGIN, size, Element.ALIGN_LEFT);
public ColumnText generateTableOfContent(ITextContext context) { ColumnText ct = new ColumnText(null); Styles styles = context.styles(); Chunk CONNECT = connectChunk(styles); Paragraph paragraph = new Paragraph(); paragraph.setSpacingBefore(20.0f); // first paragraph only ct.addElement(new Paragraph("Table of content", styles.sectionTitleFontForLevel(1))); ct.addElement(new Paragraph("")); Font entryFont = styles.getFontOrDefault(TOC_ENTRY_FONT); TableOfContents tableOfContents = context.tableOfContents(); for (TableOfContents.Entry entry : tableOfContents.getEntries()) { //if (entry.isExtra()) // continue; Chunk chunk = new Chunk(entry.getText(), entryFont); paragraph.add(chunk); paragraph.add(CONNECT); paragraph.add(new Chunk("" + entry.getFormattedPageNumber(), entryFont)); float indent = 10.0f * entry.getLevel(); paragraph.setIndentationLeft(indent); ct.addElement(paragraph); paragraph = new Paragraph(); } return ct; }
boolean createHere = false; if (compositeColumn == null) { compositeColumn = new ColumnText(canvas); compositeColumn.setAlignment(para.getAlignment()); compositeColumn.setIndent(para.getIndentationLeft() + para.getFirstLineIndent(), false); break; compositeColumn = new ColumnText(canvas); compositeColumn.setUseAscender((firstPass || descender == 0) && adjustFirstLine ? useAscender : false); compositeColumn.setInheritGraphicState(inheritGraphicState);
float signedSize = ColumnText.fitText(font, signedBy, sr2, -1, runDirection); ColumnText ct2 = new ColumnText(t); ct2.setRunDirection(runDirection); ct2.setSimpleColumn(new Phrase(signedBy, font), signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), signedSize, Element.ALIGN_LEFT); throw new IllegalStateException(MessageLocalization.getComposedMessage("a.signature.image.should.be.present.when.rendering.mode.is.graphic.and.description")); ct2 = new ColumnText(t); ct2.setRunDirection(runDirection); ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, Element.ALIGN_RIGHT); break; case GRAPHIC: ct2 = new ColumnText(t); ct2.setRunDirection(runDirection); ct2.setSimpleColumn(signatureRect.getLeft(), signatureRect.getBottom(), signatureRect.getRight(), signatureRect.getTop(), 0, Element.ALIGN_RIGHT); ColumnText ct = new ColumnText(t); ct.setRunDirection(runDirection); ct.setSimpleColumn(new Phrase(text, font), dataRect.getLeft(), dataRect.getBottom(), dataRect.getRight(), dataRect.getTop(), size, Element.ALIGN_LEFT); Rectangle sr = new Rectangle(rect.getWidth() - 2 * MARGIN, rect.getHeight() * TOP_SECTION - 2 * MARGIN); float size = ColumnText.fitText(font, text, sr, 15, runDirection); ColumnText ct = new ColumnText(t); ct.setRunDirection(runDirection); ct.setSimpleColumn(new Phrase(text, font), MARGIN, 0, rect.getWidth() - MARGIN, rect.getHeight() - MARGIN, size, Element.ALIGN_LEFT);
ColumnText ct = new ColumnText(isTagged(writer) ? text : writer.getDirectContent()); ct.setRunDirection(ptable.getRunDirection());
ColumnText ct = new ColumnText(isTagged(writer) ? text : writer.getDirectContent()); ct.setRunDirection(ptable.getRunDirection());