ColumnText ct = new ColumnText(cb); Phrase myText = new Phrase("TEST paragraph\nAfter Newline"); ct.setSimpleColumn(myText, 34, 750, 580, 317, 15, Element.ALIGN_LEFT); ct.go();
/** * @since 3.0.0 protected is now public static */ public static float setColumn(ColumnText ct, float left, float bottom, float right, float top) { if (left > right) { right = left; } if (bottom > top) { top = bottom; } ct.setSimpleColumn(left, bottom, right, top); return top; }
//getting a 'canvas' to add parsed elements final ColumnText page = new ColumnText(editablePage.getOverContent(pageNumber)); //finding out the page sizefinal Rectangle pagesize = editablePage.getReader().getPageSize(pageNumber); //you can define any size here, that will be where your parsed elements will be added page.setSimpleColumn(0, 0, pagesize.getWidth(), pagesize.getHeight());
public ColumnText createColumn(PdfContentByte cb, int i, String la, Rectangle rect) throws IOException { ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(rect); Phrase p = createPhrase(String.format("resources/text/liber1_%s_%s.txt", i, la)); ct.addText(p); return ct; }
ColumnText ct = new ColumnText(message); ct.setSimpleColumn(new Rectangle(0, 0, 523, 50)); ct.addElement( new Paragraph( String.format("There are %s pages in this document", writer.getPageNumber()))); ct.go();
ColumnText ct = new ColumnText(content); ct.setSimpleColumn( new Phrase("Very Long Text"), left=20, bottom=100, right=500, top=500, fontSize=18, Element.ALIGN_JUSTIFIED); ct.go(); // for drawing
BaseFont bf = BaseFont.createFont( "c:/windows/fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font = new Font(bf, 20); ColumnText column = new ColumnText(writer.getDirectContent()); column.setSimpleColumn(36, 730, 569, 36); column.setRunDirection(PdfWriter.RUN_DIRECTION_RTL); column.addElement(new Paragraph( "\u0627\u0644\u0645\u0648\u0642\u0639 \u0627\u0644\u0625\u0644\u0643\u062a\u0631\u0648\u0646\u064a", font)); column.go();
PdfContentByte cb = writer.getDirectContent(); ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(new Rectangle(36, 600, 200, 800)); ct.addElement(new Paragraph("I want to add this text in a rectangle defined by the coordinates llx = 36, lly = 600, urx = 200, ury = 800")); int status = ct.go();
// read the file PdfReader fondo = new PdfReader("listaPrecios.pdf"); PdfStamper stamper = new PdfStamper( fondo, response.getOutputStream()); PdfContentByte content = stamper.getOverContent(1); // add text ColumnText ct = new ColumnText( content ); // this are the coordinates where you want to add text // if the text does not fit inside it will be cropped ct.setSimpleColumn(50,500,500,50); ct.setText(new Phrase(str, titulo1)); ct.go();
ColumnText ct = new ColumnText(stamper.getOverContent(i)); ct.setSimpleColumn(new Rectangle(30, 600, 523, 720)); Chunk c = new Chunk("Underlined text"); c.setUnderline(1.5f, -1); ct.addElement(new Paragraph(c)); ct.go();
PdfContentByte canvas = writer.getDirectContent(); ColumnText ct = new ColumnText(canvas); ct.setSimpleColumn(rect); ct.addElement(new Paragraph("This is the text added in the rectangle")); ct.go();
ColumnText ct = new ColumnText(writer.getDirectContent()); ct.setSimpleColumn(rectangle); ct.addElement(p1); ct.addElement(p2); ct.go();
ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(120f, 500f, 250f, 780f); Paragraph p = new Paragraph("This is a long paragraph that doesn't" + "fit the width we defined for the simple column of the" + "ColumnText object, so it will be distributed over several" + "lines (and we don't know in advance how many)."); ct.addElement(p); ct.go();
ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(120f, 500f, 250f, 780f); Paragraph p = new Paragraph("This is a long paragraph that doesn't" + "fit the width we defined for the simple column of the" + "ColumnText object, so it will be distributed over several" + "lines (and we don't know in advance how many)."); ct.addElement(p); ct.go();
ColumnText ct = new ColumnText(writer.getDirectContent()); ct.setSimpleColumn(left,bottom,right,top); ct.setText(new Phrase("String")); ct.go();
PdfContentByte canvas = writer.getDirectContent(); ColumnText ct = new ColumnText(canvas); for (int i = 1; i < 4; i++) { canvas.beginLayer(options.get(i - 1)); ct.setSimpleColumn(new Rectangle(36, 36, 559, 806)); ct.addElement(createTable(i, options)); ct.go(); canvas.endLayer(); }
Phrase p = new Phrase("This text is added at the top of the column."); ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(rect); ct.setUseAscender(true); ct.addText(p); ct.go();
private void underlineText(String fieldName, String fieldValue, AcroFields fields, PdfStamper stamper) throws Exception { Rectangle targetPosition = fields.getFieldPositions(fieldName).get(0).position; Font fontNormal = FontFactory.getFont("Courier-Bold", 8, Font.UNDERLINE, BaseColor.BLACK); Anchor url = new Anchor(fieldValue.trim(), fontNormal); ColumnText data = new ColumnText(stamper.getOverContent(1)); data.setSimpleColumn(url, targetPosition.getLeft(), targetPosition.getBottom(), targetPosition.getRight(), targetPosition.getTop(), 0,0); data.go(); }
/** * Simplified method for rectangular columns. * * @param rect the rectangle for the column */ public void setSimpleColumn(Rectangle rect) { setSimpleColumn(rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop()); }
/** * Simplified method for rectangular columns. * * @param rect the rectangle for the column */ public void setSimpleColumn(Rectangle rect) { setSimpleColumn(rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop()); }