List of usage examples for com.itextpdf.text Paragraph setSpacingAfter
public void setSpacingAfter(float spacing)
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private Paragraph getAlaysisDescription(String analysisName, Paragraph analysisDesc) { Paragraph res = createParagraph("%b" + analysisName + "% "); res.add(Chunk.NEWLINE);//from w w w.j a v a2 s . c om analysisDesc.setSpacingAfter(0); analysisDesc.setSpacingBefore(0); res.add(analysisDesc); return res; }
From source file:fenix.planner.pdf.PDFGenerator.java
License:Open Source License
private void parseAndAddFreeText(String text) throws DocumentException { List currentList = null;//ww w . jav a 2 s. c o m for (String line : text.split("\n")) { if (line.startsWith("- ")) { if (currentList == null) { currentList = new List(false, 10f); currentList.setListSymbol("\u2022"); } ListItem item = new ListItem(); currentList.add(item); parseAndAddBodyTextLineToParagraph(item, line.substring(2), freeTextFont); } else { if (currentList != null && !currentList.isEmpty()) { currentList.getLastItem().setSpacingAfter(5); currentList.getFirstItem().setSpacingBefore(5); document.add(currentList); currentList = null; } Paragraph p = new Paragraph(); p.setSpacingAfter(5); p.setSpacingBefore(5); parseAndAddBodyTextLineToParagraph(p, line, freeTextFont); document.add(p); } } }
From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java
License:Apache License
private void createFirstPage() throws DocumentException, IOException { Rectangle savePagesize = document.getPageSize(); document.setPageSize(PageSize.A4);//from w ww . j av a 2s.c o m document.newPage(); Image imageLogo = Image.getInstance(PdfRenderer.class.getResource("/logo.png")); imageLogo.scaleToFit(document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin(), imageLogo.getHeight()); document.add(imageLogo); Paragraph paragraph = new Paragraph("21, 22 et 23 mai"); paragraph.setSpacingAfter(80); paragraph.getFont().setSize(20); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); Paragraph title = new Paragraph("Programme 2014"); title.setSpacingAfter(100); title.getFont().setSize(56); title.setAlignment(Element.ALIGN_CENTER); document.add(title); PdfPTable sponsors = new PdfPTable(4); sponsors.setWidthPercentage(90f); addSponsor(sponsors, "http://www.breizhcamp.org/img/LogoZenika-H-(Quadri).jpg", 2); addSponsor(sponsors, "http://blogs.technet.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-80-54/6864.Microsoft-Logo.png", 2); addSponsor(sponsors, "http://www.breizhcamp.org/img/Google_Logo_3564x1189.png", 1); addSponsor(sponsors, "http://www.breizhcamp.org/img/cbpaas.jpeg", 1); addSponsor(sponsors, "https://github.global.ssl.fastly.net/images/modules/logos_page/GitHub-Logo.png", 1); addSponsor(sponsors, "http://www.breizhcamp.org/img/sonarsource-300x94.png", 1); addSponsor(sponsors, "http://www.breizhcamp.org/img/serli.png", 1); addSponsor(sponsors, "http://www.breizhcamp.org/img/Logo_sqli_group.png", 1); addSponsor(sponsors, "http://www.breizhcamp.org/img/SofteamCadextanLogo_w200.png", 1); addSponsor(sponsors, "http://www.breizhcamp.org/img/logoSII_w200.png", 1); document.add(sponsors); Image istic = Image.getInstance("http://www.breizhcamp.org/img/Logo_ISTIC_BLACK_FRA.jpg"); istic.scaleToFit(150, 150); istic.setAlignment(Element.ALIGN_CENTER); document.add(istic); document.setPageSize(savePagesize); }
From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java
License:Apache License
private void createTalksPages(List<Talk> talksToExplain) throws DocumentException, IOException { document.setPageSize(PageSize.A4);// w w w .j a v a 2s. c o m document.newPage(); Paragraph paragraph = new Paragraph("Liste des talks"); paragraph.setSpacingAfter(25); paragraph.getFont().setSize(25); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); for (TalkDetail talk : Lists.transform(talksToExplain, new Function<Talk, TalkDetail>() { @Override public TalkDetail apply(Talk input) { return TalkService.INSTANCE.getTalkDetail(input); } })) { if (talk == null) { continue; } Paragraph empty = new Paragraph(" "); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); table.setKeepTogether(true); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPCell cell; Chunk titleTalk = new Chunk(talk.getTitle(), talkFontTitle); titleTalk.setLocalDestination("talk" + talk.getId()); float[] withTitle = { 0.05f, 0.95f }; PdfPTable titleWithFormat = new PdfPTable(withTitle); titleWithFormat.getDefaultCell().setBorder(Rectangle.NO_BORDER); titleWithFormat.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); Image image = AvatarService.INSTANCE.getImage(PdfRenderer.class .getResource("/formats/" + talk.getTalk().getFormat().replaceAll(" ", "") + ".png")); titleWithFormat.addCell(image); titleWithFormat.addCell(new Paragraph(titleTalk)); table.addCell(titleWithFormat); table.addCell(empty); table.addCell(new Paragraph("Salle " + talk.getTalk().getRoom() + " de " + talk.getTalk().getStart() + " " + talk.getTalk().getEnd(), presentFont)); table.addCell(empty); cell = new PdfPCell(); cell.setBorder(0); cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED); for (Element element : HTMLWorker .parseToList(new StringReader(markdownProcessor.markdown(talk.getDescription())), null)) { if (element instanceof Paragraph) { ((Paragraph) element).setAlignment(Element.ALIGN_JUSTIFIED); } cell.addElement(element); } table.addCell(cell); table.addCell(empty); table.addCell(new Paragraph("Prsent par :", presentFont)); float[] widthSpeaker = { 0.05f, 0.95f }; for (Speaker speaker : talk.getSpeakers()) { PdfPTable speakerWithAvatar = new PdfPTable(widthSpeaker); speakerWithAvatar.getDefaultCell().setBorder(Rectangle.NO_BORDER); speakerWithAvatar.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); speakerWithAvatar.addCell(AvatarService.INSTANCE.getImage(speaker.getAvatar())); speakerWithAvatar.addCell(new Phrase(speaker.getFullname())); table.addCell(speakerWithAvatar); } table.addCell(empty); table.addCell(empty); document.add(table); } }
From source file:fr.ybonnel.breizhcamppdf.RoomPdfRenderer.java
License:Apache License
private PdfPTable createBeginningOfPage(Font font, String date, String room) throws DocumentException { Paragraph titre; document.newPage();// w w w. j a va 2 s . c om titre = new Paragraph(); titre.setFont(font); titre.setAlignment(Paragraph.ALIGN_CENTER); titre.add(new Phrase("Programme du " + date + " - " + room)); titre.setSpacingAfter(20); document.add(titre); float[] relativeWidth = new float[2]; Arrays.fill(relativeWidth, 1f); relativeWidth[0] = 0.2f; PdfPTable table = new PdfPTable(relativeWidth); table.setWidthPercentage(100); table.setSpacingBefore(10); table.setSpacingAfter(20); table.addCell(createHeaderCell("Heure")); table.addCell(createHeaderCell("")); return table; }
From source file:generators.InvoiceGenerator.java
/** * Generate Invoice pdf file//from w w w .j a v a 2 s . com * * @param order the order * @throws DocumentException the document exception * @throws IOException the io exception */ public void generate(Order order) throws DocumentException, IOException { Date invoiceDate = order.getDate(); SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM YYYY"); // User guest = order.getGuest(); User guest = new UserDAO().get(order.getUserId()); guest.setOrder(order); System.out.println("invoice generator orderID: " + order.getId()); Document document = new Document(); Font defaultFont = new Font(Font.FontFamily.TIMES_ROMAN, 12); System.out.println(System.getProperty("user.dir")); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(System.getProperty("user.dir") + "/src/main/java/nl/ipsen3/invoice/" + new SimpleDateFormat("dd-MM-yyyy").format(invoiceDate) + " - " + order.getId() + ".pdf")); document.setMargins(30, 30, 30, 65); writer.setPageEvent(new InvoiceEventListener()); document.open(); Paragraph header = new Paragraph("Lionsclub Oegstgeest/Warmond", new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD)); header.setAlignment(Element.ALIGN_CENTER); document.add(header); AddressDAO addressDAO = new AddressDAO(); Address userAddress = addressDAO.get(guest.getAddressId()); Paragraph address = new Paragraph(guest.getFirstName() + " " + guest.getPrefixLastName() + " " + guest.getLastName() + "\n" + userAddress.getStreet() + " " + userAddress.getHouseNumber() + "\n" + userAddress.getZipCode() + " " + userAddress.getCity(), defaultFont); address.setSpacingBefore(35); address.setSpacingAfter(25); address.setLeading(15); document.add(address); Paragraph invoiceDetails = new Paragraph("Factuurdatum: " + sdf.format(invoiceDate) + "\n" + "FactuurNummer: " + order.getId() + " \n" + "Debiteurennummer: " + guest.getId(), defaultFont); invoiceDetails.setSpacingAfter(15); invoiceDetails.setLeading(15); document.add(invoiceDetails); Paragraph subject = new Paragraph("Betreft: Onderwerp factuur", defaultFont); subject.setSpacingAfter(30); document.add(subject); PdfPTable orderTable = new PdfPTable(10); PdfPCell wineCell = new PdfPCell(new Paragraph("Wijn", defaultFont)); wineCell.setColspan(5); wineCell.setBorder(Rectangle.BOTTOM); orderTable.getDefaultCell().setPaddingBottom(10); orderTable.getDefaultCell().setBorder(Rectangle.BOTTOM); ; orderTable.addCell(new Paragraph("Code", defaultFont)); orderTable.addCell(new Paragraph("Aantal", defaultFont)); orderTable.addCell(wineCell); orderTable.addCell(new Paragraph("Jaar", defaultFont)); orderTable.addCell(new Paragraph("Per Fles", defaultFont)); orderTable.addCell(new Paragraph("Bedrag", defaultFont)); orderTable.getDefaultCell().setPaddingBottom(0); orderTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); wineCell.setBorder(Rectangle.NO_BORDER); NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.GERMANY); for (WineOrder wineOrder : order.getWineOrders()) { orderTable.addCell(new Paragraph("" + wineOrder.getWine().getId(), defaultFont)); orderTable.addCell(new Paragraph("" + wineOrder.getAmount(), defaultFont)); wineCell.setPhrase(new Phrase(wineOrder.getWine().getName(), defaultFont)); orderTable.addCell(wineCell); orderTable.addCell(new Paragraph("" + wineOrder.getWine().getYear(), defaultFont)); orderTable.addCell(new Paragraph( " " + numberFormat.format(wineOrder.getWine().getPrice()).replace(" ", ""), defaultFont)); orderTable.addCell(new Paragraph(" " + numberFormat .format(wineOrder.getAmount() * wineOrder.getWine().getPrice()).replace(" ", ""), defaultFont)); orderTable.completeRow(); } orderTable.addCell(" "); orderTable.completeRow(); Font totalFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); PdfPCell totalAmount = new PdfPCell( new Paragraph(" " + numberFormat.format(order.getTotalAmount()).replace(" ", ""), totalFont)); totalAmount.setBorder(Rectangle.TOP); totalAmount.setPaddingTop(10); PdfPCell totalCell = new PdfPCell(new Paragraph("Totaal", totalFont)); totalCell.setPaddingTop(10); totalCell.setBorder(Rectangle.NO_BORDER); orderTable.addCell(totalCell); PdfPCell fillerCell = new PdfPCell(new Paragraph("")); fillerCell.setColspan(8); fillerCell.setBorder(Rectangle.NO_BORDER); orderTable.addCell(fillerCell); orderTable.addCell(totalAmount); orderTable.setSpacingBefore(15); orderTable.setSpacingAfter(30); orderTable.setWidthPercentage(95); orderTable.setHorizontalAlignment(Element.ALIGN_CENTER); document.add(orderTable); Paragraph retrievalDetails = new Paragraph( "Wij verzoeken u vriendelijk het totaalbedrag binnen 7 dagen na factuurdatum over te maken op bankrekening <bankAccountNr> t.n.v <bankAccountName> onder vermelding van het factuurnummer", defaultFont); retrievalDetails.setLeading(15); retrievalDetails.setSpacingAfter(20); document.add(retrievalDetails); // document.add(new Paragraph("U kunt uw wijnen ophalen op " + sdf.format(invoiceDate) , defaultFont)); // document.add(new Paragraph("Adres:", defaultFont)); // // PdfPTable addressTable = new PdfPTable(1); // addressTable.setSpacingBefore(5); // addressTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); // addressTable.getDefaultCell().setPaddingLeft(35); // MerchantService merchantService = new MerchantService(); // Merchant merchant = merchantService.find(merchantService.all().get(0).getId()); // addressTable.addCell(new Paragraph(merchant.getName(), defaultFont)); // addressTable.addCell(new Paragraph(merchant.getAddress().getStreet() // + " " + merchant.getAddress().getHouseNumber(), defaultFont)); // addressTable.addCell(new Paragraph(merchant.getAddress().getZipCode() + " " + // merchant.getAddress().getCity(), defaultFont)); // addressTable.setHorizontalAlignment(Element.ALIGN_LEFT); // document.add(addressTable); document.close(); System.out.println( "Succesfully generated IPSEN2.invoice: " + order.getId() + " on Date: " + sdf.format(invoiceDate)); }
From source file:genericServlets.Generapdf.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods./*from w w w . ja v a2 s. c o m*/ * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { gruppo = manager.getGruppo(Integer.parseInt(request.getParameter("groupid"))); numpost = manager.getNumPostPerGruppo(Integer.parseInt(request.getParameter("groupid"))); datalastpost = manager.getDataUltimoPost(Integer.parseInt(request.getParameter("groupid"))); } catch (SQLException | NullPointerException ex) { Logger.getLogger(Generapdf.class.getName()).log(Level.SEVERE, null, ex); response.sendRedirect(request.getContextPath() + "/afterLogged/afterLogin?op=main"); } try { List<Integer> users_ids = manager.getUtenti(gruppo.getIdgruppo()); for (Integer user_id : users_ids) { Utente u = null; u = manager.getMoreUtente(user_id); utenti_gruppo.add(u); } } catch (SQLException ex) { Logger.getLogger(Generapdf.class.getName()).log(Level.SEVERE, null, ex); } response.setContentType("application/pdf"); Document document = new Document(); try { PdfWriter.getInstance(document, response.getOutputStream()); document.open(); if (gruppo != null) { document.add(new Paragraph("Nome del gruppo: " + gruppo.getNome())); document.add(new Paragraph("Proprietario gruppo: " + gruppo.getNomeOwner())); } else { document.add(new Paragraph("Gruppo sconosciuto")); } Paragraph p = new Paragraph("Di seguito vengono riportati gli username degli utenti del gruppo \"" + gruppo.getNome() + "\"\n"); p.setSpacingAfter(25); document.add(p); PdfPTable table = new PdfPTable(1); // Code 1 // Code 2 table.addCell("Nomi degli utenti partecipanti"); for (Utente utente : utenti_gruppo) { table.addCell(utente.getUsername()); } if (utenti_gruppo.isEmpty()) { table.addCell("Il proprietario del gruppo attualmente l'unico partecipante"); } document.add(table); if (datalastpost == null || numpost == -1) { document.add(new Paragraph("Pare che nessuno abbia mai pubblicato un post!")); } else { document.add(new Paragraph("Data ultimo post: " + datalastpost.toString())); document.add(new Paragraph("Numero di post inseriti in questo gruppo: " + numpost)); } } catch (DocumentException de) { de.printStackTrace(); System.err.println("document: " + de.getMessage()); } document.close(); utenti_gruppo.clear(); }
From source file:gov.nih.nci.firebird.service.pdf.AdditionalContent.java
License:Open Source License
private ColumnText createText() { ColumnText text = new ColumnText(null); for (PageSection section : sections) { Paragraph header = new Paragraph(section.getHeader(), HEADER_FONT); text.addElement(header);// www .ja v a 2s . c o m Paragraph content = new Paragraph(section.getContent(), CONTENT_FONT); content.setIndentationLeft(CONTENT_INDENTATION); content.setSpacingAfter(CONTENT_SPACING); text.addElement(content); } return text; }
From source file:gov.utah.dts.det.ccl.actions.reports.generators.LicenseRenewalLettersReport.java
private static void generateDocumentPage(FacilityLicenseView license, Date today, Document document, PdfWriter writer) throws BadElementException, DocumentException, Exception { PdfPTable table = null;//from w w w . ja va2 s . c o m int headerwidths[] = {}; Paragraph paragraph = null; com.itextpdf.text.List blist = null; com.itextpdf.text.List subList = null; ListItem item = null; ListItem subItem = null; StringBuilder sb; PdfContentByte over = writer.getDirectContent(); Facility facility = license.getFacility(); Person licensingSpecialist = null; if (facility != null && facility.getLicensingSpecialist() != null) { licensingSpecialist = facility.getLicensingSpecialist(); } // Add report date paragraph = new Paragraph(fixedLeading); paragraph.add(new Phrase(df.format(today), mediumfont)); paragraph.setIndentationLeft(dateIndent); document.add(paragraph); // Add facility information paragraph = new Paragraph(fixedLeading); if (facility != null && StringUtils.isNotBlank(facility.getName())) { paragraph.add(new Phrase(facility.getName(), mediumfont)); } else { paragraph.add(BLANK); } if (facility != null && facility.getMailingAddress() != null && StringUtils.isNotBlank(facility.getMailingAddress().getAddressOne())) { paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase(facility.getMailingAddress().getAddressOne(), mediumfont)); if (StringUtils.isNotBlank(facility.getMailingAddress().getAddressTwo())) { paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase(facility.getMailingAddress().getAddressTwo(), mediumfont)); } if (StringUtils.isNotBlank(facility.getMailingAddress().getCityStateZip())) { paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase(facility.getMailingAddress().getCityStateZip(), mediumfont)); } } paragraph.setSpacingBefore(15); document.add(paragraph); // Add salutation paragraph = new Paragraph(fixedLeading); sb = new StringBuilder(); sb.append("Dear "); if (StringUtils.isNotBlank(facility.getName())) { sb.append(facility.getName()); } paragraph.add(new Phrase(sb.toString(), mediumfont)); paragraph.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); // Add due for renewal line paragraph = new Paragraph(fixedLeading); paragraph.add(new Phrase( "Your foster care license is due for renewal on " + df.format(license.getExpirationDate()), mediumfontB)); paragraph.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); // Add first paragraph paragraph = new Paragraph(fixedLeading); sb = new StringBuilder(); sb.append( "The Office of Licensing appreciates the services you have provided for DCFS and to the foster children "); sb.append( "who have been in your care. We hope that you will continue as foster parents for the next year. "); sb.append("To continue licensing please complete the following:"); paragraph.add(new Phrase(sb.toString(), mediumfont)); paragraph.setSpacingBefore(pageSeparatorSpace); paragraph.setSpacingAfter(pageSeparatorSpace); document.add(paragraph); /* * Start of instructions list section */ blist = new com.itextpdf.text.List(false, 20); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("1.", mediumfont)); item.add(new Phrase("Complete the enclosed Renewal Resource Family Application.", mediumfont)); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("2.", mediumfont)); sb = new StringBuilder(); sb.append( "Complete the Utah Department of Human Services Office of Licensing Background Screening Application form for everyone "); sb.append("18 years of age and older living in the home. Each form must have an original signature."); item.add(new Phrase(sb.toString(), mediumfont)); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("3.", mediumfont)); paragraph = new Paragraph(fixedLeading); paragraph.add( new Phrase("For everyone 18 years of age or older living in the home please attach:", mediumfont)); item.add(paragraph); subList = new com.itextpdf.text.List(false, 18); subList.setIndentationLeft(10); subItem = new ListItem(fixedLeading); subItem.setListSymbol(new Chunk("(a)", mediumfontB)); subItem.add( new Phrase("A legible copy of a current drivers license or a Utah State I.D. card.", mediumfontB)); subList.add(subItem); subItem = new ListItem(fixedLeading); subItem.setListSymbol(new Chunk("(b)", mediumfontB)); subItem.add(new Phrase("A legible copy of their social security card.", mediumfontB)); subList.add(subItem); item.add(subList); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("4.", mediumfont)); item.add(new Phrase("Complete the enclosed Foster Care Renewal Information Form.", mediumfont)); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("5.", mediumfont)); item.add(new Phrase("Provide copies of income verification (check stubs/or last year's income tax forms.)", mediumfontB)); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("6.", mediumfont)); item.add(new Phrase("All paperwork must be returned 30 days before your license expires to:", mediumfontB)); subList = new com.itextpdf.text.List(false, 0); subList.setListSymbol(new Chunk(" ", mediumfont)); subList.setIndentationLeft(10); subItem = new ListItem(fixedLeading); subItem.add(new Phrase("Office of Licensing", mediumfont)); subItem.setSpacingBefore(listItemSpace); subList.add(subItem); subItem = new ListItem(fixedLeading); if (licensingSpecialist != null && StringUtils.isNotBlank(licensingSpecialist.getFirstAndLastName())) { subItem.add(new Phrase(licensingSpecialist.getFirstAndLastName(), mediumfont)); } else { subItem.add(new Phrase("<Facility Licensing Specialist>", mediumfont)); } subList.add(subItem); if (licensingSpecialist != null && licensingSpecialist.getAddress() != null && StringUtils.isNotBlank(licensingSpecialist.getAddress().getAddressOne())) { subItem = new ListItem(fixedLeading); subItem.add(new Phrase(licensingSpecialist.getAddress().getAddressOne(), mediumfont)); subList.add(subItem); } if (licensingSpecialist != null && licensingSpecialist.getAddress() != null && StringUtils.isNotBlank(licensingSpecialist.getAddress().getAddressTwo())) { subItem = new ListItem(fixedLeading); subItem.add(new Phrase(licensingSpecialist.getAddress().getAddressTwo(), mediumfont)); subList.add(subItem); } if (licensingSpecialist != null && licensingSpecialist.getAddress() != null && StringUtils.isNotBlank(licensingSpecialist.getAddress().getCityStateZip())) { subItem = new ListItem(fixedLeading); subItem.add(new Phrase(licensingSpecialist.getAddress().getCityStateZip(), mediumfont)); subList.add(subItem); } item.add(subList); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("7.", mediumfont)); item.add(new Phrase( "Please call and schedule an appointment with me for your annual health and safety check.", mediumfont)); item.setSpacingAfter(listSpace); blist.add(item); item = new ListItem(fixedLeading); item.setListSymbol(new Chunk("8.", mediumfont)); paragraph = new Paragraph(fixedLeading); sb = new StringBuilder(); sb.append( "Complete the DCFS required renewal training of 12 hours for the primary provider and 4 hours for a spouse "); sb.append( "before your license expires. Please send all training to be approved and documented to the Utah Foster Care Foundation."); paragraph.add(new Phrase(sb.toString(), mediumfont)); item.add(paragraph); paragraph = new Paragraph(fixedLeading); sb = new StringBuilder(); sb.append( "The Utah Foster Care Foundation will then provide verification of all completed required training "); sb.append("to your local licensor."); paragraph.add(new Phrase(sb.toString(), mediumfontB)); item.add(paragraph); blist.add(item); document.add(blist); /* * End of instructions list section */ // Add final paragraph paragraph = new Paragraph(fixedLeading); paragraph.setSpacingBefore(pageSeparatorSpace); paragraph.add(new Phrase( "Your license will expire if all renewal requirements are not completed by the end of the licensing month. ", mediumfont)); paragraph.add(new Phrase( "A license expired beyond 30 days will require initiation of the background screening process again (including ", mediumfontB)); paragraph.add(new Phrase("any necessary fingerprinting). ", mediumfontB)); paragraph.add(new Phrase( "If you choose to discontinue providing services or have any questions, please contact me at ", mediumfont)); if (licensingSpecialist.getWorkPhone() != null && StringUtils.isNotBlank(licensingSpecialist.getWorkPhone().getFormattedPhoneNumber())) { paragraph.add(new Phrase(licensingSpecialist.getWorkPhone().getFormattedPhoneNumber(), mediumfontB)); } paragraph.add(new Phrase(".", mediumfontB)); document.add(paragraph); // Add closing paragraph = new Paragraph(fixedLeading); paragraph.setIndentationLeft(rightIndent); paragraph.setSpacingBefore(2 * pageSeparatorSpace); paragraph.add(new Phrase("Sincerely,", mediumfont)); document.add(paragraph); paragraph = new Paragraph(fixedLeading); paragraph.setIndentationLeft(rightIndent); paragraph.setSpacingBefore(3 * pageSeparatorSpace); if (licensingSpecialist != null && StringUtils.isNotBlank(licensingSpecialist.getFirstAndLastName())) { paragraph.add(new Phrase(licensingSpecialist.getFirstAndLastName(), mediumfont)); } else { paragraph.add(new Phrase("<Facility Licensing Specialist>", mediumfont)); } paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase("Foster Family Licensing Specialist", mediumfont)); document.add(paragraph); // Add Enclosures paragraph = new Paragraph(fixedLeading); paragraph.setSpacingBefore(pageSeparatorSpace); paragraph.add(new Phrase("Enclosures", mediumfont)); paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase("cc: Provider Record", mediumfont)); document.add(paragraph); }
From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.FailureToProvideInformationLetterDSPDC.java
private static void writePdf(TrackingRecordScreeningLetter screeningLetter, OutputStream ba, HttpServletRequest request) throws DocumentException, BadElementException, IOException { Document document = null;//from ww w.j av a 2s . co m Paragraph paragraph = null; document = new Document(PageSize.LETTER, 50, 50, 125, 0); PdfWriter writer = PdfWriter.getInstance(document, ba); SimpleDateFormat df = new SimpleDateFormat("MMMM d, yyyy"); document.open(); LetterheadStamper.stampLetter(writer, request); paragraph = getParagraph(10.0f); paragraph.add(new Phrase("FPI DSPDC", smallfont)); paragraph.setIndentationLeft(415); document.add(paragraph); paragraph.clear(); paragraph.add(new Phrase("Rev 7/12", smallfont)); paragraph.setSpacingAfter(50); document.add(paragraph); // Add report date paragraph = getParagraph(); paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont)); paragraph.setIndentationLeft(350); document.add(paragraph); // Add facility name and address information paragraph = getParagraph(); paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase(), mediumfont)); paragraph.setSpacingBefore(5); document.add(paragraph); if (screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() != null) { if (StringUtils.isNotBlank( screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressOne())) { paragraph = getParagraph(); paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() .getAddressOne().toUpperCase(), mediumfont)); document.add(paragraph); } if (StringUtils.isNotBlank( screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getAddressTwo())) { // Add facility location address two paragraph = getParagraph(); paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() .getAddressTwo().toUpperCase(), mediumfont)); document.add(paragraph); } if (StringUtils.isNotBlank( screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress().getCityStateZip())) { paragraph = getParagraph(); paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getCbsAddress() .getCityStateZip().toUpperCase(), mediumfont)); document.add(paragraph); } } // Add salutation paragraph = getParagraph(); paragraph.add(new Phrase("Dear Director:", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); // Add subject information paragraph = getParagraph(); paragraph.add(new Phrase("RE: Notice of Agency Action", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); // Add Screening Person's Name/ID paragraph = getParagraph(16.0f); paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " (" + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont)); // Indent this line to line up with 'Notice' in subject line paragraph.setIndentationLeft(22); document.add(paragraph); // Add FPI Details Line paragraph.clear(); paragraph.add(new Phrase(screeningLetter.getDetails(), mediumfont)); document.add(paragraph); // Start letter detail paragraph = getParagraph(); paragraph.add(new Phrase( "In accordance with the Utah Administrative Procedures Act, Utah Code Ann. 63-46b-1 et. Seq, Utah Code Ann. 62A-2-101-116, ", mediumfont)); paragraph.add(new Phrase( "Utah Code Ann. 62A-2-120 and Utah Department of Human Services rules, notice is hereby given of an Agency Action to deny the applicant's ", mediumfont)); paragraph.add(new Phrase("background screening application.", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase( "The named individual failed to provide this office with required information to complete a background clearance by the Department ", mediumfont)); paragraph.add(new Phrase( "of Human Services, and therefore is not permitted to have direct access to children or vulnerable adults, is not eligible to provide services ", mediumfont)); paragraph.add(new Phrase( "to programs licensed by the Utah Department of Human Services, Office of Licensing, and is not eligible to proceed with foster care or ", mediumfont)); paragraph.add(new Phrase("adoption until all procedures are completed.", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase("Please provide a copy of this letter to the applicant.", mediumfontB)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase( "If the person is an applicant for adoption or foster care services, no further action can be taken in the licensing ", mediumfont)); paragraph.add(new Phrase("process unless the denial is reversed after all appeals are final.", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase( "If the person is NOT an applicant for adoption or foster care services, you must immediately provide your Licensing Specialist ", mediumfont)); paragraph.add(new Phrase( "with written notification as to how you intend to prevent the applicant from having any direct access to children or vulnerable adults.", mediumfont)); paragraph.add(new Phrase( "The applicant is not authorized to have any direct access to children or vulnerable adults unless the denial is reversed after ", mediumfont)); paragraph.add(new Phrase("all appeals are final.", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase( "Please direct any questions concerning this action to the Office of Licensing, Background Screening Unit, at ", mediumfont)); paragraph.add(new Phrase("(801) 538-4242, or fax to me at (801) 538-4669.", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase("Sincerely,", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase(screeningLetter.getCreatedBy().getFirstAndLastName(), mediumfont)); paragraph.setSpacingBefore(25); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase("Criminal Information Technician", mediumfont)); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase("cc: Cathy Davis, DSPD", mediumfont)); paragraph.setSpacingBefore(10); document.add(paragraph); paragraph = getParagraph(); paragraph.add(new Phrase("File", mediumfont)); paragraph.setIndentationLeft(18); document.add(paragraph); document.close(); }