List of usage examples for com.lowagie.text Phrase add
public boolean add(Object o)
Chunk
, Anchor
or another Phrase
to this Phrase
. From source file:net.bull.javamelody.internal.web.pdf.PdfJobInformationsReport.java
License:Apache License
private void writeJobTimes(JobInformations jobInformations, CounterRequest counterRequest) throws BadElementException, IOException { final long elapsedTime = jobInformations.getElapsedTime(); if (elapsedTime >= 0) { final Phrase elapsedTimePhrase = new Phrase(durationFormat.format(elapsedTime), cellFont); final Image memoryImage = Image.getInstance(Bar.toBar(100d * elapsedTime / counterRequest.getMean()), null);// w ww . j a v a 2s . com memoryImage.scalePercent(47); elapsedTimePhrase.add("\n"); elapsedTimePhrase.add(new Chunk(memoryImage, 0, 0)); addCell(elapsedTimePhrase); } else { addCell(""); } if (jobInformations.getPreviousFireTime() != null) { addCell(fireTimeFormat.format(jobInformations.getPreviousFireTime())); } else { addCell(""); } if (jobInformations.getNextFireTime() != null) { addCell(fireTimeFormat.format(jobInformations.getNextFireTime())); } else { addCell(""); } // on n'affiche pas la priode si >= 1 jour car ce formateur ne saurait pas l'afficher if (jobInformations.getRepeatInterval() > 0 && jobInformations.getRepeatInterval() < ONE_DAY_MILLIS) { addCell(durationFormat.format(new Date(jobInformations.getRepeatInterval()))); } else if (jobInformations.getCronExpression() != null) { addCell(jobInformations.getCronExpression()); } else { addCell(""); } }
From source file:net.bull.javamelody.PdfJavaInformationsReport.java
License:Apache License
private void writeSummary(JavaInformations javaInformations) throws BadElementException, IOException { addCell(getString("Host") + ':'); currentTable.addCell(new Phrase(javaInformations.getHost(), boldCellFont)); addCell(getString("memoire_utilisee") + ':'); final MemoryInformations memoryInformations = javaInformations.getMemoryInformations(); final long usedMemory = memoryInformations.getUsedMemory(); final long maxMemory = memoryInformations.getMaxMemory(); final Phrase memoryPhrase = new Phrase( integerFormat.format(usedMemory / 1024 / 1024) + ' ' + getString("Mo") + DIVIDE + integerFormat.format(maxMemory / 1024 / 1024) + ' ' + getString("Mo") + BAR_SEPARATOR, cellFont);// w w w .ja v a2 s . com final Image memoryImage = Image .getInstance(Bar.toBarWithAlert(memoryInformations.getUsedMemoryPercentage()), null); memoryImage.scalePercent(50); memoryPhrase.add(new Chunk(memoryImage, 0, 0)); currentTable.addCell(memoryPhrase); if (javaInformations.getSessionCount() >= 0) { addCell(getString("nb_sessions_http") + ':'); addCell(integerFormat.format(javaInformations.getSessionCount())); } addCell(getString("nb_threads_actifs") + "\n(" + getString("Requetes_http_en_cours") + "):"); addCell(integerFormat.format(javaInformations.getActiveThreadCount())); if (!noDatabase) { addCell(getString("nb_connexions_actives") + ':'); addCell(integerFormat.format(javaInformations.getActiveConnectionCount())); addCell(getString("nb_connexions_utilisees") + "\n(" + getString("ouvertes") + "):"); final int usedConnectionCount = javaInformations.getUsedConnectionCount(); final int maxConnectionCount = javaInformations.getMaxConnectionCount(); if (maxConnectionCount <= 0) { addCell(integerFormat.format(usedConnectionCount)); } else { final Phrase usedConnectionCountPhrase = new Phrase(integerFormat.format(usedConnectionCount) + DIVIDE + integerFormat.format(maxConnectionCount) + BAR_SEPARATOR, cellFont); final Image usedConnectionCountImage = Image .getInstance(Bar.toBarWithAlert(javaInformations.getUsedConnectionPercentage()), null); usedConnectionCountImage.scalePercent(50); usedConnectionCountPhrase.add(new Chunk(usedConnectionCountImage, 0, 0)); currentTable.addCell(usedConnectionCountPhrase); } } if (javaInformations.getSystemLoadAverage() >= 0) { addCell(getString("Charge_systeme") + ':'); addCell(decimalFormat.format(javaInformations.getSystemLoadAverage())); } }
From source file:net.bull.javamelody.PdfJavaInformationsReport.java
License:Apache License
private void writeDetails(JavaInformations javaInformations) throws BadElementException, IOException { addCell(getString("OS") + ':'); final Phrase osPhrase = new Phrase("", cellFont); final String osIconName = HtmlJavaInformationsReport.getOSIconName(javaInformations.getOS()); final String separator = " "; if (osIconName != null) { final Image osImage = PdfDocumentFactory.getImage("servers/" + osIconName); osImage.scalePercent(40);/*from www . j a va 2 s . c o m*/ osPhrase.add(new Chunk(osImage, 0, 0)); osPhrase.add(separator); } osPhrase.add(javaInformations.getOS() + " (" + javaInformations.getAvailableProcessors() + ' ' + getString("coeurs") + ')'); currentTable.addCell(osPhrase); addCell(getString("Java") + ':'); addCell(javaInformations.getJavaVersion()); addCell(getString("JVM") + ':'); final Phrase jvmVersionPhrase = new Phrase(javaInformations.getJvmVersion(), cellFont); if (javaInformations.getJvmVersion().contains("Client")) { jvmVersionPhrase.add(separator); final Image alertImage = PdfDocumentFactory.getImage("alert.png"); alertImage.scalePercent(50); jvmVersionPhrase.add(new Chunk(alertImage, 0, -2)); } currentTable.addCell(jvmVersionPhrase); addCell(getString("PID") + ':'); addCell(javaInformations.getPID()); if (javaInformations.getUnixOpenFileDescriptorCount() >= 0) { writeFileDescriptorCounts(javaInformations); } final String serverInfo = javaInformations.getServerInfo(); if (serverInfo != null) { writeServerInfo(serverInfo); addCell(getString("Contexte_webapp") + ':'); addCell(javaInformations.getContextPath()); } addCell(getString("Demarrage") + ':'); addCell(I18N.createDateAndTimeFormat().format(javaInformations.getStartDate())); addCell(getString("Arguments_JVM") + ':'); addCell(javaInformations.getJvmArguments()); if (javaInformations.getSessionCount() >= 0) { addCell(getString("httpSessionsMeanAge") + ':'); addCell(integerFormat.format(javaInformations.getSessionMeanAgeInMinutes())); } writeTomcatInformations(javaInformations.getTomcatInformationsList()); addCell(getString("Gestion_memoire") + ':'); writeMemoryInformations(javaInformations.getMemoryInformations()); if (javaInformations.getFreeDiskSpaceInTemp() >= 0) { // on considre que l'espace libre sur le disque dur est celui sur la partition du rpertoire temporaire addCell(getString("Free_disk_space") + ':'); addCell(integerFormat.format(javaInformations.getFreeDiskSpaceInTemp() / 1024 / 1024) + ' ' + getString("Mo")); } writeDatabaseVersionAndDataSourceDetails(javaInformations); if (javaInformations.isDependenciesEnabled()) { addCell(getString("Dependencies") + ':'); addCell(getFormattedString("nb_dependencies", javaInformations.getDependenciesList().size()) + " ;\n" + javaInformations.getDependencies()); } addCell(""); addCell(""); }
From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java
License:LGPL
/** * *///from ww w. j av a2 s. c om protected Phrase getPhrase(JRStyledText styledText, JRPrintText textElement) { Phrase phrase = new Phrase(); String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while (runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { Chunk chunk = getChunk(iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit)); setAnchor(chunk, textElement, textElement); setHyperlinkInfo(chunk, textElement); phrase.add(chunk); iterator.setIndex(runLimit); } return phrase; }
From source file:nl.knaw.dans.common.lang.pdf.ExtendedHtmlWorker.java
License:Apache License
public void endElement(String tag) { if (!tagsSupported.containsKey(tag)) return;//from w w w. java2 s.c om try { String follow = (String) FactoryProperties.followTags.get(tag); if (follow != null) { cprops.removeChain(follow); return; } if (tag.equals("font") || tag.equals("span")) { cprops.removeChain(tag); return; } if (tag.equals("a")) { if (currentParagraph == null) currentParagraph = new Paragraph(); ALink i = null; boolean skip = false; if (interfaceProps != null) { i = (ALink) interfaceProps.get("alink_interface"); if (i != null) skip = i.process(currentParagraph, cprops); } if (!skip) { String href = cprops.getProperty("href"); if (href != null) { ArrayList chunks = currentParagraph.getChunks(); for (int k = 0; k < chunks.size(); ++k) { Chunk ck = (Chunk) chunks.get(k); ck.setAnchor(href); } } } Paragraph tmp = (Paragraph) stack.pop(); Phrase tmp2 = new Phrase(); tmp2.add(currentParagraph); tmp.add(tmp2); currentParagraph = tmp; cprops.removeChain("a"); return; } if (tag.equals("br")) { return; } if (currentParagraph != null) { if (stack.empty()) document.add(currentParagraph); else { Object obj = stack.pop(); if (obj instanceof TextElementArray) { TextElementArray current = (TextElementArray) obj; current.add(currentParagraph); } stack.push(obj); } } currentParagraph = null; if (tag.equals("ul") || tag.equals("ol")) { if (pendingLI) endElement("li"); skipText = false; cprops.removeChain(tag); if (stack.empty()) return; Object obj = stack.pop(); if (!(obj instanceof com.lowagie.text.List)) { stack.push(obj); return; } if (stack.empty()) document.add((Element) obj); else ((TextElementArray) stack.peek()).add(obj); return; } if (tag.equals("li")) { pendingLI = false; skipText = true; cprops.removeChain(tag); if (stack.empty()) return; Object obj = stack.pop(); if (!(obj instanceof ListItem)) { stack.push(obj); return; } if (stack.empty()) { document.add((Element) obj); return; } Object list = stack.pop(); if (!(list instanceof com.lowagie.text.List)) { stack.push(list); return; } ListItem item = (ListItem) obj; ((com.lowagie.text.List) list).add(item); ArrayList cks = item.getChunks(); if (!cks.isEmpty()) item.getListSymbol().setFont(((Chunk) cks.get(0)).getFont()); stack.push(list); return; } if (tag.equals("div") || tag.equals("body")) { cprops.removeChain(tag); return; } if (tag.equals("pre")) { cprops.removeChain(tag); isPRE = false; return; } if (tag.equals("p")) { cprops.removeChain(tag); return; } if (tag.equals("h1") || tag.equals("h2") || tag.equals("h3") || tag.equals("h4") || tag.equals("h5") || tag.equals("h6")) { cprops.removeChain(tag); return; } if (tag.equals("table")) { if (pendingTR) endElement("tr"); cprops.removeChain("table"); IncTable table = (IncTable) stack.pop(); PdfPTable tb = table.buildTable(); tb.setSplitRows(true); if (stack.empty()) document.add(tb); else ((TextElementArray) stack.peek()).add(tb); boolean state[] = (boolean[]) tableState.pop(); pendingTR = state[0]; pendingTD = state[1]; skipText = false; return; } if (tag.equals("tr")) { if (pendingTD) endElement("td"); pendingTR = false; cprops.removeChain("tr"); ArrayList cells = new ArrayList(); IncTable table = null; while (true) { Object obj = stack.pop(); if (obj instanceof IncCell) { cells.add(((IncCell) obj).getCell()); } if (obj instanceof IncTable) { table = (IncTable) obj; break; } } table.addCols(cells); table.endRow(); stack.push(table); skipText = true; return; } if (tag.equals("td") || tag.equals("th")) { pendingTD = false; cprops.removeChain("td"); skipText = true; return; } } catch (Exception e) { throw new ExceptionConverter(e); } }
From source file:org.activityinfo.server.report.renderer.itext.ItextMapRenderer.java
License:Open Source License
private void addPieChartDescription(MapReportElement element, Cell descriptionCell, PiechartMapLayer layer) throws BadElementException, IOException { for (Slice slice : layer.getSlices()) { IndicatorDTO indicator = element.getContent().getIndicatorById(slice.getIndicatorId()); Color color = ColorUtil.colorFromString(slice.getColor()); ItextGraphic sliceImage = renderSlice(imageCreator, color, 10); Chunk box = new Chunk(sliceImage.toItextImage(), 0, 0); Chunk description = new Chunk(indicator.getName()); Phrase phrase = new Phrase(); phrase.add(box); phrase.add(description);/* ww w . j a va 2 s . com*/ Paragraph paragraph = new Paragraph(phrase); descriptionCell.add(paragraph); } }
From source file:org.areasy.common.doclet.document.Destinations.java
License:Open Source License
/** * Creates a destination in the document. This method * does nothing if the given destination is invalid. * <p/>/* w ww . j a v a 2 s. co m*/ * This method creates a phrase with one or two empty chunks * who only serve as holders for the destinations. * * @param label The label for the destination. * @param doc The javadoc element for which to create a destination. * @param font The font for the label. * @return The Phrase with the destination in it. */ public static Phrase createDestination(String label, ProgramElementDoc doc, Font font) { boolean multiPart = false; Chunk chunk = null; boolean canHaveParms = false; if (doc instanceof ConstructorDoc || doc instanceof MethodDoc) canHaveParms = true; if (canHaveParms) multiPart = true; chunk = new Chunk(label, font); Phrase phrase = new Phrase(chunk); String destination = doc.qualifiedName(); phrase.add(PDFUtility.createAnchor(destination)); if (multiPart) { ExecutableMemberDoc execDoc = (ExecutableMemberDoc) doc; String destinationTwo = destination + "()"; phrase.add(PDFUtility.createAnchor(destinationTwo)); String destinationThree = destination + execDoc.signature(); phrase.add(PDFUtility.createAnchor(destinationThree)); String destinationFour = destination + execDoc.flatSignature(); phrase.add(PDFUtility.createAnchor(destinationFour)); } return phrase; }
From source file:org.areasy.common.doclet.document.Members.java
License:Open Source License
/** * Prints member information.// w ww. j a va2s . c om * * @param declaration The modifiers ("public static final.."). * @param returnType Phrase with the return type text (might be * a hyperlink) * @param parms Parameters of a method or constructor, null for a field. * @param thrownExceptions Exceptions of a method, null for a field or constructor. * @param isFirst True if it is the first field/method/constructor in the list. * @param isField True if it is a field. * @param isConstructor True if it is a constructor. * @throws Exception */ public static void printMember(String declaration, Phrase returnType, ProgramElementDoc commentDoc, Parameter[] parms, ClassDoc[] thrownExceptions, boolean isFirst, boolean isField, boolean isConstructor, boolean isDeprecated, Phrase deprecatedPhrase, Object constantValue) throws Exception { String name = commentDoc.name(); State.setCurrentMember(State.getCurrentClass() + "." + name); State.setCurrentDoc(commentDoc); // Returns the text, resolving any "inheritDoc" inline tags String commentText = DocletUtility.getComment(commentDoc); // TODO: The following line may set the wrong page number // in the index, when the member gets printed on a // new page completely (because it is in one table). // Solution unknown yet. Probably split up table. Doclet.getIndex().addToMemberList(State.getCurrentMember()); // Prepare list of exceptions (if it throws any) String throwsText = "throws"; int parmsColumn = declaration.length() + (name.length() - throwsText.length()); // First output text line (declaration of method and first parameter or "()" ). // This first line is a special case because the class name is bold, // while the rest is regular plain text, so it must be built using three Chunks. Paragraph declarationParagraph = new Paragraph((float) 10.0); // left part / declaration ("public static..") Chunk leftPart = new Chunk(declaration, Fonts.getFont(CODE_FONT, 10)); declarationParagraph.add(leftPart); if (returnType != null) { // left middle part / declaration ("public static..") declarationParagraph.add(returnType); declarationParagraph.add(new Chunk(" ", Fonts.getFont(CODE_FONT, 10))); parmsColumn = 2; } // right middle part / bold class name declarationParagraph.add(new Chunk(name, Fonts.getFont(CODE_FONT, BOLD, 10))); if (!isField) { // 1st parameter or empty brackets if ((parms != null) && (parms.length > 0)) { Phrase wholePhrase = new Phrase("(", Fonts.getFont(CODE_FONT, 10)); // create link for parameter type wholePhrase.add(PDFUtility.getParameterTypePhrase(parms[0], 10)); // then normal text for parameter name wholePhrase.add(" " + parms[0].name()); if (parms.length > 1) { wholePhrase.add(","); } else { wholePhrase.add(")"); } // In order to have the parameter types in the bookmark, // make the current state text more detailled String txt = State.getCurrentMethod() + "("; for (int i = 0; i < parms.length; i++) { if (i > 0) txt = txt + ","; txt = txt + DocletUtility.getParameterType(parms[i]); } txt = txt + ")"; State.setCurrentMethod(txt); // right part / parameter and brackets declarationParagraph.add(wholePhrase); } else { String lastPart = "()"; State.setCurrentMethod(State.getCurrentMethod() + lastPart); // right part / parameter and brackets declarationParagraph.add(new Chunk(lastPart, Fonts.getFont(CODE_FONT, 10))); } } float[] widths = { (float) 6.0, (float) 94.0 }; PdfPTable table = new PdfPTable(widths); table.setWidthPercentage((float) 100); // Before the first constructor or method, create a coloured title bar if (isFirst) { PdfPCell colorTitleCell = null; // Some empty space... Document.add(new Paragraph((float) 6.0, " ")); if (isConstructor) colorTitleCell = new CustomPdfPCell("Constructors"); else if (isField) colorTitleCell = new CustomPdfPCell("Fields"); else colorTitleCell = new CustomPdfPCell("Methods"); colorTitleCell.setColspan(2); table.addCell(colorTitleCell); } // Method name (large, first line of a method description block) Phrase linkPhrase = Destinations.createDestination(commentDoc.name(), commentDoc, Fonts.getFont(TEXT_FONT, BOLD, 14)); Paragraph nameTitle = new Paragraph(linkPhrase); PdfPCell nameCell = new CellNoBorderNoPadding(nameTitle); if (isFirst) nameCell.setPaddingTop(10); else nameCell.setPaddingTop(0); nameCell.setPaddingBottom(8); nameCell.setColspan(1); // Create nested table in order to try to prevent the stuff inside // this table from being ripped appart over a page break. The method // name and the declaration/parm/exception line(s) should always be // together, because everything else just looks bad PdfPTable linesTable = new PdfPTable(1); linesTable.addCell(nameCell); linesTable.addCell(new CellNoBorderNoPadding(declarationParagraph)); if (!isField) { // Set up following declaration lines Paragraph[] params = PDFUtility.createParameters(parmsColumn, parms); Paragraph[] exceps = PDFUtility.createExceptions(parmsColumn, thrownExceptions); for (int i = 0; i < params.length; i++) { linesTable.addCell(new CellNoBorderNoPadding(params[i])); } for (int i = 0; i < exceps.length; i++) { linesTable.addCell(new CellNoBorderNoPadding(exceps[i])); } } // Create cell for inserting the nested table into the outer table PdfPCell cell = new PdfPCell(linesTable); cell.setPadding(5); cell.setBorder(Rectangle.NO_BORDER); cell.setColspan(2); table.addCell(cell); // The empty, left cell (the invisible indentation column) State.setContinued(true); PdfPCell leftCell = PDFUtility.createElementCell(5, new Phrase("", Fonts.getFont(TEXT_FONT, BOLD, 6))); PdfPCell spacingCell = new PdfPCell(); spacingCell.setFixedHeight((float) 8.0); spacingCell.setBorder(Rectangle.NO_BORDER); table.addCell(spacingCell); table.addCell(spacingCell); // The descriptive method explanation text if (isDeprecated) { Phrase commentPhrase = new Phrase(); commentPhrase .add(new Phrase(AbstractConfiguration.LB_DEPRECATED_TAG, Fonts.getFont(TEXT_FONT, BOLD, 10))); commentPhrase.add(deprecatedPhrase); table.addCell(leftCell); table.addCell(PDFUtility.createElementCell(0, commentPhrase)); commentPhrase = new Phrase(); commentPhrase.add(Chunk.NEWLINE); table.addCell(leftCell); table.addCell(PDFUtility.createElementCell(0, commentPhrase)); } Element[] objs = HtmlParserWrapper.createPdfObjects(commentText); if (objs.length == 1) { table.addCell(leftCell); table.addCell(PDFUtility.createElementCell(0, objs[0])); } else { table.addCell(leftCell); table.addCell(PDFUtility.createElementCell(0, Element.ALIGN_LEFT, objs)); } // TODO: FORMAT THIS CONSTANT VALUE OUTPUT CORRECTLY if (isField) { if (constantValue != null) { // Add 2nd comment line (left cell empty, right cell text) Chunk valueTextChunk = new Chunk("Constant value: ", Fonts.getFont(TEXT_FONT, PLAIN, 10)); Chunk valueContentChunk = new Chunk(constantValue.toString(), Fonts.getFont(CODE_FONT, BOLD, 10)); Phrase constantValuePhrase = new Phrase(""); constantValuePhrase.add(valueTextChunk); constantValuePhrase.add(valueContentChunk); table.addCell(leftCell); table.addCell(PDFUtility.createElementCell(0, constantValuePhrase)); } } // Add whole method block to document Document.add(table); }
From source file:org.areasy.common.doclet.document.Summary.java
License:Open Source License
/** * Prints field summaries./*from w ww . ja va 2 s .co m*/ * @param constantValue * @param isDeprecated * @param deprecatedPhrase * @param mainTable * @throws Exception */ private static void printField(FieldDoc fieldDoc, Object constantValue, boolean isDeprecated, Phrase deprecatedPhrase, PdfPTable mainTable) throws Exception { String name = fieldDoc.name(); String modifier = fieldDoc.modifiers(); String commentText = DocletUtility.getFirstSentence(fieldDoc); String destination = fieldDoc.qualifiedName(); Element[] objs = HtmlParserWrapper.createPdfObjects(commentText); PdfPTable commentsTable = createColumnsAndDeprecated(objs, isDeprecated, deprecatedPhrase); if (constantValue != null) { // Add 2nd comment line (left cell empty, right cell text) commentsTable.addCell(new Phrase("")); Chunk valueTextChunk = new Chunk("Value: ", Fonts.getFont(TEXT_FONT, PLAIN, 10)); Chunk valueContentChunk = new Chunk(constantValue.toString(), Fonts.getFont(CODE_FONT, BOLD, 10)); Phrase constantValuePhrase = new Phrase(""); constantValuePhrase.add(valueTextChunk); constantValuePhrase.add(valueContentChunk); commentsTable.addCell(constantValuePhrase); } PdfPTable anotherinnertable = new PdfPTable(1); anotherinnertable.setWidthPercentage(100f); anotherinnertable.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPTable innerTable = addDeclaration(modifier, null); // Link to field LinkPhrase linkPhrase = new LinkPhrase(destination, name, Fonts.getFont(CODE_FONT, 9)); // right part of the table PdfPCell cell = PDFUtility.createElementCell(2, linkPhrase); cell.setPaddingTop((float) 2.0); cell.setPaddingLeft((float) 7.0); anotherinnertable.addCell(cell); anotherinnertable.addCell(commentsTable); innerTable.addCell(anotherinnertable); mainTable.addCell(innerTable); }
From source file:org.areasy.common.doclet.document.Summary.java
License:Open Source License
/** * Prints constructor summaries./*from ww w . ja v a2 s .com*/ * @param isDeprecated * @param deprecatedPhrase * @param mainTable * @throws Exception */ private static void printConstructor(ConstructorDoc constructorDoc, boolean isDeprecated, Phrase deprecatedPhrase, PdfPTable mainTable) throws Exception { String name = constructorDoc.name(); String modifier = constructorDoc.modifiers(); String commentText = DocletUtility.getFirstSentence(constructorDoc); String destination = constructorDoc.qualifiedName() + constructorDoc.signature(); Parameter[] parms = constructorDoc.parameters(); Element[] objs = HtmlParserWrapper.createPdfObjects(commentText); PdfPTable commentsTable = createColumnsAndDeprecated(objs, isDeprecated, deprecatedPhrase); PdfPTable anotherinnertable = new PdfPTable(1); anotherinnertable.setWidthPercentage(100f); anotherinnertable.getDefaultCell().setBorder(Rectangle.NO_BORDER); // Link to constructor Font constructorFont = Fonts.getFont(CODE_FONT, 9); Phrase phrase = new Phrase("", constructorFont); phrase.add(new LinkPhrase(destination, name, constructorFont)); phrase.add("("); if ((parms != null) && (parms.length > 0)) { for (int i = 0; i < parms.length; i++) { phrase.add(PDFUtility.getParameterTypePhrase(parms[i], 9)); phrase.add(" "); phrase.add(parms[i].name()); if (i != (parms.length - 1)) { phrase.add(", "); } } } phrase.add(")"); PdfPCell cell = PDFUtility.createElementCell(2, phrase); cell.setPaddingLeft((float) 7.0); anotherinnertable.addCell(cell); anotherinnertable.addCell(commentsTable); PdfPTable innerTable = addDeclaration(modifier, null); innerTable.addCell(anotherinnertable); mainTable.addCell(innerTable); }