List of usage examples for com.lowagie.text Table Table
public Table(Table t)
From source file:net.bull.javamelody.swing.print.MPdfWriter.java
License:Apache License
/** * Ecrit le pdf./* ww w . j a v a 2s . co m*/ * * @param table * MBasicTable * @param out * OutputStream * @throws IOException * e */ protected void writePdf(final MBasicTable table, final OutputStream out) throws IOException { try { // step 1: creation of a document-object final Rectangle pageSize = landscape ? PageSize.A4.rotate() : PageSize.A4; final Document document = new Document(pageSize, 50, 50, 50, 50); // step 2: we create a writer that listens to the document and directs a PDF-stream to out createWriter(table, document, out); // we add some meta information to the document, and we open it document.addAuthor(System.getProperty("user.name")); document.addCreator("JavaMelody"); final String title = buildTitle(table); if (title != null) { document.addTitle(title); } document.open(); // ouvre la bote de dialogue Imprimer de Adobe Reader // if (writer instanceof PdfWriter) { // ((PdfWriter) writer).addJavaScript("this.print(true);", false); // } // table final Table datatable = new Table(table.getColumnCount()); datatable.setCellsFitPage(true); datatable.setPadding(4); datatable.setSpacing(0); // headers renderHeaders(table, datatable); // data rows renderList(table, datatable); document.add(datatable); // we close the document document.close(); } catch (final DocumentException e) { // on ne peut dclarer d'exception autre que IOException en throws throw new IOException(e); } }
From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java
License:Open Source License
private void createDetailSection(List details, Document doc) throws CoreException, DocumentException { Table table = new Table(4); table.setSpaceInsideCell(10);/* w ww .ja va2 s.c o m*/ table.setAlignment(Element.ALIGN_LEFT); table.setWidth(100); table.setWidths(new float[] { 30, 30, 10, 30 }); Cell resourceHeader = new Cell(new Chunk(Messages.MarkerStatsView_fileColumn, tableHeaderAndFooterFont)); resourceHeader.setHorizontalAlignment(Element.ALIGN_CENTER); resourceHeader.setHeader(true); table.addCell(resourceHeader); Cell folderHeader = new Cell(new Chunk(Messages.MarkerStatsView_folderColumn, tableHeaderAndFooterFont)); folderHeader.setHorizontalAlignment(Element.ALIGN_CENTER); folderHeader.setHeader(true); table.addCell(folderHeader); Cell lineHeader = new Cell(new Chunk(Messages.MarkerStatsView_lineColumn, tableHeaderAndFooterFont)); lineHeader.setHorizontalAlignment(Element.ALIGN_CENTER); lineHeader.setHeader(true); table.addCell(lineHeader); Cell messageHeader = new Cell(new Chunk(Messages.MarkerStatsView_messageColumn, tableHeaderAndFooterFont)); messageHeader.setHorizontalAlignment(Element.ALIGN_CENTER); messageHeader.setHeader(true); table.addCell(messageHeader); Cell resourceCell; Cell fileCell; Cell lineCell; Cell messageCell; for (Iterator iter = details.iterator(); iter.hasNext();) { IMarker marker = (IMarker) iter.next(); resourceCell = new Cell(new Chunk(marker.getResource().getName(), mainFont)); table.addCell(resourceCell); fileCell = new Cell(new Chunk(marker.getResource().getParent().getFullPath().toString(), mainFont)); table.addCell(fileCell); lineCell = new Cell(new Chunk(marker.getAttribute(IMarker.LINE_NUMBER).toString(), mainFont)); lineCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(lineCell); messageCell = new Cell(new Chunk(marker.getAttribute(IMarker.MESSAGE).toString(), mainFont)); table.addCell(messageCell); } doc.add(table); }
From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java
License:Open Source License
private void createSummaryTable(Stats stats, Document doc) throws DocumentException { Table table = new Table(2); table.setSpaceInsideCell(10);// w w w . j ava2s. c o m table.setAlignment(Element.ALIGN_LEFT); table.setWidth(100); table.setWidths(new float[] { 80, 20 }); Cell typeHeader = new Cell(new Chunk(Messages.MarkerStatsView_kindOfErrorColumn, tableHeaderAndFooterFont)); typeHeader.setHorizontalAlignment(Element.ALIGN_CENTER); typeHeader.setHeader(true); table.addCell(typeHeader); Cell countHeader = new Cell( new Chunk(Messages.MarkerStatsView_numberOfErrorsColumn, tableHeaderAndFooterFont)); countHeader.setHorizontalAlignment(Element.ALIGN_CENTER); countHeader.setHeader(true); table.addCell(countHeader); ArrayList markerStatsSortedList = new ArrayList(stats.getMarkerStats()); Collections.sort(markerStatsSortedList, new Comparator() { public int compare(Object arg0, Object arg1) { MarkerStat markerStat0 = (MarkerStat) arg0; MarkerStat markerStat1 = (MarkerStat) arg1; return markerStat1.getCount() - markerStat0.getCount(); } }); Cell typeCell; Cell countCell; for (Iterator iter = markerStatsSortedList.iterator(); iter.hasNext();) { MarkerStat markerStat = (MarkerStat) iter.next(); typeCell = new Cell(new Chunk(markerStat.getIdentifiant(), mainFont)); table.addCell(typeCell); countCell = new Cell(new Chunk(markerStat.getCount() + "", mainFont)); countCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(countCell); } doc.add(table); }
From source file:open.dolphin.client.AuditController.java
License:Open Source License
private void makePDF() { //- ?/* w w w . j a va2s .co m*/ Document doc = new Document(PageSize.A4, 20.0F, 20.0F, 40.0F, 40.0F); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); String fileName = "_" + sdf.format(new java.util.Date()) + ".pdf"; //()?? FileOutputStream fos = new FileOutputStream(outputDir.getText() + fileName); PdfWriter pdfwriter = PdfWriter.getInstance(doc, fos); Font font_header = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 15.0F, 1); Font font_g11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F); Font font_g10 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 10.0F); //- ? Font font_m8 = new Font(BaseFont.createFont("HeiseiMin-W3", "UniJIS-UCS2-HW-H", false), 8.0F); Font font_underline_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F, 4); Font font_red_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F); font_red_11.setColor(new Color(255, 0, 0)); Font font_empty = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 9.0F); font_empty.setColor(new Color(255, 255, 255)); Paragraph para_NF = new Paragraph(5, "\r\n", new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 13, Font.NORMAL)); para_NF.setAlignment(Element.ALIGN_CENTER); // ?? String author = Project.getProjectStub().getUserModel().getCommonName(); doc.addAuthor(author); doc.addSubject(""); HeaderFooter header = new HeaderFooter(new Phrase("", font_header), false); header.setAlignment(1); doc.setHeader(header); HeaderFooter footer = new HeaderFooter(new Phrase("--"), new Phrase("--")); footer.setAlignment(1); footer.setBorder(0); doc.setFooter(footer); doc.open(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy''MM''dd'' HH''mm''"); String today = sdf1.format(new java.util.Date()); Paragraph para_0 = new Paragraph("?" + today, font_g11); para_0.setAlignment(2); doc.add(para_0); Paragraph para_1 = new Paragraph("?" + author, font_g11); para_1.setAlignment(2); doc.add(para_1); doc.add(new Paragraph("")); // doc.add(para_NF); doc.add(para_NF); for (int cnt = 0; cnt < outputList.size(); cnt++) { InnerBean bean = outputList.get(cnt); Person person = bean.getPerson(); Paragraph para_2 = new Paragraph("ID" + person.idProperty().get(), font_underline_11); para_2.setAlignment(0); doc.add(para_2); Paragraph para_3 = new Paragraph("???" + person.nameProperty().get(), font_underline_11); para_3.setAlignment(0); doc.add(para_3); Paragraph para_4 = new Paragraph("" + person.nameKanaProperty().get(), font_underline_11); para_4.setAlignment(0); doc.add(para_4); Paragraph para_5 = new Paragraph("" + person.sexProperty().get(), font_underline_11); para_5.setAlignment(0); doc.add(para_5); Paragraph para_6 = new Paragraph("" + person.birthdayProperty().get(), font_underline_11); para_6.setAlignment(0); doc.add(para_6); Table karteHistoryTable = new Table(5); karteHistoryTable.setWidth(100.0F); int[] uriage_table_width = { 25, 20, 30, 20, 25 }; karteHistoryTable.setWidths(uriage_table_width); //karteHistoryTable.setDefaultHorizontalAlignment(1); //karteHistoryTable.setDefaultVerticalAlignment(5); karteHistoryTable.setPadding(3.0F); karteHistoryTable.setSpacing(0.0F); karteHistoryTable.setBorderColor(new Color(0, 0, 0)); Cell cell_01 = new Cell(new Phrase("?", font_g10)); cell_01.setGrayFill(0.8F); cell_01.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_11 = new Cell(new Phrase("?", font_g10)); cell_11.setGrayFill(0.8F); cell_11.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_21 = new Cell(new Phrase("", font_g10)); cell_21.setGrayFill(0.8F); cell_21.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_31 = new Cell(new Phrase("", font_g10)); cell_31.setGrayFill(0.8F); cell_31.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_41 = new Cell(new Phrase("", font_g10)); cell_41.setGrayFill(0.8F); cell_41.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell_01); karteHistoryTable.addCell(cell_11); karteHistoryTable.addCell(cell_21); karteHistoryTable.addCell(cell_31); karteHistoryTable.addCell(cell_41); List<KarteBean> list = bean.getResult(); KarteBean karteInfo = list.get(0); List<DocInfoModel> docInfoList = karteInfo.getDocInfoList(); //- ??? int stepCount = 22; int tempCount = 0; int pageCount = 0; String firstKarteMaker = null; String karteMakeDate = null; if (docInfoList != null) { for (int i = 0; i < docInfoList.size(); ++i) { DocInfoModel docInfo = docInfoList.get(i); Cell cell = new Cell(new Phrase(docInfo.getFirstConfirmDateTime(), font_m8)); if (karteMakeDate == null || !karteMakeDate.equals(docInfo.getFirstConfirmDateTime())) { karteMakeDate = docInfo.getFirstConfirmDateTime(); firstKarteMaker = docInfo.getPurpose(); } cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(firstKarteMaker, font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); //- String addTitle = docInfo.getTitle(); addTitle = addTitle.replace("\r\n", ""); addTitle = addTitle.replace("\n", ""); cell = new Cell(new Phrase(addTitle, font_m8)); cell.setHorizontalAlignment(0); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(docInfo.getPurpose(), font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(docInfo.getConfirmDateTime(), font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); if (stepCount == tempCount) { if (pageCount == 0) { stepCount += 5; pageCount++; } tempCount = 0; doc.add(karteHistoryTable); doc.newPage(); karteHistoryTable.deleteAllRows(); karteHistoryTable.addCell(cell_01); karteHistoryTable.addCell(cell_11); karteHistoryTable.addCell(cell_21); karteHistoryTable.addCell(cell_31); karteHistoryTable.addCell(cell_41); } else { tempCount++; } } // Cell Empty_Cell = new Cell(new Phrase("empty", font_empty)); // for (int i = docInfoList.size(); i < docInfoList.size() + 4; ++i) { // for (int j = 0; j < 4; ++j) { // karteHistoryTable.addCell(Empty_Cell); // } // } // // Cell cell_goukei = new Cell(new Phrase("?", font_g10)); // cell_goukei.setGrayFill(0.8F); // cell_goukei.setColspan(3); // karteHistoryTable.addCell(cell_goukei); // Cell cell_sum = new Cell(new Phrase("136,900", font_m10)); // cell_sum.setHorizontalAlignment(2); // karteHistoryTable.addCell(cell_sum); doc.add(karteHistoryTable); doc.newPage(); } else { // doc.add(para_NF); Paragraph noData = new Paragraph("??", font_m8); noData.setAlignment(0); doc.add(noData); doc.newPage(); } } } catch (DocumentException | IOException e) { Logger.getLogger(AuditController.class.getName()).log(Level.SEVERE, null, e); } finally { doc.close(); } }
From source file:org.activityinfo.server.report.renderer.itext.ItextMapRenderer.java
License:Open Source License
private void renderLegend(MapReportElement element, Document doc) throws DocumentException, IOException { Table table = new Table(2); table.setBorderWidth(1);//from www . j ava 2s . co m table.setWidth(100f); table.setBorderColor(new Color(100, 100, 100)); table.setPadding(5); table.setSpacing(0); table.setCellsFitPage(true); table.setTableFitsPage(true); table.setWidths(new int[] { 1, 3 }); Cell cell = new Cell(I18N.CONSTANTS.legend()); cell.setHeader(true); cell.setColspan(2); table.addCell(cell); table.endHeaders(); for (MapLayerLegend legend : element.getContent().getLegends()) { Cell symbolCell = new Cell(); symbolCell.setHorizontalAlignment(Element.ALIGN_CENTER); symbolCell.setVerticalAlignment(Element.ALIGN_MIDDLE); Image symbol = createLegendSymbol(legend, imageCreator); symbolCell.addElement(symbol); Cell descriptionCell = new Cell(); addLegendDescription(element, legend.getDefinition(), descriptionCell); table.addCell(symbolCell); table.addCell(descriptionCell); } doc.add(table); }
From source file:org.bambrikii.photobank.web.documents.paymentcertificates.impl.PaymentCertificateBuilderRU.java
public void build(OutputStream outputStream) throws DocumentGenerationException { Document doc = new Document(PageSize.A4); PdfWriter writer;/*ww w. j a v a 2 s.c o m*/ BaseFont baseFont = null; try { writer = PdfWriter.getInstance(doc, outputStream); writer.setEncryption(null, "qweasdzxc".getBytes(), PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128); doc.open(); String baseFontPath = getResourcesPath() + "org/bambrikii/photobank/web/documents/ARIAL.TTF"; final String stampImagePath = getResourcesPath() + "org/bambrikii/photobank/web/documents/paymentcertificates/PersonaStarsStamp.png"; baseFont = BaseFont.createFont(baseFontPath, "Cp1251", true); Font baseTextStyle = new com.lowagie.text.Font(baseFont, 10, com.lowagie.text.Font.NORMAL, new Color(0, 0, 0)); Font baseBoldTextStyle = new com.lowagie.text.Font(baseFont, 10, com.lowagie.text.Font.BOLD, new Color(0, 0, 0)); Calendar cal = Calendar.getInstance(getLocale()); cal.setTime(getData().getDate()); // Act number String actNumber = MessageFormat.format( "\u0410\u043a\u0442 \u2116 {0} \u043e\u0442 \u00ab{1}\u00bb {2} {3} \u0433\u043e\u0434\u0430", String.valueOf(getData().getNumber()), cal.get(Calendar.DAY_OF_MONTH), monthsGenitiveCase.get(cal.get(Calendar.MONTH)).toLowerCase(), String.valueOf(cal.get(Calendar.YEAR))); Paragraph actNumberParagraph = new Paragraph(actNumber, new com.lowagie.text.Font(baseFont, 12, com.lowagie.text.Font.BOLD, new Color(0, 0, 0))); actNumberParagraph.setSpacingAfter(19); Paragraph cityParagraph = new Paragraph("\u0433. \u041c\u043e\u0441\u043a\u0432\u0430", baseTextStyle); cityParagraph.setSpacingAfter(15); // Licensor Paragraph licensorParagraph = new Paragraph(); licensorParagraph .add(new Chunk("\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0440: ", baseBoldTextStyle)); licensorParagraph.add(new Chunk(MessageFormat.format("{0}", "\u0418\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c \u041b\u0438\u043f\u0430\u0442\u043d\u0438\u043a\u043e\u0432 \u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447, \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0421\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u041e\u0413\u0420\u041d \u2116 305501025600011 \u043e\u0442 13.09.2005\u0433."), baseTextStyle)); licensorParagraph.setSpacingAfter(15); // Licensee Paragraph licenseeParagraph = new Paragraph(); licenseeParagraph .add(new Chunk("\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0442: ", baseBoldTextStyle)); licenseeParagraph.add(new Chunk(getData().getLicensee(), baseTextStyle)); licenseeParagraph.setSpacingAfter(15); // Pre text Paragraph pretextParagraph = new Paragraph(); pretextParagraph.add(new Chunk( "\u0412 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0414\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u043c \u041e\u0444\u0435\u0440\u0442\u044b \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u043b \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0442\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0424\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0435 \u043a\u043e\u043f\u0438\u0438) \u0438 \u043d\u0435\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 (\u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0424\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f): ", baseTextStyle)); pretextParagraph.setSpacingAfter(15); int defaultLeading = 9; // Files table Table filesTbl = new Table(5); filesTbl.setWidths(new int[] { 5, 35, 35, 10, 15 }); filesTbl.setBorder(Table.RECTANGLE); filesTbl.setBorderWidth(1); filesTbl.setSpacing(0); filesTbl.setPadding(2); filesTbl.setCellsFitPage(false); filesTbl.setUseVariableBorders(true); filesTbl.setAlignment(Element.ALIGN_LEFT); filesTbl.setWidth(100); Cell cellheader1 = new Cell(new Phrase(new Chunk("\u2116", baseBoldTextStyle))); cellheader1.setHeader(true); cellheader1.setLeading(defaultLeading); cellheader1.setHorizontalAlignment(Cell.ALIGN_CENTER); filesTbl.addCell(cellheader1); Cell cellheader2 = new Cell(new Phrase( new Chunk("\u041d\u043e\u043c\u0435\u0440 \u0444\u043e\u0442\u043e", baseBoldTextStyle))); cellheader2.setHeader(true); cellheader2.setLeading(defaultLeading); cellheader2.setHorizontalAlignment(Cell.ALIGN_CENTER); filesTbl.addCell(cellheader2); Cell cellheader3 = new Cell( new Phrase(new Chunk("\u041f\u0435\u0440\u0441\u043e\u043d\u0430", baseBoldTextStyle))); cellheader3.setHeader(true); cellheader3.setLeading(defaultLeading); cellheader3.setHorizontalAlignment(Cell.ALIGN_CENTER); filesTbl.addCell(cellheader3); Cell cellheader4 = new Cell( new Phrase(new Chunk("\u0420\u0430\u0437\u043c\u0435\u0440", baseBoldTextStyle))); cellheader4.setHeader(true); cellheader4.setLeading(defaultLeading); cellheader4.setHorizontalAlignment(Cell.ALIGN_CENTER); filesTbl.addCell(cellheader4); Cell cellheader5 = new Cell( new Phrase(new Chunk("\u0426\u0435\u043d\u0430 \u0440\u0443\u0431.", baseBoldTextStyle))); cellheader5.setHeader(true); cellheader5.setLeading(defaultLeading); cellheader5.setHorizontalAlignment(Cell.ALIGN_CENTER); filesTbl.addCell(cellheader5); filesTbl.endHeaders(); Integer i = 0; for (PaymentCertificateDataItem item : getData().getItems()) { i++; Cell cell1 = new Cell(new Phrase(new Chunk(Integer.toString(i), baseTextStyle))); cell1.setLeading(defaultLeading); cell1.setHorizontalAlignment(Cell.ALIGN_CENTER); cell1.setBorder(Cell.NO_BORDER); filesTbl.addCell(cell1); Cell cell2 = new Cell(new Phrase(new Chunk(item.getFilename(), baseTextStyle))); cell2.setLeading(defaultLeading); cell2.setHorizontalAlignment(Cell.ALIGN_LEFT); cell2.setBorder(Cell.NO_BORDER); filesTbl.addCell(cell2); Cell cell3 = new Cell(new Phrase(new Chunk(item.getName(), baseTextStyle))); cell3.setLeading(defaultLeading); cell3.setHorizontalAlignment(Cell.ALIGN_LEFT); cell3.setBorder(Cell.NO_BORDER); filesTbl.addCell(cell3); Cell cell4 = new Cell(new Phrase(new Chunk(item.getSizeName(), baseTextStyle))); cell4.setLeading(defaultLeading); cell4.setHorizontalAlignment(Cell.ALIGN_CENTER); cell4.setBorder(Cell.NO_BORDER); filesTbl.addCell(cell4); Cell cell5 = new Cell(new Phrase(new Chunk(Double.toString(item.getPrice()), baseTextStyle))); cell5.setLeading(defaultLeading); cell5.setHorizontalAlignment(Cell.ALIGN_CENTER); cell5.setBorder(Cell.NO_BORDER); filesTbl.addCell(cell5); } filesTbl.complete(); // filesTbl.normalize(); String totalPrice = MessageFormat.format("{0} {1}", String.valueOf(getData().getTotal()), getData().getCurrency()); Paragraph totalParagraph = new Paragraph(); totalParagraph.setAlignment(Paragraph.ALIGN_RIGHT); totalParagraph.add(new Chunk("\u0418\u0442\u043e\u0433\u043e: ", baseTextStyle)); totalParagraph.add(new Chunk(totalPrice, baseBoldTextStyle)); totalParagraph.setSpacingAfter(25); Paragraph posttext1Paragraph = new Paragraph(); posttext1Paragraph.add(new Chunk( "\u0412\u043e\u0437\u043d\u0430\u0433\u0440\u0430\u0436\u0434\u0435\u043d\u0438\u0435 \u0437\u0430 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0424\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442: ", baseTextStyle)); posttext1Paragraph.add(new Chunk(totalPrice, baseBoldTextStyle)); // posttext1Paragraph.setSpacingAfter(15); Paragraph posttext2Paragraph = new Paragraph( "\u041d\u0414\u0421 \u043d\u0435 \u043e\u0431\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 2, 3 \u0438 5 \u0441\u0442\u0430\u0442\u044c\u0438 346.11 \u041d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0435\u043a\u0441\u0430 \u0420\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u043e\u0439 \u0424\u0435\u0434\u0435\u0440\u0430\u0446\u0438\u0438.", baseTextStyle); posttext2Paragraph.setSpacingAfter(15); Paragraph posttext3Paragraph = new Paragraph( "\u041f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0424\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u043e\u043a\u043e\u043c \u043d\u0430 1 (\u043e\u0434\u0438\u043d) \u0433\u043e\u0434 \u0441 \u0434\u0430\u0442\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432 \u0410\u043a\u0442\u0435.", baseTextStyle); posttext3Paragraph.setSpacingAfter(15); Paragraph posttext4Paragraph = new Paragraph(); posttext4Paragraph.add(new Chunk( "\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0442 \u043d\u0435 \u0432\u043f\u0440\u0430\u0432\u0435 ", baseTextStyle)); posttext4Paragraph.add(new Chunk("(\u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442\u0441\u044f)", baseBoldTextStyle)); posttext4Paragraph.add(new Chunk( ": \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u043a\u043e\u043f\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0444\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438; \u043f\u0440\u043e\u0434\u0430\u0432\u0430\u0442\u044c, \u0441\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u043a\u0430\u0442, \u0430\u0440\u0435\u043d\u0434\u0443, \u043b\u0438\u0437\u0438\u043d\u0433, \u043a\u0430\u043a \u0441\u0430\u043c\u0438 \u0444\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u0444\u0430\u0439\u043b\u044b \u0441 \u0444\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0437\u0430\u0439\u043d\u0435 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u0435\u0439, \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043a, \u043f\u043e\u0441\u0442\u0435\u0440\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u043c\u043b\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0439 \u0432 \u0446\u0435\u043b\u044f\u0445 \u043f\u0440\u043e\u0434\u0430\u0436\u0438; \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0444\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0442\u044c \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u043c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0440\u0435\u0442\u044c\u0438\u043c\u0438 \u043b\u0438\u0446\u0430\u043c\u0438, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u0434\u0435\u043b\u0430\u044f \u0438\u0445 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438.", baseTextStyle)); posttext4Paragraph.setSpacingAfter(15); Paragraph posttext5Paragraph = new Paragraph( "\u0421\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u0443\u0441\u043b\u0443\u0433\u0438 \u043f\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043f\u0440\u0430\u0432 \u043d\u0430 \u0424\u043e\u0442\u043e\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438 \u0432 \u043f\u043e\u043b\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u0435. \u0421\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u0435\u0442\u0435\u043d\u0437\u0438\u0439 \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442.", baseTextStyle); posttext5Paragraph.setSpacingAfter(15); // Signatures Table signaturesTable = new Table(4); signaturesTable.setWidths(new int[] { 10, 40, 10, 40 }); signaturesTable.setWidth(100); signaturesTable.setSpacing(0); signaturesTable.setPadding(5); signaturesTable.setBorder(Table.NO_BORDER); Cell licensorSignature1Cell = new Cell(new Phrase( new Chunk("\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0440:", baseBoldTextStyle))); licensorSignature1Cell.setHorizontalAlignment(Cell.ALIGN_LEFT); licensorSignature1Cell.setBorder(Cell.NO_BORDER); Cell licensorSignature2Cell = new Cell(new Phrase(new Chunk( "______________/ \u041b\u0438\u043f\u0430\u0442\u043d\u0438\u043a\u043e\u0432 \u0415.\u0410. /", baseTextStyle))); licensorSignature2Cell.setHorizontalAlignment(Cell.ALIGN_LEFT); licensorSignature2Cell.setBorder(Cell.NO_BORDER); licensorSignature2Cell.addElement(new Paragraph("\n\n\n\n")); licensorSignature2Cell.add( // Stamp Image.getInstance(stampImagePath)); Cell licenseeSignature1Cell = new Cell(new Phrase( new Chunk("\u041b\u0438\u0446\u0435\u043d\u0437\u0438\u0430\u0442:", baseBoldTextStyle))); licenseeSignature1Cell.setHorizontalAlignment(Cell.ALIGN_LEFT); licenseeSignature1Cell.setBorder(Cell.NO_BORDER); Cell licenseeSignature2Cell = new Cell(new Phrase(new Chunk( MessageFormat.format("______________/ {0} /", getData().getLicensee()), baseTextStyle))); licenseeSignature2Cell.setHorizontalAlignment(Cell.ALIGN_LEFT); licenseeSignature2Cell.setBorder(Cell.NO_BORDER); signaturesTable.addCell(new Cell() { { setBorder(Cell.NO_BORDER); } }); signaturesTable.addCell(licensorSignature1Cell); signaturesTable.addCell(new Cell(true) { { setBorder(Cell.NO_BORDER); } }); signaturesTable.addCell(licenseeSignature1Cell); signaturesTable.addCell(new Cell(true) { { setBorder(Cell.NO_BORDER); } }); signaturesTable.addCell(licensorSignature2Cell); signaturesTable.addCell(new Cell(true) { { setBorder(Cell.NO_BORDER); } }); signaturesTable.addCell(licenseeSignature2Cell); signaturesTable.addCell(new Cell(true) { { setBorder(Cell.NO_BORDER); } }); signaturesTable.addCell(new Cell(true) { { setBorder(Cell.NO_BORDER); } }); signaturesTable.complete(); // PdfPTable signaturePdPfTable = signaturesTable.createPdfPTable(); // Document items doc.add(actNumberParagraph); doc.add(cityParagraph); doc.add(licensorParagraph); doc.add(licenseeParagraph); doc.add(pretextParagraph); doc.add(filesTbl); doc.add(totalParagraph); doc.add(posttext1Paragraph); doc.add(posttext2Paragraph); doc.add(posttext3Paragraph); doc.add(posttext4Paragraph); doc.add(posttext5Paragraph); doc.add(signaturesTable); doc.close(); } catch (DocumentException ex) { throw new DocumentGenerationException("Exception creating document.", ex); } catch (IOException ex) { throw new DocumentGenerationException( "Exception creating document, required font file may not be found.", ex); } }
From source file:org.displaytag.export.DefaultItextExportView.java
License:Artistic License
/** * @see org.displaytag.export.BinaryExportView#doExport(OutputStream) *//*from ww w . j a v a2s . c o m*/ public void doExport(OutputStream out) throws JspException { try { Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40); this.initItextWriter(document, out); document.open(); Table table = new Table(this.model.getNumberOfColumns()); ItextTableWriter writer = new ItextTableWriter(table, document); writer.writeTable(this.model, "-1"); document.add(table); document.close(); } catch (Exception e) { throw new ItextGenerationException(e); } }
From source file:org.displaytag.export.PdfView.java
License:Artistic License
/** * Initialize the main info holder table. * @throws BadElementException for errors during table initialization *//*from w w w.ja v a 2 s . co m*/ protected void initTable() throws BadElementException { tablePDF = new Table(this.model.getNumberOfColumns()); // tablePDF.setDefaultVerticalAlignment(Element.ALIGN_TOP); //modify by mz tablePDF.setAlignment(Element.ALIGN_TOP); tablePDF.setCellsFitPage(true); tablePDF.setWidth(100); tablePDF.setPadding(2); tablePDF.setSpacing(0); smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.NORMAL, new Color(0, 0, 0)); }
From source file:org.drools.verifier.doc.DroolsDocsComponentFactory.java
License:Apache License
private static Table newTable() throws BadElementException { Table table = new Table(1); table.setBorderWidthTop(1);//ww w . ja v a 2s. co m table.setBorderWidthLeft(1); table.setBorderWidthRight(1); table.setBorderWidthBottom(0); table.setWidth(100); table.setPadding(3); table.setAlignment(Table.ALIGN_LEFT); return table; }
From source file:org.eclipse.osee.ats.rest.internal.build.report.table.BuildTraceTable.java
License:Open Source License
private void createTables() throws OseeCoreException { try {// www.j av a2 s . c om reportTable = new Table(1); nestedHeaderTable = new Table(2); traceReportTable = new Table(2); } catch (BadElementException ex) { OseeExceptions.wrapAndThrow(ex); } }