![]() * Indeed, the OP's Phrase#setLeading(float, float)} calls are ignored, Now let's deactivate the event.")) ĭocument.add(new Paragraph("This paragraph no longer has a background.")) Isn't that fantastic? By changing the event, we can even draw a border, change the line width of the border and many other things. As long as the event isn't activated, nothing special happens, but let's make the event active and see what happens:")) ĭocument.add(new Paragraph("This paragraph now has a background. ![]() ParagraphBackground border = new ParagraphBackground() ĭocument.add(new Paragraph("In this document, we'll add several paragraphs that will trigger page events. PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new File(RESULT_FOLDER, "document-with-paragraph-backgrounds.pdf"))) It can wrap an extra line if it needs to so this text is long.", void testParagraphBackgroundEventListener() throws DocumentException, FileNotFoundException PdfContentByte canvas = writer.getDirectContent() ĬolumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase("36222-0", fontQouteItems), 60, 450, 0) ĬolumnText.showTextAligned(canvas, Element.ALIGN_CENTER, new Phrase("47", fontQouteItems), 143, 450, 0) ĬolumnText ct = new ColumnText(canvas) // Uses a simple column box to provide proper text wrappingĬt.setSimpleColumn(new Rectangle(193, 070, 390, 450)) Ĭt.setText(new Phrase("In-Situ : Poly Cable - 100'\nPoly vented rugged black gable 100ft\nThis is an additional description. PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new File(RESULT_FOLDER, "ColumnTextTopAligned.pdf"))) įont fontQouteItems = new Font(BaseFont.createFont(), 12) * void testShowTextAlignedVsSimpleColumnTopAlignment() throws DocumentException, IOExceptionĭocument document = new Document(PageSize.A4) * denotes the baseline while ColumnText#setSimpleColumn(Rectangle)} surrounds * ColumnText#showTextAligned(PdfContentByte, int, Phrase, float, float, float)} * Indeed, the coordinates do not line up. * ColumnText.ShowTextAligned vs ColumnText.SetSimpleColumn Top Alignment
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |