List of usage examples for com.lowagie.text Element ALIGN_JUSTIFIED
int ALIGN_JUSTIFIED
To view the source code for com.lowagie.text Element ALIGN_JUSTIFIED.
Click Source Link
From source file:jdbreport.model.io.pdf.itext2.ITextWriter.java
License:Apache License
protected int toPdfHAlignment(int horizontalAlignment) { switch (horizontalAlignment) { case CellStyle.LEFT: return Element.ALIGN_LEFT; case CellStyle.RIGHT: return Element.ALIGN_RIGHT; case CellStyle.CENTER: return Element.ALIGN_CENTER; case CellStyle.JUSTIFY: return Element.ALIGN_JUSTIFIED; }// ww w.ja v a 2 s.com return Element.ALIGN_LEFT; }
From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java
License:LGPL
/** * */// w ww . j a va2 s.co m protected void exportText(JRPrintText text) throws DocumentException { JRStyledText styledText = getStyledText(text, false); if (styledText == null) { return; } int textLength = styledText.length(); int x = text.getX() + getOffsetX(); int y = text.getY() + getOffsetY(); int width = text.getWidth(); int height = text.getHeight(); int topPadding = text.getLineBox().getTopPadding().intValue(); int leftPadding = text.getLineBox().getLeftPadding().intValue(); int bottomPadding = text.getLineBox().getBottomPadding().intValue(); int rightPadding = text.getLineBox().getRightPadding().intValue(); int xFillCorrection = 0; int yFillCorrection = 0; double angle = 0; switch (text.getRotation()) { case JRTextElement.ROTATION_LEFT: { y = text.getY() + getOffsetY() + text.getHeight(); xFillCorrection = 1; width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = leftPadding; leftPadding = bottomPadding; bottomPadding = rightPadding; rightPadding = tmpPadding; angle = Math.PI / 2; break; } case JRTextElement.ROTATION_RIGHT: { x = text.getX() + getOffsetX() + text.getWidth(); yFillCorrection = -1; width = text.getHeight(); height = text.getWidth(); int tmpPadding = topPadding; topPadding = rightPadding; rightPadding = bottomPadding; bottomPadding = leftPadding; leftPadding = tmpPadding; angle = -Math.PI / 2; break; } case JRTextElement.ROTATION_UPSIDE_DOWN: { x = text.getX() + getOffsetX() + text.getWidth(); y = text.getY() + getOffsetY() + text.getHeight(); int tmpPadding = topPadding; topPadding = bottomPadding; bottomPadding = tmpPadding; tmpPadding = leftPadding; leftPadding = rightPadding; rightPadding = tmpPadding; angle = Math.PI; break; } case JRTextElement.ROTATION_NONE: default: { } } AffineTransform atrans = new AffineTransform(); atrans.rotate(angle, x, jasperPrint.getPageHeight() - y); pdfContentByte.transform(atrans); if (text.getMode() == JRElement.MODE_OPAQUE) { Color backcolor = text.getBackcolor(); pdfContentByte.setRGBColorFill(backcolor.getRed(), backcolor.getGreen(), backcolor.getBlue()); pdfContentByte.rectangle(x + xFillCorrection, jasperPrint.getPageHeight() - y + yFillCorrection, width, -height); pdfContentByte.fill(); } if (textLength > 0) { int horizontalAlignment = Element.ALIGN_LEFT; switch (text.getHorizontalAlignment()) { case JRAlignment.HORIZONTAL_ALIGN_LEFT: { if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR) { horizontalAlignment = Element.ALIGN_LEFT; } else { horizontalAlignment = Element.ALIGN_RIGHT; } break; } case JRAlignment.HORIZONTAL_ALIGN_CENTER: { horizontalAlignment = Element.ALIGN_CENTER; break; } case JRAlignment.HORIZONTAL_ALIGN_RIGHT: { if (text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR) { horizontalAlignment = Element.ALIGN_RIGHT; } else { horizontalAlignment = Element.ALIGN_LEFT; } break; } case JRAlignment.HORIZONTAL_ALIGN_JUSTIFIED: { horizontalAlignment = Element.ALIGN_JUSTIFIED; break; } default: { horizontalAlignment = Element.ALIGN_LEFT; } } float verticalOffset = 0f; switch (text.getVerticalAlignment()) { case JRAlignment.VERTICAL_ALIGN_TOP: { verticalOffset = 0f; break; } case JRAlignment.VERTICAL_ALIGN_MIDDLE: { verticalOffset = (height - topPadding - bottomPadding - text.getTextHeight()) / 2f; break; } case JRAlignment.VERTICAL_ALIGN_BOTTOM: { verticalOffset = height - topPadding - bottomPadding - text.getTextHeight(); break; } default: { verticalOffset = 0f; } } ColumnText colText = new ColumnText(pdfContentByte); colText.setSimpleColumn(getPhrase(styledText, text), x + leftPadding, jasperPrint.getPageHeight() - y - topPadding - verticalOffset - text.getLeadingOffset(), //+ text.getLineSpacingFactor() * text.getFont().getSize(), x + width - rightPadding, jasperPrint.getPageHeight() - y - height + bottomPadding, 0, //text.getLineSpacingFactor(),// * text.getFont().getSize(), horizontalAlignment); colText.setLeading(0, text.getLineSpacingFactor());// * text.getFont().getSize()); colText.setRunDirection( text.getRunDirection() == JRPrintText.RUN_DIRECTION_LTR ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_RTL); colText.go(); } atrans = new AffineTransform(); atrans.rotate(-angle, x, jasperPrint.getPageHeight() - y); pdfContentByte.transform(atrans); /* */ exportBox(text.getLineBox(), text); }
From source file:net.sf.jasperreports.engine.export.SimplePdfTextRenderer.java
License:Open Source License
/** * /*from w w w . java 2 s. c o m*/ */ public void render() { ColumnText colText = new ColumnText(pdfContentByte); colText.setSimpleColumn(getPhrase(styledText, text), x + leftPadding, pdfExporter.getCurrentJasperPrint().getPageHeight() - y - topPadding - verticalAlignOffset - text.getLeadingOffset(), //+ text.getLineSpacingFactor() * text.getFont().getSize(), x + width - rightPadding, pdfExporter.getCurrentJasperPrint().getPageHeight() - y - height + bottomPadding, 0, //text.getLineSpacingFactor(),// * text.getFont().getSize(), horizontalAlignment == Element.ALIGN_JUSTIFIED_ALL ? Element.ALIGN_JUSTIFIED : horizontalAlignment); colText.setLeading(0, text.getLineSpacingFactor());// * text.getFont().getSize()); colText.setRunDirection(text.getRunDirectionValue() == RunDirectionEnum.LTR ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_RTL); try { colText.go(); } catch (DocumentException e) { throw new JRRuntimeException(e); } }
From source file:nl.dykema.jxmlnote.report.pdf.PdfParagraph.java
License:Open Source License
protected int getAlign(XMLNoteParStyle st) { String align = st.align();/*from w w w. j a v a2 s. c o m*/ if (align.equals(XMLNoteParStyle.ALIGN_LEFT)) { return Element.ALIGN_LEFT; } else if (align.equals(XMLNoteParStyle.ALIGN_RIGHT)) { return Element.ALIGN_RIGHT; } else if (align.equals(XMLNoteParStyle.ALIGN_CENTER)) { return Element.ALIGN_CENTER; } else if (align.equals(XMLNoteParStyle.ALIGN_CENTER)) { return Element.ALIGN_JUSTIFIED; } else { return Element.ALIGN_LEFT; } }
From source file:nl.dykema.jxmlnote.report.pdf.PdfParagraph.java
License:Open Source License
public Paragraph setAlignment(Report.Align a) { int align = Element.ALIGN_LEFT; if (a.equals(Report.Align.RIGHT)) { align = Element.ALIGN_RIGHT; } else if (a.equals(Report.Align.CENTER)) { align = Element.ALIGN_CENTER; } else if (a.equals(Report.Align.JUSTIFY)) { align = Element.ALIGN_JUSTIFIED; }/*from w ww . jav a 2 s . c om*/ super.setAlignment(align); return this; }
From source file:nl.dykema.jxmlnote.report.pdf.PdfReport.java
License:Open Source License
public int getPdfAlign(Report.Align a) { if (a.equals(Align.LEFT)) { return Element.ALIGN_LEFT; } else if (a.equals(Align.RIGHT)) { return Element.ALIGN_RIGHT; } else if (a.equals(Align.CENTER)) { return Element.ALIGN_CENTER; } else if (a.equals(Align.JUSTIFY)) { return Element.ALIGN_JUSTIFIED; } else {//from w w w.j ava2s. co m return Element.ALIGN_LEFT; } }
From source file:nl.dykema.jxmlnote.report.pdf.PdfReport.java
License:Open Source License
public int getAlign(AttributeSet s) { if (StyleConstants.getAlignment(s) == StyleConstants.ALIGN_LEFT) { return Element.ALIGN_LEFT; } else if (StyleConstants.getAlignment(s) == StyleConstants.ALIGN_CENTER) { return Element.ALIGN_CENTER; } else if (StyleConstants.getAlignment(s) == StyleConstants.ALIGN_RIGHT) { return Element.ALIGN_RIGHT; } else if (StyleConstants.getAlignment(s) == StyleConstants.ALIGN_JUSTIFIED) { return Element.ALIGN_JUSTIFIED; } else {//from ww w.j av a 2s . c o m return Element.ALIGN_LEFT; } }
From source file:org.apache.poi.xwpf.converter.internal.itext.stylable.StylableParagraph.java
License:Open Source License
public void applyStyles(XWPFParagraph p, Style style) { if (style != null) { // first process values from "style" // will be overridden by in-line values if available... StyleParagraphProperties paragraphProperties = style.getParagraphProperties(); if (paragraphProperties != null) { FontInfos fontInfos = paragraphProperties.getFontInfos(); if (fontInfos != null) { Font font = XWPFFontRegistry.getRegistry().getFont(fontInfos.getFontFamily(), fontInfos.getFontEncoding(), fontInfos.getFontSize(), fontInfos.getFontStyle(), fontInfos.getFontColor()); setFont(font);//from ww w. j av a 2 s .co m } // Alignment int alignment = paragraphProperties.getAlignment(); if (alignment != Element.ALIGN_UNDEFINED) { setAlignment(alignment); } Float lineHeight = paragraphProperties.getLineHeight(); if (lineHeight != null) { // super.getPdfPCell().setMinimumHeight(lineHeight); // FIXME : Is it correct??? setLeading(lineHeight * super.getTotalLeading()); } // System.err.println("IndentationRight "+paragraphProperties.getIndentationRight()); setIndentationRight(paragraphProperties.getIndentationRight()); setIndentationLeft(paragraphProperties.getIndentationLeft()); setFirstLineIndent(paragraphProperties.getIndentationFirstLine()); // StyleBorder borderBottom= paragraphProperties.getBorderBottom(); } } ParagraphAlignment paragraphAlignment = p.getAlignment(); // text-align if (paragraphAlignment != null) { int alignment = Element.ALIGN_UNDEFINED; switch (paragraphAlignment) { case LEFT: alignment = Element.ALIGN_LEFT; break; case RIGHT: alignment = Element.ALIGN_RIGHT; break; case CENTER: alignment = Element.ALIGN_CENTER; break; case BOTH: alignment = Element.ALIGN_JUSTIFIED; break; default: break; } setAlignment(alignment); } int indentationLeft = p.getIndentationLeft(); if (indentationLeft > 0) { setIndentationLeft(indentationLeft); } // text-indent int indentationFirstLine = p.getIndentationFirstLine(); if (indentationFirstLine > 0) { setFirstLineIndent(indentationFirstLine); } int indentationRight = p.getIndentationRight(); if (indentationRight > 0) { setIndentationRight(indentationRight); } // verticalAlignment DOES not exists in StyleParagraphProperties iText // TextAlignment textAlignment = p.getVerticalAlignment(); int left = p.getIndentationLeft(); int right = p.getIndentationRight(); if (right > 0) { setIndentationRight(dxa2points(right)); } if (left > 0) { setIndentationLeft(dxa2points(left)); } int firstLineIndent = p.getIndentationFirstLine(); if (firstLineIndent > 0) { setFirstLineIndent(dxa2points(firstLineIndent)); } int spacingBefore = p.getSpacingBefore(); if (spacingBefore > 0) { setSpacingBefore(dxa2points(spacingBefore)); } if (p.getSpacingAfter() >= 0) { setSpacingAfter(dxa2points(p.getSpacingAfter())); } else { // XXX Seems to be a default : setSpacingAfter(10f); } if (p.getCTP().getPPr() != null) { if (p.getCTP().getPPr().getSpacing() != null) { if (p.getCTP().getPPr().getSpacing().getLine() != null) { // XXX PLQ : why 240 ??? float leading = (p.getCTP().getPPr().getSpacing().getLine().floatValue() / 240); setMultipliedLeading(leading); } } } ParagraphAlignment alignment = p.getAlignment(); switch (alignment) { case LEFT: setAlignment(Element.ALIGN_LEFT); break; case RIGHT: setAlignment(Element.ALIGN_RIGHT); break; case CENTER: setAlignment(Element.ALIGN_CENTER); break; case BOTH: setAlignment(Element.ALIGN_JUSTIFIED); break; default: break; } }
From source file:org.areasy.common.doclet.document.tags.HtmlTagUtility.java
License:Open Source License
/** * Returns the Element constant associated with the specified horizontal * alignment (left, right, center, justified). *///from w w w .ja va 2 s . com public static int getAlignment(String htmlAlignString, int defaultAlign) { if (htmlAlignString == null) return defaultAlign; if ("center".equalsIgnoreCase(htmlAlignString)) return Element.ALIGN_CENTER; if ("right".equalsIgnoreCase(htmlAlignString)) return Element.ALIGN_RIGHT; if ("left".equalsIgnoreCase(htmlAlignString)) return Element.ALIGN_LEFT; if ("justify".equalsIgnoreCase(htmlAlignString)) return Element.ALIGN_JUSTIFIED; return defaultAlign; }
From source file:org.cgiar.ccafs.ap.summaries.projects.pdf.CaseStudieSummaryPDF.java
License:Open Source License
/** * This method is used for add Outcomes in the project summary *//*from w w w .ja v a 2s . c o m*/ private void addProjectOutcomes(String number) { try { Paragraph outcomesBlock = new Paragraph(); outcomesBlock.setAlignment(Element.ALIGN_JUSTIFIED); Paragraph title = new Paragraph(number + ". " + this.getText("summaries.project.outcome"), HEADING2_FONT); outcomesBlock.add(title); outcomesBlock.add(Chunk.NEWLINE); ; title = new Paragraph(); title.setFont(HEADING3_FONT); title.add(number + ".1 " + this.getText("summaries.project.outcomeNarrative")); outcomesBlock.add(title); outcomesBlock.add(Chunk.NEWLINE); ; // Project outcome statement Paragraph body = new Paragraph(); body.setFont(BODY_TEXT_BOLD_FONT); body.add(this.getText("summaries.project.outcomeStatement")); // body.setFont(BODY_TEXT_FONT); if (project.getOutcomes() == null || project.getOutcomes().get(String.valueOf(midOutcomeYear)) == null || project.getOutcomes().get(String.valueOf(midOutcomeYear)).getStatement() == null || project.getOutcomes().get(String.valueOf(midOutcomeYear)).getStatement().equals("")) { body.add(": "); body.setFont(BODY_TEXT_FONT); body.add(this.getText("summaries.project.empty")); } else { body.setFont(BODY_TEXT_FONT); body.add(Chunk.NEWLINE); body.add(this .messageReturn(project.getOutcomes().get(String.valueOf(midOutcomeYear)).getStatement())); } body.add(Chunk.NEWLINE); ; outcomesBlock.add(body); try { document.newPage(); // document.add(outcomesBlock); } catch (Exception e) { LOG.error("There was an error trying to add the project focuses to the project summary pdf", e); } Anchor anchor; ////////////////// Reporting PdfPTable table; // ********************************************************************************** // *************************** Outcome Case Studies ************************************* // ********************************************************************************** if (project.isReporting()) { document.newPage(); Paragraph cell; if (project.getCaseStudies().isEmpty()) { document.add( new Paragraph(this.getText("summaries.project.reporting.outcome.not.case.studies"))); } else { title = new Paragraph(); title.add(Chunk.NEWLINE); // document.add(title); } List<Project> lst = projectManager.getAllProjectsBasicInfo(APConstants.REPORTING_SECTION); Collections.sort(lst, new Comparator<Project>() { @Override public int compare(Project s1, Project s2) { Integer p1 = s1.getId(); Integer p2 = s2.getId(); return p1.compareTo(p2); } }); for (Project project : lst) { project = projectManager.getProject(project.getId()); if (project.isWorkplanRequired()) { String workPlanURL = this.getWorkplanURL(); if (workPlanURL != null || project.getWorkplanName() != null) { project.setWorkplanURL(workPlanURL + project.getWorkplanName()); } } // Get a route for the bilateral contract if (project.isBilateralProject()) { String bilateralContractURL = this.getBilateralContractURL(); if (bilateralContractURL != null || project.getBilateralContractProposalName() != null) { project.setWorkplanURL( bilateralContractURL + project.getBilateralContractProposalName()); } } // Getting the information of the Regions program project.setRegions( ipProgramManager.getProjectFocuses(project.getId(), APConstants.REGION_PROGRAM_TYPE)); // Getting the information of the Flagships program project.setFlagships( ipProgramManager.getProjectFocuses(project.getId(), APConstants.FLAGSHIP_PROGRAM_TYPE)); List<ProjectPartner> projectPartnerList = this.partnerManager.getProjectPartners(project, 0); for (ProjectPartner projectPartner : projectPartnerList) { projectPartner .setPartnerPersons(this.partnerPersonManager.getPartnerPersons(projectPartner)); projectPartner.setPartnerContributors( partnerManager.getProjectPartnerContributors(projectPartner)); } project.setProjectPartners(projectPartnerList); this.project = project; List<CasesStudies> caseStudiesList = caseStudiesManager.getCaseStudysByProject(project.getId()); List<IPIndicator> ipIndicatorList; IPIndicator ipIndicator; if (caseStudiesList != null) { if (!caseStudiesList.isEmpty()) { try { this.addProjectTitle(); this.addMainInformationTable(); } catch (Exception e) { System.out.println(project.getId()); e.printStackTrace(); } } for (CasesStudies caseStudie : caseStudiesList) { ipIndicatorList = new ArrayList<IPIndicator>(); for (CaseStudieIndicators indicatorCaseStudie : caseStudie .getCaseStudieIndicatorses()) { ipIndicator = indicatorManager .getIndicatorFlgship(indicatorCaseStudie.getIdIndicator()); ipIndicatorList.add(ipIndicator); } caseStudie.setCaseStudyIndicators(ipIndicatorList); } project.setCaseStudies(caseStudiesList); int counter = 0; for (CasesStudies caseStudy : project.getCaseStudies()) { counter++; table = new PdfPTable(1); table.setLockedWidth(true); table.setTotalWidth(500); // case study cell = new Paragraph( this.getText("summaries.project.reporting.outcome.case.study") + " #" + counter, TABLE_HEADER_FONT); this.addTableHeaderCell(table, cell); // this.addCustomTableCell(table, cell, Element.ALIGN_LEFT, BODY_TEXT_FONT, Color.WHITE, // table.getNumberOfColumns(), 0, false); // Title cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.title"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getTitle()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Outcome statement cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.outcomestatement"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getOutcomeStatement()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Research outputs cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.researchoutputs"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getResearchOutputs()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Research partners cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.researchPartners"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getResearchPartners()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // activities Contributed cell = new Paragraph( this.getText( "summaries.project.reporting.outcome.casestudy.activitiesContributed"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getActivities()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Non Research Partners cell = new Paragraph( this.getText( "summaries.project.reporting.outcome.casestudy.nonResearchPartners"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getNonResearchPartneres()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Output Users cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.outputUsers"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getOutputUsers()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Output Used cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.outputWasUsed"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getOutputUsed()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Evidence cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.evidenceOutcome"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getEvidenceOutcome()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // References cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.references"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getReferencesCase()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Outcome indicators cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.primaryOutcome", new String[] { String.valueOf(this.midOutcomeYear) }), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add("\n"); for (IPIndicator _ipIndicator : caseStudy.getCaseStudyIndicators()) { if (_ipIndicator.getOutcome() != null) { cell.add(_ipIndicator.getOutcome().getDescription()); } cell.add(" " + _ipIndicator.getDescription() + "\n"); } this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // Explain link cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.explainLink"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(caseStudy.getExplainIndicatorRelation()); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // year cell = new Paragraph(this.getText("summaries.project.reporting.outcome.casestudy.year"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); cell.add(String.valueOf(caseStudy.getYear())); this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); // upload cell = new Paragraph( this.getText("summaries.project.reporting.outcome.casestudy.upload"), TABLE_BODY_BOLD_FONT); cell.setFont(TABLE_BODY_FONT); if (caseStudy.getFile() == null || caseStudy.getFile().equals("")) { cell.add(this.messageReturn(null)); } else { anchor = new Anchor(caseStudy.getFile(), TABLE_BODY_FONT_LINK); anchor.setReference(config.getDownloadURL() + "/projects/" + project.getId() + "/caseStudy/" + caseStudy.getFile()); cell.add(anchor); } this.addTableBodyCell(table, cell, Element.ALIGN_LEFT, 1); document.add(table); document.add(new Paragraph(Chunk.NEWLINE)); } } document.newPage(); } } } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } }