List of usage examples for com.itextpdf.text Paragraph add
@Override public boolean add(Element o)
Element
to the Paragraph
. From source file:pdf.PdfUtility.java
private Paragraph getSectionTitle(String title) { Paragraph result = new Paragraph(title, LifetimeFonts.FONT_DEFAULT); result.add(LINE_SEPARATOR); result.add(NEWLINE);//from w w w. ja v a 2 s. c o m // result.add(NEWLINE); return result; }
From source file:pdf.PdfUtility.java
private void addTitle(Document document) { try {//from w w w . j av a2 s. c om // Create a phrase Phrase namePhrase = new TitlePhrase(getFullname(), LifetimeFonts.FONT_HEADER); Phrase emailPhrase = new TitlePhrase(user.getEmail(), LifetimeFonts.FONT_DEFAULT); // Wrap it into a centered paragraph Paragraph title = new Paragraph(); title.setAlignment(Element.ALIGN_CENTER); title.add(namePhrase); title.add(NEWLINE); title.add(emailPhrase); if (user.getBirthdate() != null) { title.add(NEWLINE); title.add(new TitlePhrase(formatDate(user.getBirthdate()), LifetimeFonts.FONT_DEFAULT)); } if (user.getBirthplace() != null) { title.add(NEWLINE); title.add(new TitlePhrase(user.getBirthplace(), LifetimeFonts.FONT_DEFAULT)); } // return the paragraph to be added into de document document.add(title); } catch (DocumentException ex) { Logger.getLogger(PdfUtility.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:pdf.PdfUtility.java
private Paragraph addTableEntry(Achievement a) { PdfPTable mainTable = new PdfPTable(new float[] { 1f, 5f }); mainTable.setWidthPercentage(100f);/*from w ww . ja v a 2 s . c o m*/ mainTable.setSpacingBefore(0f); mainTable.setSpacingAfter(0f); PdfPCell datesCell = getDateCell(a); PdfPCell summaryCell = getSummaryCell(a); mainTable.addCell(datesCell); mainTable.addCell(summaryCell); Paragraph current = new Paragraph(); current.setAlignment(Paragraph.ALIGN_LEFT); //current.setSpacingBefore(10f); current.add(mainTable); return current; }
From source file:PDF.Reporte_Final.java
private void addEncabezado(Document document) throws DocumentException { Paragraph preface = new Paragraph(); addEmptyLine(preface, 4);/*from ww w . j a v a 2 s . c o m*/ preface.setAlignment(Element.ALIGN_CENTER); preface.add(new Paragraph("E-SIBE", catFont)); preface.add(new Paragraph("Reporte de resultados finales de la" + " beca SIBE de COFAA", smallBold)); addEmptyLine(preface, 2); document.add(preface); }
From source file:PdfCreation.PdfTableWriter.java
public Paragraph newParagraph(String text, boolean alignCenter, boolean alignLeft, boolean alignRight) { Paragraph ourParagraph = new Paragraph(); if (alignCenter && !alignLeft && !alignRight) { ourParagraph.setAlignment(Element.ALIGN_CENTER); } else if ((!alignCenter && !alignLeft && !alignRight) && (!alignCenter && alignLeft && !alignRight)) { ourParagraph.setAlignment(Element.ALIGN_LEFT); } else if (!alignCenter && !alignLeft && alignRight) { ourParagraph.setAlignment(Element.ALIGN_RIGHT); }/*from w w w .j av a2s . co m*/ // ourParagraph.setFont(new Font(Font.FontFamily.COURIER, 11)); ourParagraph.add(text); return ourParagraph; }
From source file:pdfcreator.Main.java
private static void addTitlePage(Document document) throws DocumentException { Paragraph preface = new Paragraph(); // We add one empty line addEmptyLine(preface, 1);/*from w w w. j a va 2s . c o m*/ // Lets write a big header preface.add(new Paragraph("Title of the document", catFont)); addEmptyLine(preface, 1); // Will create: Report generated by: _name, _date preface.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date(), smallBold)); addEmptyLine(preface, 3); preface.add(new Paragraph("This document describes something which is very important ", smallBold)); addEmptyLine(preface, 8); preface.add(new Paragraph( "This document is a preliminary version and not subject to your license agreement or any other agreement with vogella.com ;-).", redFont)); document.add(preface); // Start a new page document.newPage(); }
From source file:pdfgen.pdf_generation_try5.java
public void AddParagraph(Document document) throws DocumentException { Paragraph preface = new Paragraph(); // We add one empty line // Lets write a big header //addEmptyLine(preface, 27); String SomeDataWhichIsDerived = rep1; // preface.add(new Paragraph("Generated Path of file"+OUTPUTFILE, catFont)); //The new paragraph allows us to set the font of our choice //addEmptyLine(preface, 5); // Will create: Report generated by: _name, _date // preface.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3smallBold)); // addEmptyLine(preface, 20); preface.add(new Paragraph(SomeDataWhichIsDerived, smallBold)); // addEmptyLine(preface, 25); // preface.add(new Paragraph("This document is a preliminary version and not subject to your license agreement or any other agreement with vogella.com ;-).",redFont)); document.add(preface);// www . java 2 s. com // Start a new page document.newPage(); }
From source file:pipe.PdfMaker.java
private void addTitlePage(Document document) throws DocumentException { Paragraph preface = new Paragraph(); // We add one empty line addEmptyLine(preface, 1);/*from w w w . j a va2 s. c o m*/ // Lets write a big header Paragraph para = new Paragraph("Meine Pfeifensammlung", catFont); para.setAlignment(Element.ALIGN_CENTER); preface.add(para); addEmptyLine(preface, 1); // Will create: Report generated by: _name, _date preface.add(new Paragraph("Erstellt von: " + System.getProperty("user.name"), arialSmall)); addEmptyLine(preface, 7); Image image = null; String frontpic = "db" + File.separator + "pipe-frontpage.jpg"; try { ImageIcon icon = new ImageIcon(frontpic.toString()); java.awt.Image img = icon.getImage(); java.awt.Image newimg = img.getScaledInstance(500, -1, java.awt.Image.SCALE_SMOOTH); image = Image.getInstance(newimg, null); } catch (BadElementException e) { } catch (MalformedURLException e) { } catch (IOException e) { } Paragraph picture = new Paragraph(""); picture.setAlignment(Element.ALIGN_CENTER); picture.add(image); preface.add(picture); addEmptyLine(preface, 10); preface.add(new Paragraph( "Dieser Katalog wurde mit Mat's pipe-manager erstellt.\nDie Software ist frei verfgbar und herunterladbar ber das Forum von www.komm-zur-pfeife.de.", arialSmall)); document.add(preface); // Start a new page document.newPage(); }
From source file:pipe.PdfMaker.java
private Element firstElement(String value) { float leading = 9f; Phrase label = new Phrase("Pfeife Nr. ", this.arial); Phrase ref = new Phrase(value, courier); Paragraph info = new Paragraph(); info.setLeading(leading);//from w w w.ja va 2 s .co m info.add(label); info.add(ref); return info; }
From source file:printers.HojaDeFirmaPrinter.java
License:Open Source License
private void creaCabecera(Document doc, Aula aula, GregorianCalendar dia) throws DocumentException { AcademicCalendar cal = dp.getAcademicCalendar(); Font font = new Font(Font.FontFamily.HELVETICA, 16); Font fontbold = new Font(Font.FontFamily.HELVETICA, 16, Font.BOLD); String diaSemana = cal.nombreDiaSemana(dia); Paragraph par = new Paragraph(); par.add(new Phrase("Hoja de firma para aula ", font)); par.add(new Phrase(aula.getNombre(), fontbold)); par.add(new Phrase(" correspondiente al da ", font)); par.add(new Phrase(diaSemana + " " + cal.format(dia), fontbold)); par.setAlignment(Paragraph.ALIGN_CENTER); doc.add(par);/*from ww w . ja va2 s . c o m*/ par.setAlignment(Paragraph.ALIGN_CENTER); }