List of usage examples for com.lowagie.text FontFactory getFont
public static Font getFont(String fontname, float size, int style)
Font
-object. From source file:org.cgiar.ccafs.ap.summaries.projects.pdf.CaseStudieSummaryPDF.java
License:Open Source License
/** * This method is used for add the main information table of project summary */// w w w . j a v a2 s .c o m private void addMainInformationTable() { String startDate, endDate; if (project.getStartDate() != null) { startDate = new SimpleDateFormat("dd-MM-yyyy").format(project.getStartDate()); } else { startDate = this.messageReturn(null); } if (project.getEndDate() != null) { endDate = new SimpleDateFormat("dd-MM-yyyy").format(project.getEndDate()); } else { endDate = this.messageReturn(null); } Paragraph cellContent; // Add content try { PdfPTable table = new PdfPTable(4); // Set table widths table.setLockedWidth(true); table.setTotalWidth(480); table.setWidths(new int[] { 3, 5, 3, 5 }); // First row cellContent = new Paragraph(this.getText("summaries.project.startDate") + "\n" + " (dd-MM-yyyy)", TABLE_BODY_BOLD_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 0); cellContent = new Paragraph(this.messageReturn(startDate), TABLE_BODY_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 0); cellContent = new Paragraph(this.getText("summaries.project.endDate") + "\n" + " (dd-MM-yyyy)", TABLE_BODY_BOLD_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 0); cellContent = new Paragraph(this.messageReturn(endDate), TABLE_BODY_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 0); // Second row cellContent = new Paragraph(this.getText("summaries.project.managementLiaison"), TABLE_BODY_BOLD_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 1); cellContent = new Paragraph(this.messageReturn(project.getLiaisonInstitution().getAcronym() + " - " + project.getLiaisonInstitution().getName()), TABLE_BODY_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 1); cellContent = new Paragraph(this.getText("summaries.project.contactPerson"), TABLE_BODY_BOLD_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 1); cellContent = new Paragraph(this.messageReturn(project.getOwner().getComposedName()), TABLE_BODY_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 1); // Third row cellContent = new Paragraph(this.getText("summaries.project.leadOrganization"), TABLE_BODY_BOLD_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 0); if (project.getLeader() == null || project.getLeader().getInstitution() == null) { cellContent = new Paragraph(this.getText("summaries.project.empty"), TABLE_BODY_FONT); } else { cellContent = new Paragraph( this.messageReturn( this.messageReturn(project.getLeader().getInstitution().getComposedName())), TABLE_BODY_FONT); } this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 0); cellContent = new Paragraph(this.getText("summaries.project.projectLeader"), TABLE_BODY_BOLD_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 0); if (project.getLeaderPerson() == null || project.getLeaderPerson().getUser() == null) { cellContent = new Paragraph(this.getText("summaries.project.empty"), TABLE_BODY_FONT); } else { cellContent = new Paragraph( this.messageReturn(project.getLeaderPerson().getUser().getComposedName()), TABLE_BODY_FONT); } this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 0); // Fourth row cellContent = (new Paragraph(this.getText("summaries.project.projectType"), TABLE_BODY_BOLD_FONT)); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 1); cellContent = new Paragraph(this.messageReturn(project.getType().replaceAll("_", " ")), TABLE_BODY_FONT); this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 1); // Fiveth row Chunk imdb = null; Font hyperLink = new Font(FontFactory.getFont("openSans", 10, Color.BLUE)); hyperLink.setStyle(Font.UNDERLINE); // -- Not Bilateral if (!project.isBilateralProject()) { cellContent = (new Paragraph(this.getText("summaries.project.detailed"), TABLE_BODY_BOLD_FONT)); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 1); if (project.getWorkplanName() != null && !project.getWorkplanName().equals("")) { imdb = new Chunk(project.getWorkplanName(), hyperLink); try { imdb.setAction(new PdfAction(new URL(this.messageReturn(project.getWorkplanURL())))); } catch (MalformedURLException exp) { imdb = new Chunk(project.getWorkplanName(), TABLE_BODY_FONT); LOG.error("There is an Malformed exception in " + project.getWorkplanName()); } } else { imdb = new Chunk(this.getText("summaries.project.empty"), TABLE_BODY_FONT); } } // -- Bilateral else { cellContent = (new Paragraph(this.getText("summaries.project.ipContributions.proposal.space"), TABLE_BODY_BOLD_FONT)); this.addTableBodyCell(table, cellContent, Element.ALIGN_RIGHT, 1); if (project.getBilateralContractProposalName() != null && !project.getBilateralContractProposalName().equals("")) { imdb = new Chunk(project.getBilateralContractProposalName(), hyperLink); try { imdb.setAction(new PdfAction(new URL(this.messageReturn(project.getWorkplanURL())))); } catch (MalformedURLException exp) { imdb = new Chunk(project.getBilateralContractProposalName(), TABLE_BODY_FONT); LOG.error("There is an Malformed exception in bilateral contract: " + project.getBilateralContractProposalName()); } } else { imdb = new Chunk(this.getText("summaries.project.empty"), TABLE_BODY_FONT); } } cellContent = new Paragraph(); cellContent.add(imdb); this.addTableBodyCell(table, cellContent, Element.ALIGN_LEFT, 1); document.add(table); document.add(Chunk.NEWLINE); } catch (DocumentException e) { LOG.error( "-- generatePdf() > There was an error adding the table with content for case study summary. ", e); } }
From source file:org.eclipse.examples.slideshow.runner.PDFGraphics.java
License:Open Source License
@Override public void drawText(String string, int x, int y) { float fontHeight = getState().fontHeight * 4 / 3; com.lowagie.text.Font font = FontFactory.getFont(getState().fontFamily, fontHeight, getState().fontStyle); BaseFont bf = font.getBaseFont();//from www . j a v a 2 s .co m contentByte.beginText(); contentByte.setColorFill(getState().foregroundColor); contentByte.setFontAndSize(bf, fontHeight); contentByte.setTextMatrix(x + getState().dx, document.getPageSize().getHeight() - (y + getState().dy)); contentByte.showText(string); contentByte.endText(); }
From source file:org.egomez.irpgeditor.swing.PanelSpoolFiles.java
License:Open Source License
@Override public void run() { synchronized (this) { try {/* w w w . j a va 2s.co m*/ localPrintStream = new PrintStream(target); switch (exportType) { case SPOOL_EXPORT_TEXT: break; case SPOOL_EXPORT_PDF: document = new Document(PageSize.A4); PdfWriter.getInstance(document, localPrintStream); document.open(); break; } PrintParameterList localPrintParameterList = new PrintParameterList(); localPrintParameterList.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPDEFAULT.WSCST"); localPrintParameterList.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST"); localPrintParameterList.setParameter(PrintObject.ATTR_CODEPAGE, 284); PrintObjectTransformedInputStream localPrintObjectTransformedInputStream = file .getTransformedInputStream(localPrintParameterList); byte[] buf = new byte[32767]; StringBuffer buffer = new StringBuffer(); int bytesRead = 0; do { bytesRead = localPrintObjectTransformedInputStream.read(buf); // System.out.println(bytesRead); if (bytesRead > 0) { buffer.append(new String(buf, 0, bytesRead, "cp437")); } } while (bytesRead != -1); String cadena = buffer.toString(); cadena = cadena.replace('\r', ' '); switch (exportType) { case SPOOL_EXPORT_TEXT: if (buffer.length() > 0) localPrintStream.println(cadena.toCharArray()); localPrintStream.flush(); localPrintStream.close(); break; case SPOOL_EXPORT_PDF: Paragraph p = new Paragraph(cadena, FontFactory.getFont(FontFactory.COURIER, 6, com.lowagie.text.Font.NORMAL)); // p.setFont(courierFont); if (buffer.length() > 0) { document.add(p); } document.close(); document = null; break; } JOptionPane.showMessageDialog(null, "File " + target.getAbsolutePath() + " was saved."); } catch (FileNotFoundException e) { // e.printStackTrace(); logger.error(e.getMessage()); } catch (IOException e) { logger.error(e.getMessage()); } catch (AS400Exception e) { logger.error(e.getMessage()); } catch (AS400SecurityException e) { logger.error(e.getMessage()); } catch (ErrorCompletingRequestException e) { // e.printStackTrace(); logger.error(e.getMessage()); } catch (InterruptedException e) { // e.printStackTrace(); logger.error(e.getMessage()); } catch (RequestNotSupportedException e) { // e.printStackTrace(); logger.error(e.getMessage()); } catch (DocumentException e) { // e.printStackTrace(); logger.error(e.getMessage()); } } }
From source file:org.jivesoftware.openfire.reporting.graph.GraphServlet.java
License:Open Source License
private void writePDFContent(HttpServletRequest request, HttpServletResponse response, JFreeChart charts[], Statistic[] stats, long starttime, long endtime, int width, int height) throws IOException { try {//from w ww . ja va 2 s.c o m Document document = new Document(PageSize.A4, 50, 50, 50, 50); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(document, baos); writer.setPageEvent(new PDFEventListener(request)); document.open(); int index = 0; int chapIndex = 0; for (Statistic stat : stats) { String serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain(); String dateName = JiveGlobals.formatDate(new Date(starttime)) + " - " + JiveGlobals.formatDate(new Date(endtime)); Paragraph paragraph = new Paragraph(serverName, FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD)); document.add(paragraph); paragraph = new Paragraph(dateName, FontFactory.getFont(FontFactory.HELVETICA, 14, Font.PLAIN)); document.add(paragraph); document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); Paragraph chapterTitle = new Paragraph(++chapIndex + ". " + stat.getName(), FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD)); document.add(chapterTitle); // total hack: no idea what tags people are going to use in the description // possibly recommend that we only use a <p> tag? String[] paragraphs = stat.getDescription().split("<p>"); for (String s : paragraphs) { Paragraph p = new Paragraph(s); document.add(p); } document.add(Chunk.NEWLINE); PdfContentByte contentByte = writer.getDirectContent(); PdfTemplate template = contentByte.createTemplate(width, height); Graphics2D graphs2D = template.createGraphics(width, height, new DefaultFontMapper()); Rectangle2D rectangle2D = new Rectangle2D.Double(0, 0, width, height); charts[index++].draw(graphs2D, rectangle2D); graphs2D.dispose(); float x = (document.getPageSize().width() / 2) - (width / 2); contentByte.addTemplate(template, x, writer.getVerticalPosition(true) - height); document.newPage(); } document.close(); // setting some response headers response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); response.setHeader("Pragma", "public"); // setting the content type response.setContentType("application/pdf"); // the contentlength is needed for MSIE!!! response.setContentLength(baos.size()); // write ByteArrayOutputStream to the ServletOutputStream ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } catch (DocumentException e) { Log.error("error creating PDF document: " + e.getMessage()); } }
From source file:org.jsondoc.springmvc.pdf.PdfExportView.java
License:Open Source License
public File getPdfFile(String filename) { try {/* ww w . jav a2 s .c om*/ File file = new File(filename + "-v" + jsonDoc.getVersion() + FILE_EXTENSION); FileOutputStream fileout = new FileOutputStream(file); Document document = new Document(); PdfWriter.getInstance(document, fileout); // Header HeaderFooter header = new HeaderFooter(new Phrase("Copyright " + Calendar.getInstance().get(Calendar.YEAR) + " Paybay Networks - All rights reserved"), false); header.setBorder(Rectangle.NO_BORDER); header.setAlignment(Element.ALIGN_LEFT); document.setHeader(header); // Footer HeaderFooter footer = new HeaderFooter(new Phrase("Page "), true); footer.setBorder(Rectangle.NO_BORDER); footer.setAlignment(Element.ALIGN_CENTER); document.setFooter(footer); document.open(); //init documentation apiDocs = buildApiDocList(); apiMethodDocs = buildApiMethodDocList(apiDocs); Phrase baseUrl = new Phrase("Base url: " + jsonDoc.getBasePath()); document.add(baseUrl); document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); int pos = 1; for (ApiMethodDoc apiMethodDoc : apiMethodDocs) { Phrase phrase = new Phrase(/*"Description: " + */apiMethodDoc.getDescription()); document.add(phrase); document.add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(2); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.setWidthPercentage(100); table.setWidths(new int[] { 50, 200 }); // HEADER CELL START TABLE table.addCell(ITextUtils.getHeaderCell("URL")); table.addCell(ITextUtils.getHeaderCell("<baseUrl> " + apiMethodDoc.getPath())); table.completeRow(); // FIRST CELL table.addCell(ITextUtils.getCell("Http Method", 0)); table.addCell(ITextUtils.getCell(apiMethodDoc.getVerb().name(), pos)); pos++; table.completeRow(); // PRODUCES if (!apiMethodDoc.getProduces().isEmpty()) { table.addCell(ITextUtils.getCell("Produces", 0)); table.addCell(ITextUtils.getCell(buildApiMethodProduces(apiMethodDoc), pos)); pos++; table.completeRow(); } // CONSUMES if (!apiMethodDoc.getConsumes().isEmpty()) { table.addCell(ITextUtils.getCell("Consumes", 0)); table.addCell(ITextUtils.getCell(buildApiMethodConsumes(apiMethodDoc), pos)); pos++; table.completeRow(); } // HEADERS if (!apiMethodDoc.getHeaders().isEmpty()) { table.addCell(ITextUtils.getCell("Request headers", 0)); PdfPTable pathParamsTable = new PdfPTable(3); pathParamsTable.setWidths(new int[] { 30, 20, 40 }); pathParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); pathParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiHeaderDoc apiHeaderDoc : apiMethodDoc.getHeaders()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiHeaderDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); StringBuilder builder = new StringBuilder(); for (String value : apiHeaderDoc.getAllowedvalues()) builder.append(value).append(", "); paramCell.setPhrase(new Phrase("Allowed values: " + builder.toString())); paramCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase(apiHeaderDoc.getDescription())); pathParamsTable.addCell(paramCell); pathParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(pathParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // PATH PARAMS if (!apiMethodDoc.getPathparameters().isEmpty()) { table.addCell(ITextUtils.getCell("Path params", 0)); PdfPTable pathParamsTable = new PdfPTable(3); pathParamsTable.setWidths(new int[] { 30, 15, 40 }); pathParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); pathParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiParamDoc apiParamDoc : apiMethodDoc.getPathparameters()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiParamDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); paramCell.setPhrase(new Phrase(apiParamDoc.getJsondocType().getOneLineText())); paramCell.setBorder(Rectangle.NO_BORDER); pathParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase(apiParamDoc.getDescription())); pathParamsTable.addCell(paramCell); pathParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(pathParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // QUERY PARAMS if (!apiMethodDoc.getQueryparameters().isEmpty()) { table.addCell(ITextUtils.getCell("Query params", 0)); PdfPTable queryParamsTable = new PdfPTable(3); queryParamsTable.setWidths(new int[] { 30, 15, 40 }); queryParamsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); queryParamsTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); for (ApiParamDoc apiParamDoc : apiMethodDoc.getQueryparameters()) { PdfPCell boldCell = new PdfPCell(); Font fontbold = FontFactory.getFont("Times-Roman", 12, Font.BOLD); boldCell.setPhrase(new Phrase(apiParamDoc.getName(), fontbold)); boldCell.getPhrase().setFont(new Font(Font.BOLD)); boldCell.setBorder(Rectangle.NO_BORDER); queryParamsTable.addCell(boldCell); PdfPCell paramCell = new PdfPCell(); paramCell.setPhrase(new Phrase(apiParamDoc.getJsondocType().getOneLineText())); paramCell.setBorder(Rectangle.NO_BORDER); queryParamsTable.addCell(paramCell); paramCell.setPhrase(new Phrase( apiParamDoc.getDescription() + ", mandatory: " + apiParamDoc.getRequired())); queryParamsTable.addCell(paramCell); queryParamsTable.completeRow(); } PdfPCell bluBorderCell = new PdfPCell(queryParamsTable); bluBorderCell.setBorder(Rectangle.NO_BORDER); bluBorderCell.setBorderWidthRight(1f); bluBorderCell.setBorderColorRight(Colors.CELL_BORDER_COLOR); table.addCell(ITextUtils.setOddEvenStyle(bluBorderCell, pos)); pos++; table.completeRow(); } // BODY OBJECT if (null != apiMethodDoc.getBodyobject()) { table.addCell(ITextUtils.getCell("Body object:", 0)); String jsonObject = buildJsonFromTemplate(apiMethodDoc.getBodyobject().getJsondocTemplate()); table.addCell(ITextUtils.getCell(jsonObject, pos)); pos++; table.completeRow(); } // RESPONSE OBJECT table.addCell(ITextUtils.getCell("Json response:", 0)); table.addCell( ITextUtils.getCell(apiMethodDoc.getResponse().getJsondocType().getOneLineText(), pos)); pos++; table.completeRow(); // RESPONSE STATUS CODE table.addCell(ITextUtils.getCell("Status code:", 0)); table.addCell(ITextUtils.getCell(apiMethodDoc.getResponsestatuscode(), pos)); pos++; table.completeRow(); table.setSpacingAfter(10f); table.setSpacingBefore(5f); document.add(table); } document.close(); return file; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return null; }
From source file:org.kuali.kfs.gl.report.TransactionReport.java
License:Open Source License
/** * Generates transaction report//from w w w . j a va 2 s . c o m * * @param errorSortedList list of error'd transactions * @param reportErrors map containing transactions and the errors associated with each transaction * @param reportSummary list of summary objects * @param runDate date report is run * @param title title of report * @param fileprefix file prefix of report file * @param destinationDirectory destination of where report file will reside */ public void generateReport(List<Transaction> errorSortedList, Map<Transaction, List<Message>> reportErrors, List<Summary> reportSummary, Date runDate, String title, String fileprefix, String destinationDirectory) { LOG.debug("generateReport() started"); Font headerFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD); Font textFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL); Document document = new Document(PageSize.A4.rotate()); PageHelper helper = new PageHelper(); helper.runDate = runDate; helper.headerFont = headerFont; helper.title = title; try { DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class); String filename = destinationDirectory + "/" + fileprefix + "_"; filename = filename + dateTimeService.toDateTimeStringForFilename(runDate); filename = filename + ".pdf"; PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename)); writer.setPageEvent(helper); document.open(); appendReport(document, headerFont, textFont, errorSortedList, reportErrors, reportSummary, runDate); } catch (DocumentException de) { LOG.error("generateReport() Error creating PDF report", de); throw new RuntimeException("Report Generation Failed: " + de.getMessage()); } catch (FileNotFoundException fnfe) { LOG.error("generateReport() Error writing PDF report", fnfe); throw new RuntimeException("Report Generation Failed: Error writing to file " + fnfe.getMessage()); } finally { if ((document != null) && document.isOpen()) { document.close(); } } }
From source file:org.kuali.kfs.module.ar.batch.service.impl.CustomerInvoiceWriteoffBatchServiceImpl.java
License:Open Source License
protected void writeFileNameSectionTitle(com.lowagie.text.Document pdfDoc, String filenameLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 10, Font.BOLD); // file name title, get title only, on windows & unix platforms String fileNameOnly = filenameLine.toUpperCase(); int indexOfSlashes = fileNameOnly.lastIndexOf("\\"); if (indexOfSlashes < fileNameOnly.length()) { fileNameOnly = fileNameOnly.substring(indexOfSlashes + 1); }//from ww w. ja v a2 s . co m indexOfSlashes = fileNameOnly.lastIndexOf("/"); if (indexOfSlashes < fileNameOnly.length()) { fileNameOnly = fileNameOnly.substring(indexOfSlashes + 1); } Paragraph paragraph = new Paragraph(); paragraph.setAlignment(com.lowagie.text.Element.ALIGN_LEFT); Chunk chunk = new Chunk(fileNameOnly, font); chunk.setBackground(Color.LIGHT_GRAY, 5, 5, 5, 5); paragraph.add(chunk); // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
From source file:org.kuali.kfs.module.ar.batch.service.impl.CustomerInvoiceWriteoffBatchServiceImpl.java
License:Open Source License
protected void writeInvoiceSectionTitle(com.lowagie.text.Document pdfDoc, String customerNameLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD + Font.UNDERLINE); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(com.lowagie.text.Element.ALIGN_LEFT); paragraph.add(new Chunk(customerNameLine, font)); // blank line paragraph.add(new Chunk("", font)); try {//w ww . jav a 2 s . c om pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
From source file:org.kuali.kfs.module.ar.batch.service.impl.CustomerInvoiceWriteoffBatchServiceImpl.java
License:Open Source License
protected void writeInvoiceSectionMessage(com.lowagie.text.Document pdfDoc, String resultLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(com.lowagie.text.Element.ALIGN_LEFT); paragraph.add(new Chunk(resultLine, font)); // blank line paragraph.add(new Chunk("", font)); try {//from ww w . ja v a 2s .c om pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
From source file:org.kuali.kfs.module.ar.batch.service.impl.CustomerLoadServiceImpl.java
License:Open Source License
protected void writeFileNameSectionTitle(Document pdfDoc, String filenameLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 10, Font.BOLD); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); Chunk chunk = new Chunk(filenameLine, font); chunk.setBackground(Color.LIGHT_GRAY, 5, 5, 5, 5); paragraph.add(chunk);/*from w w w.j a v a 2 s.co m*/ // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }