List of usage examples for com.itextpdf.text.pdf PdfPTable setSpacingBefore
public void setSpacingBefore(final float spacing)
From source file:file.PDFWriter.java
License:Open Source License
/** * Add the page number and line to the PDF * @param splitLines the array of line segments to print * @param page the page number the line was on * @throws DocumentException //from www .j a v a 2 s.c o m */ private void addLineTableToPDF(String[] splitLines, String page) throws DocumentException { PdfPTable lineTable = new PdfPTable(2); PdfPCell pageCell = new PdfPCell(new Paragraph("Page: " + page, lineFont)); pageCell.setPadding(20); pageCell.setPaddingLeft(0); pageCell.setBorder(PdfPCell.NO_BORDER); Chunk lineSegment1 = new Chunk(splitLines[0]); lineSegment1.setFont(lineFont); Chunk error1 = new Chunk(splitLines[1]); error1.setFont(lineFontBold); Chunk lineSegment2 = new Chunk(splitLines[2]); lineSegment2.setFont(lineFont); Chunk error2 = new Chunk(splitLines[3]); error2.setFont(lineFontBold); Chunk lineSegment3 = new Chunk(splitLines[4]); lineSegment3.setFont(lineFont); Phrase line = new Phrase(lineSegment1); line.add(error1); line.add(lineSegment2); line.add(error2); line.add(lineSegment3); PdfPCell lineCell = new PdfPCell(line); lineCell.setPadding(20); lineCell.setBorder(PdfPCell.NO_BORDER); lineTable.setWidthPercentage(100); lineTable.setWidths(new int[] { 2, 10 }); lineTable.setSpacingBefore(1f); lineTable.setSpacingAfter(1f); lineTable.addCell(pageCell); lineTable.addCell(lineCell); document.add(lineTable); document.add(Chunk.NEWLINE); }
From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java
License:Apache License
private PdfPTable createBeginningOfPage(Font font, String date) throws DocumentException { Paragraph titre;// www .ja va 2s. c o m document.newPage(); titre = new Paragraph(); titre.setFont(font); titre.setAlignment(Paragraph.ALIGN_CENTER); titre.add(new Phrase("Programme du " + date)); document.add(titre); float[] relativeWidth = new float[service.getRooms(date).size() + 1]; Arrays.fill(relativeWidth, 1f); relativeWidth[0] = 0.5f; PdfPTable table = new PdfPTable(relativeWidth); table.setWidthPercentage(100); table.setSpacingBefore(10); table.setSpacingAfter(20); table.addCell(createHeaderCell("Heure")); for (String room : service.getRooms(date)) { table.addCell(createHeaderCell(room)); } return 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;/*from w w w . j av a 2 s . co m*/ document.newPage(); 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:fxml.test.PDFService.java
public PdfPTable createTableHeader(int start) { PdfPTable table = null;/* ww w. j ava2 s. c o m*/ try { int colCount = 1; List<Float> columnsList = new ArrayList<>(); columnsList.add(57.5f); columnsList.add(159.4f); for (int i = start; i < list.size(); i++) { if (list.get(i) instanceof Course) { columnsList.add(44f); } else if (list.get(i).equals("Total Credit")) { columnsList.add(30f); } else if (list.get(i).equals("Total GPA")) { columnsList.add(30f); } else if (list.get(i).equals("Letter Grade")) { columnsList.add(30f); } else if (list.get(i).equals("Cumulative")) { columnsList.add(88f); } else { columnsList.add(66f); } if (colCount == 12) { break; } colCount++; } float[] columns = new float[columnsList.size()]; for (int i = 0; i < columnsList.size(); i++) { columns[i] = columnsList.get(i); } table = new PdfPTable(columns.length); System.err.println("table size :" + table.getNumberOfColumns()); table.setHorizontalAlignment(Element.ALIGN_LEFT); table.setTotalWidth(columns); table.setLockedWidth(true); } catch (DocumentException ex) { Logger.getLogger(PDFService.class.getName()).log(Level.SEVERE, null, ex); } PdfPCell regCell = getCellForString("Reg No.", 0, true, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font9, false); regCell.setPaddingTop(0f); table.addCell(regCell); PdfPCell nameCell = getNameCell(); nameCell.setPaddingBottom(2f); table.addCell(nameCell); int colCount = 1; for (int i = start; i < list.size(); i++) { if (list.get(i) instanceof Course) { Course course = (Course) list.get(i); PdfPCell cell3 = new PdfPCell(createCourseInfo(course)); cell3.setPaddingTop(1f); cell3.setPaddingBottom(2f); //cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell3); } else if (list.get(i).equals("Total Credit") || list.get(i).equals("Total GPA") || list.get(i).equals("Letter Grade")) { String str = (String) list.get(i); String s[] = str.split(" "); PdfPTable totalCredit = new PdfPTable(1); totalCredit.setSpacingBefore(12.5f); totalCredit.setWidthPercentage(100); totalCredit.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPCell cell1 = getCellForString(s[0], 0, false, 0, Element.ALIGN_CENTER, new Font(Font.FontFamily.TIMES_ROMAN, 10f), false); PdfPCell cell2 = getCellForString(s[1], 0, false, 0, Element.ALIGN_CENTER, new Font(Font.FontFamily.TIMES_ROMAN, 10f), false); totalCredit.addCell(cell1); totalCredit.addCell(cell2); PdfPCell grade = new PdfPCell(totalCredit); table.addCell(grade); } else if (list.get(i).equals("Cumulative")) { PdfPTable cumulative = new PdfPTable(1); // cumulative.setPaddingTop(count); cumulative.addCell(getCellForString("Cumulative", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); PdfPTable creditGpaGrade = new PdfPTable(3); creditGpaGrade.setTotalWidth(88f); creditGpaGrade.setLockedWidth(true); creditGpaGrade.addCell(getCellForString("Credit", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); creditGpaGrade.addCell(getCellForString("GPA", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); creditGpaGrade.addCell(getCellForString("Grade", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); PdfPTable p = new PdfPTable(1); PdfPCell cell1 = new PdfPCell(cumulative); cell1.setPaddingBottom(3f); cell1.setBorder(Rectangle.NO_BORDER); PdfPCell cell2 = new PdfPCell(creditGpaGrade); cell2.setBorder(Rectangle.NO_BORDER); p.addCell(cell1); p.addCell(cell2); table.addCell(p); } else { table.addCell(getCellForString((String) list.get(i), 0, true, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font9, true)); } if (colCount == 12) { break; } colCount++; } return table; }
From source file:generators.InvoiceGenerator.java
/** * Generate Invoice pdf file//from w w w .j a va2s . co m * * @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:gestionsessions.FenSession.java
private void jTableGestionSessionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableGestionSessionMouseClicked Document document = new Document(); String req;/*from ww w . ja v a2 s . c o m*/ int nbLignes = 0; // Creation d'une PdfPTable avec 5 colonnes final PdfPTable table = new PdfPTable(5); try { PdfWriter.getInstance(document, new FileOutputStream(System.getProperty("user.dir") + "//listeEmargementSession.pdf")); document.open(); //en tte du pdf Image logo = Image.getInstance("logo.png"); logo.scaleAbsolute(120f, 67f); document.add(logo); //on indique la marge document.add(new Phrase("\n\n\nMarge dgage par la session: " + jTableGestionSession.getValueAt(jTableGestionSession.getSelectedRow(), 9).toString() + "")); document.add(new Phrase("\n\nListe d'margement de la session ")); document.add(new Phrase( jTableGestionSession.getValueAt(jTableGestionSession.getSelectedRow(), 0).toString())); document.add(new Phrase( " / " + jTableGestionSession.getValueAt(jTableGestionSession.getSelectedRow(), 1).toString())); document.add(new Phrase( " / " + jTableGestionSession.getValueAt(jTableGestionSession.getSelectedRow(), 2).toString())); document.add(new Phrase(" / " + jTableGestionSession.getValueAt(jTableGestionSession.getSelectedRow(), 3).toString() + ":")); // Ajout d'un espace entre la PdfPTable et l'lment prcdent. table.setSpacingBefore(15f); //requte pour les personnes inscrites stmt1 = GestionBdd.connexionBdd(GestionBdd.TYPE_MYSQL, "formarmor", "localhost", "root", ""); req = "Select c.* from client c, inscription i where c.id = i.client_id and i.session_formation_id = " + jTableGestionSession.getValueAt(jTableGestionSession.getSelectedRow(), 0).toString(); ResultSet rs1 = GestionBdd.envoiRequeteLMD(stmt1, req); // Ajout d'une entte pour PdfPTable table.addCell("Matricule"); table.addCell("Nom"); table.addCell("Rue"); table.addCell("Code Postal"); table.addCell("Ville"); // Ajout d'un espace entre la PdfPTable et l'lment prcdent. table.setSpacingBefore(15f); table.setWidthPercentage(100); table.setSpacingBefore(0f); table.setSpacingAfter(0f); //change taille colonnes table.setWidths(new int[] { 5, 10, 14, 6, 8 }); while (rs1.next()) { // Ajout d'objets String la PdfPTable table.addCell(rs1.getString(1)); table.addCell(rs1.getString(3)); table.addCell(rs1.getString(5)); table.addCell(rs1.getString(6)); table.addCell(rs1.getString(7)); // Ajout d'un espace entre la PdfPTable et l'lment prcdent. table.setSpacingBefore(15f); nbLignes++; } //cas ou il n'y a personne d'inscrit if (nbLignes == 0) { JOptionPane.showMessageDialog(null, "Il n'y a personne d'inscrits"); document.add(new Phrase("\n\nIl n'y a personne d'inscrits")); } else { document.add(table); //ouvre le fichier listeEmargementSession.pdf avec le logiciel de lecture pdf par dfaut Runtime r = Runtime.getRuntime(); r.exec(new String[] { "cmd.exe", "/C", System.getProperty("user.dir") + "//listeEmargementSession.pdf" }); } document.close(); } catch (DocumentException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (SQLException ex) { Logger.getLogger(FenSession.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FenSession.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java
private static void generateDocumentPage1(TrackingRecordScreeningLetter screeningLetter, Document document, PdfWriter writer) throws BadElementException, DocumentException, Exception { PdfPTable table = null; int headerwidths[] = {}; Paragraph paragraph = null;//from www . j ava 2s. c o m List blist = null; ListItem item = null; ListItem subItem = null; SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); // LS Authorization Letter Page 1 addLetterIdentifier(screeningLetter, document); paragraph = new Paragraph(fixedLeadingLarge); paragraph.add(new Phrase("Office of Licensing Authorization", largefontB)); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); paragraph = new Paragraph(fixedLeadingLarge); paragraph.add(new Phrase("for Electronic Background Check", largefontB)); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); paragraph = new Paragraph(fixedLeadingLarge); paragraph.add(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("Office of Licensing Information", mediumfontU)); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Type of Background Check Required and Agency Billing Code:", smallfont)); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); /* * Start of Billing information line generation */ table = new PdfPTable(3); // format the table headerwidths = new int[] { 20, 45, 35 }; // percentage table.setWidths(headerwidths); // percentage table.setWidthPercentage(100); table.setSpacingBefore(page1SeparatorSpace); table.getDefaultCell().setPadding(0); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // Add Billing Code if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling() != null && StringUtils.isNotBlank( screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue())) { table.addCell( new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue(), xlargefontB)); } else { table.addCell(new Phrase(" ", xlargefontB)); } // Add Fee information paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Search Fee = ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee() != null) { paragraph.add(new Phrase( CommonUtils.fromDoubleToCurrency( screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getSearchFee()), smallfontB)); } else { paragraph.add(SMALL_BLANK); } paragraph.add(new Phrase(" / Scan Fee = ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee() != null) { paragraph .add(new Phrase( CommonUtils.fromDoubleToCurrency( screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee()), smallfontB)); } table.addCell(paragraph); // Add Facility Type information table.addCell(new Phrase("Licensed Treatment Programs", smallfont)); // Add Billing Information Line Table to document document.add(table); /* * End of Billing information line table generation */ // Add Check Number document line paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Check Number ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber())) { paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber(), smallfontB)); } paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); /* * Start of Check Issuer information line */ table = new PdfPTable(2); // format the table headerwidths = new int[] { 40, 60 }; // percentage table.setWidths(headerwidths); // percentage table.setWidthPercentage(100); table.setSpacingBefore(page1SeparatorSpace); table.getDefaultCell().setPadding(0); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // Add Issuer information paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Issuer ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy())) { paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy(), smallfontB)); } table.addCell(paragraph); // Add Program Name information paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Program Name ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getFacility() != null && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility().getName())) { paragraph.add( new Phrase(screeningLetter.getTrackingRecordScreening().getFacility().getName(), smallfontB)); } table.addCell(paragraph); // Add the Check Issuer table to the document document.add(table); /* * End of Check Issuer information line */ /* * Start of Applicant information line generation */ table = new PdfPTable(3); // format the table headerwidths = new int[] { 43, 20, 37 }; // percentage table.setWidths(headerwidths); // percentage table.setWidthPercentage(100); table.setSpacingBefore(page1SeparatorSpace); table.getDefaultCell().setPadding(0); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_MIDDLE); // Add Applicant name paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Applicant ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getPerson() != null && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFirstAndLastName())) { paragraph.add( new Phrase(screeningLetter.getTrackingRecordScreening().getFirstAndLastName(), smallfontB)); } table.addCell(paragraph); // Add Applicant ID paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("ID ", smallfont)); if (StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getPersonIdentifier())) { paragraph.add( new Phrase(screeningLetter.getTrackingRecordScreening().getPersonIdentifier(), smallfontB)); } table.addCell(paragraph); // Add DOB information paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("DOB ", smallfont)); try { paragraph.add( new Phrase(df.format(screeningLetter.getTrackingRecordScreening().getBirthday()), smallfontB)); } catch (NullPointerException e) { } table.addCell(paragraph); // Add Applicant Information Line Table to document document.add(table); /* * End of Applicant information line generation */ // Add Facility Licensing Specialist Information paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("OL Representative ", smallfont)); if (screeningLetter.getTrackingRecordScreening().getFacility() != null && screeningLetter.getTrackingRecordScreening().getFacility().getLicensingSpecialist() != null && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility() .getLicensingSpecialist().getFirstAndLastName())) { paragraph.add(new Phrase(screeningLetter.getTrackingRecordScreening().getFacility() .getLicensingSpecialist().getFirstAndLastName(), smallfontB)); } paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); // Add Distribution Line paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase( "Distribution: Original for the Applicant to turn in to the Live Scan Operator. Copy retained by Office of Licensing.", smallfont)); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); // Add Program & Applicatant header line paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Program & Applicant Information and Instructions", smallfontBU)); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); // Add READ THIS CAREFULLY paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("READ THIS CAREFULLY", mediumfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); /* * Start of instructions list section */ blist = new List(false, 20); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("1.", mediumfont)); item.add(new Phrase( "The Office of Licensing authorizes the applicant to submit her/his fingerprints for an electronic applicant background check ", smallfont)); item.add(new Phrase( "at various sites throughout Utah using the Live Scan system. Please see the enclosed list for site information. Each site ", smallfont)); item.add(new Phrase( "charges a fee for the electronic fingerprint scan. Scanning fees vary from site to site. This is a separate fee from the ", smallfont)); item.add(new Phrase( "one submitted to the Department of Human Services for the actual criminal background search.", smallfont)); item.setSpacingBefore(page1ListSpace); blist.add(item); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("2.", mediumfont)); item.add(new Phrase( "Complete electronic fingerprint submission within 15 days of the date of this authorization letter. If unused, ", smallfontB)); item.add(new Phrase("requests for refunds will not be considered after 30 days. ", smallfontB)); item.setSpacingBefore(page1ListSpace); blist.add(item); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("", smallfont)); item.add(new Phrase( "Refund requests require a letter of explanation from the licensed program accompanied by this original authorization letter.", smallfontBU)); item.setSpacingBefore(4.0f); blist.add(item); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("", smallfont)); item.add(new Phrase( "Failure to complete electronic fingerprint submission within this time will result in the denial of the background screening ", smallfontB)); item.add(new Phrase( "clearance and the applicant will not be permitted to have direct access to children or vulnerable adults, will not be eligible ", smallfontB)); item.add(new Phrase( "to provide services to programs licensed by the Utah Department of Human Services, Office of Licensing, and will not be ", smallfontB)); item.add(new Phrase("eligible to proceed with foster care or adoption.", smallfontB)); item.setSpacingBefore(4.0f); blist.add(item); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("3.", mediumfont)); paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("You will need to take with you:", smallfont)); item.add(paragraph); List subList = new List(false, 10); subList.setIndentationLeft(10); subItem = new ListItem(fixedLeadingSmall); subItem.add(new Phrase("This original letter. Photocopies and facsimile (FAX) copies will not be accepted.", smallfont)); subList.add(subItem); subItem = new ListItem(fixedLeadingSmall); subItem.add(new Phrase( "Photo identification in the form of your driver license or state identification card issued by the Division of Motor Vehicles.", smallfont)); subList.add(subItem); subItem = new ListItem(fixedLeadingSmall); subItem.add(new Phrase("Social Security Card", smallfont)); subList.add(subItem); subItem = new ListItem(fixedLeadingSmall); subItem.add( new Phrase("Cash or check as required (see site list for acceptable form of payment).", smallfont)); subList.add(subItem); item.add(subList); item.setSpacingBefore(page1ListSpace); blist.add(item); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("4.", mediumfont)); item.add(new Phrase( "If the electronically submitted fingerprints are rejected, the Office of Licensing will notify the applicant/licensed program ", smallfont)); item.add(new Phrase("of additional instructions for completing the nationwide background search.", smallfont)); item.setSpacingBefore(page1ListSpace); blist.add(item); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("5.", mediumfont)); item.add(new Phrase("Legibly print the following information for the scanning operator:", smallfont)); item.setSpacingBefore(page1ListSpace); blist.add(item); document.add(blist); document.add(getPage1WriteInLine1()); document.add(getPage1WriteInLine2()); document.add(getPage1WriteInLine3()); blist = new List(false, 20); item = new ListItem(fixedLeadingSmall); item.setListSymbol(new Chunk("6.", mediumfont)); item.add(new Phrase( "Applicant Signature ___________________________________________________ Date ________________", smallfont)); item.setSpacingBefore(page1ListSpace); blist.add(item); document.add(blist); paragraph = new Paragraph(); paragraph.add(new Phrase( "A current list of Livescan sites is available at www.hslic.utah.gov/docs/livescan sites.pdf", smallfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling() != null && StringUtils.isNotBlank( screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue())) { paragraph = new Paragraph(); paragraph.add( new Phrase(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getBilling().getValue(), xlargefontB)); paragraph.setAlignment(Element.ALIGN_RIGHT); paragraph.setSpacingBefore(page1SeparatorSpace); document.add(paragraph); } /* * End of instructions list section */ }
From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java
private static void generateDocumentPage2(TrackingRecordScreeningLetter screeningLetter, Document document, PdfWriter writer) throws BadElementException, DocumentException, Exception { Paragraph paragraph = null;/*from ww w .j a va 2 s. c o m*/ PdfPTable datatable = null; List blist = null; ListItem item = null; SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); addLetterIdentifier(screeningLetter, document); // Add confidential header to document paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("CONFIDENTIAL", mediumfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); // Add Date header datatable = getPage2HeaderTable(); datatable.addCell(new Phrase("Date:", mediumfont)); datatable.addCell(new Phrase(df.format(screeningLetter.getLetterDate()), mediumfont)); datatable.setSpacingBefore(20); document.add(datatable); // Add To header datatable = getPage2HeaderTable(); datatable.addCell(new Phrase("To:", mediumfont)); datatable.addCell(new Phrase( "Director, " + screeningLetter.getTrackingRecordScreening().getFacility().getName(), mediumfont)); datatable.setSpacingBefore(page2SeparatorSpace); document.add(datatable); // Add From header datatable = getPage2HeaderTable(); datatable.addCell(new Phrase("From:", mediumfont)); datatable.addCell(new Phrase( screeningLetter.getCreatedBy().getFirstAndLastName() + ", Criminal Background Screening Unit", mediumfont)); datatable.setSpacingBefore(page2SeparatorSpace); document.add(datatable); // Add Subject Header datatable = getPage2HeaderTable(); datatable.addCell(new Phrase("Re:", mediumfont)); datatable.addCell(new Phrase("Background Screening Request for " + screeningLetter.getTrackingRecordScreening().getFirstAndLastName() + " (" + screeningLetter.getTrackingRecordScreening().getPersonIdentifier() + ")", mediumfont)); datatable.setSpacingBefore(page2SeparatorSpace); document.add(datatable); // Start adding letter body information paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase( "As a follow-up to your request for background screening by the Department of Human Services, Office of Licensing, ", mediumfont)); paragraph.add(new Phrase( "this is to notify you that additional criminal background screening informaiton is needed (UCA62A-2-120 and R501-14). ", mediumfont)); paragraph.add(new Phrase( "The applicant may have an unresolved issue. Please let the applicant know that s/he must resolve this matter before the ", mediumfont)); paragraph.add(new Phrase( "background screening can be conducted by the Office of Licensing. Once the applicant has resolved the issue, the applicant, ", mediumfont)); paragraph.add(new Phrase( "facility representative or foster care licensor must notify the Office of Licensing in writing in order for background ", mediumfont)); paragraph.add(new Phrase("screening to proceed.", mediumfont)); paragraph.setSpacingBefore(page2SeparatorSpace); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase( "This person is not cleared under licensing standards to have direct access to children or vulnerable adults:", mediumfontB)); paragraph.setSpacingBefore(10); document.add(paragraph); blist = new List(false, 10); blist.setIndentationLeft(indent); blist.setListSymbol(new Chunk(">", mediumfont)); item = new ListItem(fixedLeadingMedium); item.add(new Phrase( "If you choose to employ or retain this person, you are assuming full liability and must make sure the individual ", mediumfont)); item.add(new Phrase( "works under direct supervision, under the uninterrupted visual and auditory surveillance of the person doing the supervising.", mediumfont)); blist.add(item); item = new ListItem(fixedLeadingMedium); item.add(new Phrase( "If the person is to provide foster care services, a license will not be granted until the background screening is complete.", mediumfont)); blist.add(item); document.add(blist); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase( "Please give a copy of this letter to the applicant and instruct the applicant to resolve the issue.", mediumfontB)); paragraph.setSpacingBefore(page2SeparatorSpace); document.add(paragraph); blist = new List(false, 10); blist.setIndentationLeft(indent); blist.setListSymbol(new Chunk(">", mediumfont)); item = new ListItem(fixedLeadingMedium); item.add(new Phrase( "S/he must resolve this matter before the background screening can be completed by the Office of Licensing.", mediumfont)); blist.add(item); document.add(blist); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add( new Phrase("The Background Screening Technician must be notified of the resolution of the issue:", mediumfontB)); paragraph.setSpacingBefore(page2SeparatorSpace); document.add(paragraph); blist = new List(false, 10); blist.setIndentationLeft(indent); blist.setListSymbol(new Chunk(">", mediumfont)); item = new ListItem(fixedLeadingMedium); item.add(new Phrase( "If I do not receive information within 15 calendar days of the date of this notice regarding resolution of the issue, ", mediumfont)); item.add(new Phrase( "the Office of Licensing will close the background screening request for failure to provide information, and the ", mediumfont)); item.add(new Phrase( "applicant will not be allowed to have direct access to children or vulnerable adults in licensed programs.", mediumfont)); blist.add(item); document.add(blist); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("Issue needing resolution:", mediumfontB)); paragraph.setSpacingBefore(page2SeparatorSpace); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase( "[ X ] The Background screening application cannot be processed if the Livescan procedure is not completed.", mediumfontB)); paragraph.setSpacingBefore(page2SeparatorSpace); document.add(paragraph); blist = new List(false, 10); blist.setIndentationLeft(indent); blist.setListSymbol(new Chunk(">", mediumfont)); item = new ListItem(fixedLeadingMedium); item.add(new Phrase( "Please have applicant submit to electronic fingerprinting using the Authorization form issued and mailed to your office.", mediumfont)); blist.add(item); item = new ListItem(fixedLeadingMedium); item.add(new Phrase( "If the applicant is no longer pursuing employment or applying to provide services to your program, please send me a ", mediumfont)); item.add(new Phrase("statement on letterhead so I may close this file.", mediumfont)); blist.add(item); document.add(blist); // Add document footer paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase( "*The Office of Licensing will accept a court record faxed by the court to the Office of Licensing at", smallfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(15); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("(801) 538-4669.", smallfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(0); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase( "Thank you for your attention to providing complete and accurate information necessary for the background screening.", smallfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(0); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("If you have any questions, please call the Office of Licensing at 801-538-4242.", smallfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(0); document.add(paragraph); }
From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java
private static PdfPTable getPage1WriteInLine1() throws BadElementException, DocumentException, Exception { PdfPTable table = new PdfPTable(2); PdfPTable dtl = null;/* w w w . j a v a 2 s . c o m*/ int headerwidths[] = { 4, 96 }; // percentage table.setWidths(headerwidths); // percentage table.setWidthPercentage(100); table.setSpacingBefore(page1ListSpace); table.getDefaultCell().setPadding(0); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); // Redefine the headerwidths for the detail table headerwidths = new int[] { 25, 25, 25, 25 }; // percentage dtl = new PdfPTable(4); dtl.setWidths(headerwidths); // percentage dtl.setWidthPercentage(100); dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0); dtl.getDefaultCell().setPadding(0); dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER); dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM); dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); dtl.getDefaultCell().setCellEvent(new FloatingLinedPdfPCell()); dtl.addCell(SMALL_BLANK); dtl.addCell(SMALL_BLANK); dtl.addCell(SMALL_BLANK); dtl.addCell(SMALL_BLANK); table.addCell(SMALL_BLANK); // Leave first cell blank table.addCell(dtl); dtl = new PdfPTable(4); dtl.setWidths(headerwidths); // percentage dtl.setWidthPercentage(100); dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0); dtl.getDefaultCell().setPadding(0); dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER); dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell()); dtl.addCell(new Phrase("Last Name", smallfont)); dtl.addCell(new Phrase("Full First Name", smallfont)); dtl.addCell(new Phrase("Full Middle Name", smallfont)); dtl.addCell(new Phrase("AKA", smallfont)); table.addCell(SMALL_BLANK); // Leave first cell blank table.addCell(dtl); dtl = new PdfPTable(4); dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0); dtl.getDefaultCell().setPadding(0); dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER); dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell()); dtl.addCell(SMALL_BLANK); dtl.addCell(SMALL_BLANK); dtl.addCell(new Phrase("If no middle name, write NA.", smallfont)); dtl.addCell(SMALL_BLANK); table.addCell(SMALL_BLANK); // Leave first cell blank table.addCell(dtl); return table; }
From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorization.java
private static PdfPTable getPage1WriteInLine2() throws BadElementException, DocumentException, Exception { PdfPTable table = new PdfPTable(2); PdfPTable dtl = null;/* ww w . j a v a2 s.co m*/ PdfPCell cell = null; int headerwidths[] = { 4, 96 }; // percentage table.setWidths(headerwidths); // percentage table.setWidthPercentage(100); table.setSpacingBefore(page1ListSpace); table.getDefaultCell().setPadding(0); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); dtl = new PdfPTable(12); headerwidths = new int[] { 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 9 }; // percentage dtl.setWidths(headerwidths); // percentage dtl.setWidthPercentage(100); dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0); dtl.getDefaultCell().setPadding(0); dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER); dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM); dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingLinedPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingLinedPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingLinedPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingLinedPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingLinedPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingLinedPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); cell = new PdfPCell(dtl.getDefaultCell()); cell.setCellEvent(new FloatingPdfPCell()); cell.setPhrase(SMALL_BLANK); dtl.addCell(cell); table.addCell(SMALL_BLANK); // Leave first cell blank table.addCell(dtl); dtl = new PdfPTable(12); headerwidths = new int[] { 11, 5, 11, 5, 11, 5, 11, 5, 11, 5, 11, 9 }; // percentage dtl.setWidths(headerwidths); // percentage dtl.setWidthPercentage(100); dtl.getDefaultCell().setLeading(fixedLeadingSmall, 0); dtl.getDefaultCell().setPadding(0); dtl.getDefaultCell().setBorder(Rectangle.NO_BORDER); dtl.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); dtl.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); dtl.getDefaultCell().setCellEvent(new FloatingPdfPCell()); dtl.addCell(new Phrase("DOB", smallfont)); dtl.addCell(SMALL_BLANK); dtl.addCell(new Phrase("Eye Color", smallfont)); dtl.addCell(SMALL_BLANK); dtl.addCell(new Phrase("Hair Color", smallfont)); dtl.addCell(SMALL_BLANK); dtl.addCell(new Phrase("Weight", smallfont)); dtl.addCell(SMALL_BLANK); dtl.addCell(new Phrase("Height", smallfont)); dtl.addCell(SMALL_BLANK); dtl.addCell(new Phrase("Gender", smallfont)); dtl.addCell(SMALL_BLANK); table.addCell(SMALL_BLANK); // Leave first cell blank table.addCell(dtl); return table; }