List of usage examples for com.lowagie.text Font BOLD
int BOLD
To view the source code for com.lowagie.text Font BOLD.
Click Source Link
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);/*w w w . j av a 2 s. c om*/ // 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.CustomerLoadServiceImpl.java
License:Open Source License
protected void writeCustomerSectionTitle(Document pdfDoc, String customerNameLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD + Font.UNDERLINE); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); paragraph.add(new Chunk(customerNameLine, font)); // blank line paragraph.add(new Chunk("", font)); try {/*from ww w. ja v a2 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.CustomerLoadServiceImpl.java
License:Open Source License
protected void writeCustomerSectionResult(Document pdfDoc, String resultLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); paragraph.add(new Chunk(resultLine, font)); // blank line paragraph.add(new Chunk("", font)); try {// w ww. j av 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.LockboxServiceImpl.java
License:Open Source License
protected void writeBatchGroupSectionTitle(com.lowagie.text.Document pdfDoc, String batchSeqNbr, java.sql.Date procInvDt, String cashControlDocNumber) { Font font = FontFactory.getFont(FontFactory.COURIER, 10, Font.BOLD); String lineText = "CASHCTL " + rightPad(cashControlDocNumber, 12) + " " + "BATCH GROUP: " + rightPad(batchSeqNbr, 5) + " " + rightPad((procInvDt == null ? "NONE" : procInvDt.toString()), 35); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(com.lowagie.text.Element.ALIGN_LEFT); Chunk chunk = new Chunk(lineText, font); chunk.setBackground(Color.LIGHT_GRAY, 5, 5, 5, 5); paragraph.add(chunk);// w w w . jav a 2 s.c o 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); } }
From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java
License:Open Source License
/** * Creates instructions section of the coverpage * * @returns a {@link Paragraph} for the PDF *//*from w w w . j av a 2 s.co m*/ protected Paragraph getInstructionsParagraph() { final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD); final Font normalFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL); final Paragraph retval = new Paragraph(); retval.add(new Chunk("Instructions", headerFont)); retval.add(Chunk.NEWLINE); retval.add(new Phrase(getInstructions(), normalFont)); return retval; }
From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java
License:Open Source License
/** * Creates mailTo section for the coversheet. The MailTo section is where the coversheet will be mailed. * * @returns a {@link Paragraph} for the PDF *//* w w w .j a v a 2s . c o m*/ protected Paragraph getMailtoParagraph() { final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD); final Font normalFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL); final Paragraph retval = new Paragraph(); retval.add(new Chunk("Mail coversheet to:", headerFont)); retval.add(Chunk.NEWLINE); retval.add(new Phrase(getMailTo(), normalFont)); return retval; }
From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java
License:Open Source License
/** * Helper method to create a Header Cell from text * * @returns {@link Cell} with the header flag set */// w w w.jav a 2s .c o m protected Cell getHeaderCell(final String text) throws BadElementException { final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD); final Cell retval = new Cell(new Chunk(text, headerFont)); retval.setBorder(NO_BORDER); retval.setHeader(true); return retval; }
From source file:org.kuali.kfs.module.tem.pdf.Coversheet.java
License:Open Source License
/** * @see org.kuali.kfs.module.tem.pdf.PdfStream#print(java.io.OutputStream) * @throws Exception/*w ww.j ava2s . c om*/ */ @Override public void print(final OutputStream stream) throws Exception { final Font titleFont = FontFactory.getFont(FontFactory.HELVETICA, 20, Font.BOLD); final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD); final Font normalFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL); final Document doc = new Document(); final PdfWriter writer = PdfWriter.getInstance(doc, stream); doc.open(); if (getDocumentNumber() != null) { Image image = Image.getInstance(new BarcodeHelper().generateBarcodeImage(getDocumentNumber()), null); doc.add(image); } final Paragraph title = new Paragraph("TEM Coversheet", titleFont); doc.add(title); final Paragraph faxNumber = new Paragraph( "Fax this page to " + SpringContext.getBean(ParameterService.class) .getParameterValueAsString(TravelReimbursementDocument.class, FAX_NUMBER), normalFont); doc.add(faxNumber); final Paragraph header = new Paragraph("", headerFont); header.setAlignment(ALIGN_RIGHT); header.add("Document Number: " + getDocumentNumber()); doc.add(header); doc.add(getInstructionsParagraph()); doc.add(getMailtoParagraph()); doc.add(Chunk.NEWLINE); doc.add(getTripInfo()); doc.add(Chunk.NEWLINE); doc.add(getPersonalInfo()); doc.add(Chunk.NEWLINE); doc.add(getExpenses()); drawAlignmentMarks(writer.getDirectContent()); doc.close(); writer.close(); }
From source file:org.kuali.kfs.pdp.batch.service.impl.DailyReportServiceImpl.java
License:Educational Community License
public DailyReportServiceImpl() { headerFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD); textFont = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL); }
From source file:org.kuali.ole.describe.controller.EditorController.java
License:Open Source License
private void generateCallSlip(EditorForm editorForm, HttpServletResponse response) { LOG.debug("Creating pdf"); String title = "", author = "", callNumber = "", location = "", copyNumber = "", enumeration = "", chronology = "", barcode = ""; SearchResponse searchResponse = null; SearchParams searchParams = new SearchParams(); SearchField searchField1 = searchParams.buildSearchField("item", "ItemIdentifier_search", editorForm.getDocId());/*www . j av a 2 s. c om*/ searchParams.getSearchConditions().add(searchParams.buildSearchCondition("OR", searchField1, "AND")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("bibliographic", "Title")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("bibliographic", "Author")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "CallNumber")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "LocationName")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "CopyNumber")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "enumeration")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "chronology")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("item", "ItemBarcode")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("holdings", "CallNumber")); searchParams.getSearchResultFields().add(searchParams.buildSearchResultField("holdings", "LocationName")); try { searchResponse = getDocstoreClientLocator().getDocstoreClient().search(searchParams); } catch (Exception e) { LOG.error(e, e); } if (CollectionUtils.isNotEmpty(searchResponse.getSearchResults())) { for (SearchResultField searchResultField : searchResponse.getSearchResults().get(0) .getSearchResultFields()) { if (searchResultField.getDocType().equalsIgnoreCase(DocType.BIB.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("Title")) { if (StringUtils.isBlank(title)) { title = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.BIB.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("Author")) { if (StringUtils.isBlank(author)) { author = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("CallNumber")) { callNumber = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("LocationName")) { location = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("CopyNumber")) { copyNumber = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("enumeration")) { enumeration = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("chronology")) { chronology = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.ITEM.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("ItemBarcode")) { barcode = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.HOLDINGS.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("CallNumber")) { if (StringUtils.isBlank(callNumber)) { callNumber = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } } else if (searchResultField.getDocType().equalsIgnoreCase(DocType.HOLDINGS.getCode()) && searchResultField.getFieldName().equalsIgnoreCase("LocationName")) { if (StringUtils.isBlank(location)) { location = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : ""; } } } } String fileName = "Call/Paging Slip" + "_" + (editorForm.getTitle() != null ? editorForm.getTitle() : "") + "_" + new Date(System.currentTimeMillis()) + ".pdf"; if (LOG.isInfoEnabled()) { LOG.info("File Created :" + title + "file name ::" + fileName + "::"); } try { Document document = this.getDocument(0, 0, 5, 5); OutputStream outputStream = null; response.setContentType("application/pdf"); //response.setHeader("Content-Disposition", "attachment;filename=" + fileName); outputStream = response.getOutputStream(); PdfWriter.getInstance(document, outputStream); Font boldFont = new Font(Font.TIMES_ROMAN, 15, Font.BOLD); document.open(); document.newPage(); PdfPTable pdfTable = new PdfPTable(3); pdfTable.setWidths(new int[] { 20, 2, 30 }); Paragraph paraGraph = new Paragraph(); paraGraph.setAlignment(Element.ALIGN_CENTER); paraGraph.add(new Chunk("Call/Paging Slip", boldFont)); paraGraph.add(Chunk.NEWLINE); paraGraph.add(Chunk.NEWLINE); paraGraph.add(Chunk.NEWLINE); document.add(paraGraph); pdfTable.addCell(getPdfPCellInJustified("Title")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(title)); pdfTable.addCell(getPdfPCellInJustified("Author")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(author)); pdfTable.addCell(getPdfPCellInJustified("Call Number")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(callNumber)); pdfTable.addCell(getPdfPCellInJustified("Location")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(location)); pdfTable.addCell(getPdfPCellInJustified("Copy Number")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(copyNumber)); pdfTable.addCell(getPdfPCellInJustified("Enumeration")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(enumeration)); pdfTable.addCell(getPdfPCellInJustified("Chronology")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(chronology)); pdfTable.addCell(getPdfPCellInJustified("Barcode")); pdfTable.addCell(getPdfPCellInLeft(":")); pdfTable.addCell(getPdfPCellInJustified(barcode)); document.add(pdfTable); document.close(); outputStream.flush(); outputStream.close(); } catch (Exception e) { LOG.error(e, e); } }