List of usage examples for com.itextpdf.text.pdf PdfPTable setLockedWidth
public void setLockedWidth(final boolean lockedWidth)
setTotalWidth()
in Document.add()
. From source file:nl.ctmm.trait.proteomics.qcviewer.utils.ReportPDFExporter.java
License:Apache License
/** * Create the metrics values table for given report unit. This table will be added to the PDF document. * * @param allMetricsMap map of all QC metrics - keys and description. * @param reportUnit Report unit for which to create the metrics values table. * @return PDF table containing metrics values of the report unit. *//*from w ww. j av a2 s .com*/ private static PdfPTable createMetricsValuesTable(final Map<String, String> allMetricsMap, final ReportUnit reportUnit) { /* * TODO: Column size, font size and spacing of the metrics value table. */ // Create columns names. final String columnNames[] = { Constants.METRICS_ID_COLUMN_NAME, Constants.DESCRIPTION_COLUMN_NAME, Constants.VALUE_COLUMN_NAME, Constants.METRICS_ID_COLUMN_NAME, Constants.DESCRIPTION_COLUMN_NAME, Constants.VALUE_COLUMN_NAME, }; //Creation of table object. final PdfPTable table = new PdfPTable(columnNames.length); try { table.setSpacingBefore(TABLE_SPACING); //Set the table width. table.setTotalWidth(COLUMN_WIDTHS); table.setLockedWidth(true); //Add table header. for (int i = 0; i < TOTAL_COLUMNS; ++i) { final PdfPCell headerCell = new PdfPCell(new Phrase(columnNames[i], Constants.TABLE_HEADER_FONT)); headerCell.setBackgroundColor(BaseColor.RED); headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(headerCell); } //Read metricsValues corresponding to reportUnit. final Map<String, String> metricsValues = reportUnit.getMetricsValues(); //TODO: Split allMetricsMap in two parts such that sorted rows are properly added in the table. //Get all keys final Object[] keyArray = allMetricsMap.keySet().toArray(); //get all values final Object[] valueArray = allMetricsMap.values().toArray(); //Calculate halfSize final int halfSize = keyArray.length / 2; for (int i = 0; i < halfSize; ++i) { addMetric(keyArray[i].toString(), valueArray[i].toString(), metricsValues, table); addMetric(keyArray[i + halfSize].toString(), valueArray[i + halfSize].toString(), metricsValues, table); } } catch (final DocumentException e) { //DocumentException signals that an error has occurred in a Document. logger.log(Level.SEVERE, String.format(PDF_TABLE_EXCEPTION_MESSAGE, reportUnit.getMsrunName()), e); } return table; }
From source file:om.edu.squ.squportal.portlet.tsurvey.dao.pdf.TeachingSurveyPdfImpl.java
License:Open Source License
/** * //from w w w . j a va2 s . c o m * method name : getPdfSurveyAnalysis * @param object * @param semesterYear * @param questionByYear * @param questionSetNo * @param byos * @param inputStream * @param res * @return * @throws DocumentException * @throws IOException * TeachingSurveyPdfImpl * return type : OutputStream * * purpose : Generate PDF content * * Date : Mar 28, 2016 7:21:04 PM */ public OutputStream getPdfSurveyAnalysis(Object object, String semesterYear, String questionByYear, int questionSetNo, ByteArrayOutputStream byos, InputStream inputStream, ResourceResponse res) throws DocumentException, IOException { Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, BaseColor.BLACK); PdfReader pdfTemplate = new PdfReader(inputStream); PdfStamper pdfStamper = new PdfStamper(pdfTemplate, byos); Survey survey = (Survey) object; String sectionNos = ""; String seatsTaken = ""; DecimalFormat formatter = new DecimalFormat("###.##"); String RIGHT = Constants.RIGHT; String CENTER = Constants.CENTER; String LEFT = Constants.LEFT; pdfStamper.getAcroFields().setField("txtCourse", survey.getCourseCode() + " / " + survey.getCourseName()); pdfStamper.getAcroFields().setField("txtCollegeName", survey.getCollegeName()); for (SurveyResponse resp : survey.getSurveyResponses()) { sectionNos = sectionNos + resp.getSectionNo() + " "; seatsTaken = String.valueOf(resp.getSeatsTaken()); } pdfStamper.getAcroFields().setField("txtSectionNo", sectionNos); pdfStamper.getAcroFields().setField("txtDepartmentName", survey.getDepartmentName()); pdfStamper.getAcroFields().setField("txtEmpName", survey.getEmpName()); pdfStamper.getAcroFields().setField("txtStudentRegistered", seatsTaken); pdfStamper.getAcroFields().setField("txtSemesterYear", semesterYear); pdfStamper.getAcroFields().setGenerateAppearances(true); /* ****************** */ PdfPTable table = new PdfPTable(13); table.addCell(getPdfCell("", 2, 0, font, LEFT)); table.addCell(getPdfCell( UtilProperty.getMessage("prop.course.teaching.survey.analysis.course.teaching.items", null), 2, 0, font, CENTER)); table.addCell( getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.response.number", null), 0, 6, font, CENTER)); table.addCell(getPdfCell( UtilProperty.getMessage("prop.course.teaching.survey.analysis.response.percentage", null), 2, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.mean", null), 0, 4, font, CENTER)); table.addCell( getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.disagree.strong", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.disagree", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.agree", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.agree.strong", null), 0, 0, font, CENTER)); table.addCell( getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.applicable.not", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.total", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.sect", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.crs", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.dept", null), 0, 0, font, CENTER)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.col", null), 0, 0, font, CENTER)); /* ---------------------------------------------------------------------------- */ table.addCell(getPdfCell("", 0, 0, font)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.course.items", null), 0, 12, font, CENTER)); int cTotal = 0; float cPctVal = 0f; float cSectionMean = 0f; float cCourseMean = 0f; float cDepart = 0f; float cCollege = 0f; int rowCount = 0; for (SurveyResponse sures : survey.getSurveyResponses()) { for (Analysis analysis : sures.getAnalysisList()) { if (analysis.getQuestion().equals("Q2") || analysis.getQuestion().equals("Q14") || analysis.getQuestion().equals(questionByYear)) { /*** First part ***/ table.addCell(getPdfCell(analysis.getQuestion(), 0, 0, font)); table.addCell( getPdfCell( UtilProperty.getMessage("prop.course.teaching.survey.analysis.set" + questionSetNo + ".question" + analysis.getQuestionLabel(), null), 0, 0, font, LEFT)); table.addCell(getPdfCell(String.valueOf(analysis.getStrongDisagree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getDisAgree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getAgree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getStrongAgree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getNotApplicable()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getTotal()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getPercentageResponse()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getSectionMean()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getCourseMean()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getDepartmentMean()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getCollegeMean()), 0, 0, font, RIGHT)); cTotal = cTotal + analysis.getTotal(); cPctVal = cPctVal + analysis.getPercentageResponse(); cSectionMean = cSectionMean + analysis.getSectionMean(); cCourseMean = cCourseMean + analysis.getCollegeMean(); cDepart = cDepart + analysis.getDepartmentMean(); cCollege = cCollege + analysis.getCollegeMean(); rowCount = rowCount + 1; } } } /*** First part - Summary ***/ table.addCell(getPdfCell(String.valueOf(""), 0, 0, font)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.summary", null), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(""), 0, 5, font)); table.addCell(getPdfCell(String.valueOf(cTotal), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cPctVal / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cSectionMean / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cCourseMean / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cDepart / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cCollege / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell("", 0, 13, font)); table.addCell(getPdfCell("", 0, 0, font)); table.addCell( getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.teaching.items", null), 0, 12, font, LEFT)); cTotal = 0; cPctVal = 0f; cSectionMean = 0f; cCourseMean = 0f; cDepart = 0f; cCollege = 0f; rowCount = 0; for (SurveyResponse sures : survey.getSurveyResponses()) { for (Analysis analysis : sures.getAnalysisList()) { if (!(analysis.getQuestion().equals("Q2") || analysis.getQuestion().equals("Q14") || analysis.getQuestion().equals(questionByYear))) { table.addCell(getPdfCell(analysis.getQuestion(), 0, 0, font)); table.addCell( getPdfCell( UtilProperty.getMessage("prop.course.teaching.survey.analysis.set" + questionSetNo + ".question" + analysis.getQuestionLabel(), null), 0, 0, font, LEFT)); table.addCell(getPdfCell(String.valueOf(analysis.getStrongDisagree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getDisAgree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getAgree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getStrongAgree()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getNotApplicable()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getTotal()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getPercentageResponse()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getSectionMean()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getCourseMean()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getDepartmentMean()), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(analysis.getCollegeMean()), 0, 0, font, RIGHT)); cTotal = cTotal + analysis.getTotal(); cPctVal = cPctVal + analysis.getPercentageResponse(); cSectionMean = cSectionMean + analysis.getSectionMean(); cCourseMean = cCourseMean + analysis.getCollegeMean(); cDepart = cDepart + analysis.getDepartmentMean(); cCollege = cCollege + analysis.getCollegeMean(); rowCount = rowCount + 1; } } } /*** Second part - Summary ***/ table.addCell(getPdfCell(String.valueOf(""), 0, 0, font)); table.addCell(getPdfCell(UtilProperty.getMessage("prop.course.teaching.survey.analysis.summary", null), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(""), 0, 5, font)); table.addCell(getPdfCell(String.valueOf(cTotal), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cPctVal / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cSectionMean / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cCourseMean / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cDepart / rowCount)), 0, 0, font, RIGHT)); table.addCell(getPdfCell(String.valueOf(formatter.format(cCollege / rowCount)), 0, 0, font, RIGHT)); if (!survey.getMessage().equals("")) { table.addCell(getPdfCell("", 0, 13, font)); table.addCell(getPdfCell("", 0, 0, font)); table.addCell(getPdfCell(survey.getMessage(), 0, 12, font, CENTER)); } table.setTotalWidth(750); table.setLockedWidth(true); table.setWidths(new float[] { 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }); ColumnText column = new ColumnText(pdfStamper.getOverContent(1)); Rectangle rectPage1 = new Rectangle(120, 20, 659, 480); column.setSimpleColumn(rectPage1); column.addElement(table); int status = column.go(); pdfStamper.setFormFlattening(true); pdfStamper.close(); pdfTemplate.close(); res.setContentType("application/pdf"); return res.getPortletOutputStream(); }
From source file:org.cejug.yougi.web.report.EventAttendeeReport.java
License:Open Source License
public void printReport(List<Attendee> attendees) throws DocumentException { float[] columnSizes = { 20, 220, 220, 60 }; PdfPTable table = new PdfPTable(columnSizes.length); table.setLockedWidth(true); table.setTotalWidth(columnSizes);//from w w w . j a v a 2s .co m PdfPCell headerCell = new PdfPCell(new Phrase("Yougi")); headerCell.setColspan(4); headerCell.setBackgroundColor(BaseColor.ORANGE); headerCell.setPadding(3); table.addCell(headerCell); table.getDefaultCell().setBackgroundColor(BaseColor.LIGHT_GRAY); PdfPCell checkCell = new PdfPCell(new Phrase(" ")); checkCell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(checkCell); PdfPCell productCell = new PdfPCell(new Phrase("Nome")); productCell.setBackgroundColor(BaseColor.LIGHT_GRAY); productCell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(productCell); PdfPCell currentPurchaseCell = new PdfPCell(new Phrase("Email")); currentPurchaseCell.setPadding(3); currentPurchaseCell.setHorizontalAlignment(Element.ALIGN_CENTER); currentPurchaseCell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(currentPurchaseCell); PdfPCell previousPurchaseCell = new PdfPCell(new Phrase("Presente")); previousPurchaseCell.setPadding(3); previousPurchaseCell.setHorizontalAlignment(Element.ALIGN_CENTER); previousPurchaseCell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(previousPurchaseCell); table.getDefaultCell().setBackgroundColor(null); table.setHeaderRows(2); Font font = new Font(Font.FontFamily.HELVETICA, 9); int seq = 1; for (Attendee attendee : attendees) { table.addCell(new Phrase(String.valueOf(seq++), font)); table.addCell(new Phrase(attendee.getUserAccount().getFullName(), font)); table.addCell(new Phrase(attendee.getUserAccount().getEmail(), font)); table.addCell(" "); } document.add(table); }
From source file:org.fossa.rolp.util.LebPageHelper.java
License:Open Source License
@Override public void onEndPage(PdfWriter writer, Document document) { PdfPTable table = new PdfPTable(2); table.setTotalWidth(527);/*from w ww . jav a 2s . c om*/ table.setWidthPercentage(100); table.setLockedWidth(true); table.getDefaultCell().setFixedHeight(105f); table.getDefaultCell().setBorderWidth(0); table.addCell(""); table.addCell(csmLogoImage); table.writeSelectedRows(0, -1, 100, 840, writer.getDirectContent()); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase( lebData.getSchuelername() + " " + lebData.getSchuljahr() + " " + lebData.getSchulhalbjahr().getId() + " Seite " + document.getPageNumber(), fusszeilenFont), 100, 75, 0); }
From source file:org.inspira.condominio.pdf.DocumentoEstadoDeCuenta.java
private void bakeContent(String path, String imgResString) throws IOException, DocumentException { File outFile = new File(path); outFile.getParentFile().mkdirs();//from w ww .jav a 2s . c o m PdfWriter.getInstance(documento, new FileOutputStream(outFile)); documento.open(); documento.add(new Paragraph( "Ciudad de Mxico, " + DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault()).format(new Date()), new Font(FontFamily.HELVETICA, 18, Font.NORMAL, new BaseColor(0x000000)))); Paragraph intro = new Paragraph(new Phrase("Comprobante de estado de cuenta", F_NORMAL)); intro.setAlignment(Paragraph.ALIGN_RIGHT); intro.setSpacingBefore(10f); documento.add(intro); Image image = Image.getInstance(imgResString); PdfPTable table = new PdfPTable(1); table.setTotalWidth(image.getScaledWidth()); table.setLockedWidth(true); PdfPCell cell = new PdfPCell(); cell.setBorder(0); //cell.setCellEvent(new ImageBackgroundEvent(image)); cell.setFixedHeight(image.getScaledHeight()); table.addCell(cell); documento.add(table); Paragraph p1 = new Paragraph("Estado de cuenta: ".concat(idEdoCta), F_NORMAL); p1.setSpacingBefore(5f); p1.setSpacingAfter(25f); p1.setAlignment(Paragraph.ALIGN_CENTER); documento.add(p1); documento.add(new Paragraph("Pagos", F_NORMAL)); agregaTablaDePagos(); Paragraph pNotas = new Paragraph("Notas: ".concat(notas), F_NORMAL); pNotas.setSpacingAfter(12f); pNotas.setSpacingAfter(2f); documento.add(pNotas); Paragraph pAdeudos = new Paragraph("Adeudos", F_NORMAL); pAdeudos.setSpacingBefore(25f); documento.add(pAdeudos); agregaTablaDeAdeudos(); documento.add(new Paragraph( "Recuerde que puede consultar su estado de pagos y adeudos desde la aplicacin mvil o directamente con su administrador.", F_NORMAL)); Paragraph hechoPor = new Paragraph("Elabor:", F_NORMAL); hechoPor.setSpacingBefore(30f); hechoPor.setSpacingAfter(15f); documento.add(hechoPor); Paragraph nombreDelAdmin = new Paragraph(admin, F_NORMAL); nombreDelAdmin.setAlignment(Paragraph.ALIGN_CENTER); documento.add(nombreDelAdmin); Paragraph nombreDeCondominio = new Paragraph(condominio, F_NORMAL); nombreDeCondominio.setAlignment(Paragraph.ALIGN_CENTER); documento.add(nombreDeCondominio); }
From source file:org.inspira.condominio.pdf.DocumentoIngreso.java
private void addHousePicture(String imgResStr) throws BadElementException, IOException, DocumentException { Image image = Image.getInstance(imgResStr); PdfPTable table = new PdfPTable(1); table.setTotalWidth(image.getScaledWidth()); table.setLockedWidth(true); PdfPCell cell = new PdfPCell(); cell.setBorder(0);// www . j a va2 s . c o m //cell.setCellEvent(new ImageBackgroundEvent(image)); cell.setFixedHeight(image.getScaledHeight()); table.addCell(cell); table.setHorizontalAlignment(PdfPTable.ALIGN_RIGHT); documento.add(table); }
From source file:org.qnot.passtab.PDFOutput.java
License:Open Source License
private void createPDF(OutputStream out, String[][] array) throws IOException, DocumentException { Document document = new Document(PageSize.LETTER.rotate()); PdfWriter.getInstance(document, out); document.open();/*from w w w. j a va 2 s . c om*/ PdfPTable table = new PdfPTable(array[0].length); table.setTotalWidth((float) array.length * PDFOutput.CELL_WIDTH); table.setLockedWidth(true); table.setHorizontalAlignment(Element.ALIGN_CENTER); for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { addCell(table, array[i][j], (j % 2) != 0, (i % 2) != 0, j == 0, i == 0); } } document.add(table); document.close(); }
From source file:pdf.FooterHeader.java
License:Open Source License
@Override public void onEndPage(PdfWriter writer, Document document) { PdfPTable table = new PdfPTable(3); try {//from w w w .j av a 2 s. co m if (document.getPageNumber() > 1) { table.setWidths(new int[] { 24, 24, 2 }); table.setTotalWidth(527); table.setLockedWidth(true); table.getDefaultCell().setFixedHeight(20); table.getDefaultCell().setBorder(Rectangle.BOTTOM); table.addCell(header); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(String.format("Seite %d von", writer.getPageNumber())); PdfPCell cell = new PdfPCell(Image.getInstance(total)); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); table.writeSelectedRows(0, -1, 34, 803, writer.getDirectContent()); } } catch (DocumentException de) { throw new ExceptionConverter(de); } PdfContentByte cb = writer.getDirectContent(); if (document.getPageNumber() > 1) { footer = new Phrase(document.getPageNumber() - 2); ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, footer, (document.right() - document.left() - 30) / 2 + document.leftMargin(), document.bottom() + 10, 0); } }
From source file:se.billes.pdf.renderer.model.text.TableParagraph.java
License:Open Source License
@Override public void onRender(PdfPCell cell) throws PdfRenderException { PdfPTable table = new PdfPTable(widths.length); try {/*from w ww .ja v a 2 s .co m*/ table.setTotalWidth(getTotalWidthsAsPs()); table.setLockedWidth(true); table.setSpacingAfter(0f); for (AbstractParagraph tableCell : cells) { PdfPCell c = new PdfPCell(); float[] padding = new float[] { 0f, 0f, 0f, 0f }; if (tableCell instanceof TableCell) { padding = ((TableCell) tableCell).getPadding(); } c.setBorderWidth(0f); c.setLeft(0); c.setTop(0); c.setRight(0); c.setBottom(0); c.setUseAscender(true); c.setIndent(0); c.setHorizontalAlignment(Element.ALIGN_LEFT); c.setVerticalAlignment(Element.ALIGN_TOP); c.setPaddingLeft(SizeFactory.millimetersToPostscriptPoints(padding[0])); c.setPaddingBottom(SizeFactory.millimetersToPostscriptPoints(padding[3])); c.setPaddingRight(SizeFactory.millimetersToPostscriptPoints(padding[2])); c.setPaddingTop(SizeFactory.millimetersToPostscriptPoints(padding[1])); c.setBorder(0); tableCell.onRender(c); table.addCell(c); } cell.addElement(table); } catch (Exception e) { throw new PdfRenderException(e); } }
From source file:se.billes.pdf.renderer.request.factory.TableFactory.java
License:Open Source License
public PdfPTable createTable(float widthInPs) { PdfPTable table = new PdfPTable(1); table.setTotalWidth(widthInPs);/* w ww. ja v a 2 s. com*/ table.setLockedWidth(true); table.setSpacingBefore(0); table.setSpacingAfter(0); return table; }