List of usage examples for com.itextpdf.text Document getPageSize
public Rectangle getPageSize()
From source file:edu.clemson.lph.pdfgen.PDFGen.java
License:Open Source License
private void printDoc() { if (sSourceFile == null || osDest == null) { logger.error("Cannot print nothing"); return;//from w w w . ja v a 2 s .c om } boolean bBold = false; boolean bCenter = false; boolean bItalic = false; boolean bSmallItalic = false; boolean bUnderline = false; try { Document doc = new Document(); float fCorr = doc.getPageSize().getWidth() / 8.5f; doc.setMargins(1.0f * fCorr, 1.0f * fCorr, 1.0f * fCorr, 1.0f * fCorr); PdfWriter.getInstance(doc, osDest); doc.open(); BufferedReader br = new BufferedReader(new FileReader(sSourceFile)); String sLine = br.readLine(); while (sLine != null) { bBold = false; bCenter = false; if (sLine.startsWith(".")) { String sRest = sLine.substring(1); String sCodes = sRest.substring(0, sRest.indexOf('.')); sLine = sRest.substring(sRest.indexOf('.') + 1); if ("image".equals(sCodes)) { String sFileName = sLine; com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(sFileName); image.setAlignment(Element.ALIGN_CENTER); doc.add(image); sLine = br.readLine(); continue; } else if ("himage".equals(sCodes)) { String sFileName = sLine; com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(sFileName); image.scaleToFit(500, 40); image.setAlignment(Element.ALIGN_CENTER); doc.add(image); Paragraph p = new Paragraph(" "); doc.add(p); sLine = br.readLine(); continue; } else if ("fimage".equals(sCodes)) { int iBlanks = 9; // How do I figure out how many to get to end? for (int i = 0; i < iBlanks; i++) { Paragraph p = new Paragraph(" "); doc.add(p); } String sFileName = sLine; com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(sFileName); image.scaleToFit(500, 40); image.setAlignment(Element.ALIGN_CENTER); doc.add(image); sLine = br.readLine(); continue; } else if ("list".equals(sCodes)) { String sFullLine = doSub(sLine); StringTokenizer tok = new StringTokenizer(sFullLine, "\n"); List list = new List(List.UNORDERED); while (tok.hasMoreTokens()) { String sNextLine = tok.nextToken(); ListItem listItem = new ListItem(sNextLine, fNormal); list.add(listItem); } doc.add(list); sLine = br.readLine(); continue; } if (sCodes.contains("b")) bBold = true; if (sCodes.contains("c")) bCenter = true; if (sCodes.contains("i")) bItalic = true; if (sCodes.contains("si")) bSmallItalic = true; if (sCodes.contains("u")) bUnderline = true; } if (sLine.trim().length() == 0) sLine = " "; String sFullLine = doSub(sLine); Paragraph p = new Paragraph(); if (bBold) p.setFont(fBold); else if (bSmallItalic) p.setFont(fSmallItalic); else if (bItalic) p.setFont(fItalic); else if (bUnderline) p.setFont(fUnderline); else p.setFont(fNormal); if (bCenter) { p.setAlignment(Element.ALIGN_CENTER); } else { p.setAlignment(Element.ALIGN_LEFT); } p.add(sFullLine); doc.add(p); sLine = br.readLine(); } br.close(); doc.close(); } catch (FileNotFoundException e) { logger.error("Could not find source file " + sSourceFile + " or destination", e); } catch (IOException e) { logger.error("Could not read file " + sSourceFile, e); } catch (DocumentException e) { logger.error("Error creating iText Document", e); } }
From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java
License:Open Source License
private void createImage(Document document, PdfWriter writer, Font featureHeaderStyle) throws BadElementException, MalformedURLException, IOException, DocumentException { Image imageSprite = Image.getInstance(new URL( "http://lh3.ggpht.com/_4msVPAgKJv8/SCRYD-pPVKI/AAAAAAAAAYU/zUN963EPoZc/s1024/102_0609.JPG")); imageSprite.setAbsolutePosition(400, 500); imageSprite.scaleAbsolute(171.0f, 250.0f); float imageSpriteY = document.getPageSize().getHeight() * 0.60f; float imageSpriteX = document.getPageSize().getWidth() * 0.65f; imageSprite.setAlignment(Image.UNDERLYING); document.add(imageSprite);/*from w ww .jav a 2 s . c o m*/ PdfContentByte cb = writer.getDirectContent(); ColumnText ct = new ColumnText(cb); Chunk imageHeader = new Chunk("Images", featureHeaderStyle); ct.addText(imageHeader); ct.setAlignment(Element.ALIGN_LEFT); ct.setSimpleColumn(imageSpriteX, imageSpriteY - imageSprite.getScaledHeight(), imageSpriteX + imageSprite.getScaledWidth(), imageSpriteY + imageSprite.getScaledHeight() + 20); ct.go(); ct = new ColumnText(cb); Chunk imageFooter = new Chunk("Footer to be set for a figure. Similar to 'image cpation'.", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8)); ct.addText(imageFooter); ct.setAlignment(Element.ALIGN_CENTER); ct.setSimpleColumn(imageSpriteX, imageSpriteY - 150, imageSpriteX + imageSprite.getScaledWidth(), imageSpriteY); ct.go(); }
From source file:edu.umn.genomics.component.SavePDF.java
License:Open Source License
/** * Saves the Component to a Portable Document File, PDF, with the * file location selected using the JFileChooser. * @param c the Component to save as a PDF *//*from w w w .j a v a2s . com*/ public static boolean savePDF(Component c) throws IOException { System.out.println(""); final int w = c.getWidth() > 0 ? c.getWidth() : 1; final int h = c.getHeight() > 0 ? c.getHeight() : 1; final Dimension dim = c.getPreferredSize(); JFileChooser chooser = new JFileChooser(); JPanel ap = new JPanel(); ap.setLayout(new BoxLayout(ap, BoxLayout.Y_AXIS)); JPanel sp = new JPanel(new GridLayout(0, 1)); sp.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Image Size")); final JTextField iwtf = new JTextField("" + w, 4); iwtf.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "width")); final JTextField ihtf = new JTextField("" + h, 4); ihtf.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "height")); JButton curSzBtn = new JButton("As Viewed: " + w + "x" + h); curSzBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { iwtf.setText("" + w); ihtf.setText("" + h); } }); sp.add(curSzBtn); if (dim != null && dim.getWidth() > 0 && dim.getHeight() > 0) { JButton prefSzBtn = new JButton("As Preferred: " + dim.width + "x" + dim.height); prefSzBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { iwtf.setText("" + dim.width); ihtf.setText("" + dim.height); } }); sp.add(prefSzBtn); } sp.add(iwtf); sp.add(ihtf); ap.add(sp); chooser.setAccessory(ap); // ImageFilter filter = new ImageFilter(fmt); // chooser.setFileFilter(filter); int returnVal = chooser.showSaveDialog(c); boolean status = false; if (returnVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); //Added the below code to add th .pdf extension if it is not provided by the user String name = file.getAbsolutePath(); if (!(name.substring(name.length() - 4, name.length()).equalsIgnoreCase(".pdf"))) { name = name.concat(".pdf"); file = new File(name); } int iw = w; int ih = h; try { iw = Integer.parseInt(iwtf.getText()); ih = Integer.parseInt(ihtf.getText()); } catch (Exception ex) { ExceptionHandler.popupException("" + ex); } iw = iw > 0 ? iw : w; ih = ih > 0 ? ih : h; if (iw != w || ih != h) { c.setSize(iw, ih); } // step 1: creation of a document-object Document document = new Document(); try { // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file)); // step 3: we open the document document.open(); // step 4: we grab the ContentByte and do some stuff with it // we create a fontMapper and read all the fonts in the font directory DefaultFontMapper mapper = new DefaultFontMapper(); // mapper.insertDirectory("c:\\winnt\\fonts"); com.itextpdf.text.Rectangle pgSize = document.getPageSize(); // we create a template and a Graphics2D object that corresponds with it PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(iw, ih); tp.setWidth(iw); tp.setHeight(ih); Graphics2D g2 = tp.createGraphics(iw, ih, mapper); g2.setStroke(new BasicStroke(.1f)); //cb.setLineWidth(.1f); //cb.stroke(); c.paintAll(g2); g2.dispose(); //cb.addTemplate(tp, 0, 0); float sfx = (float) (pgSize.getWidth() / iw); float sfy = (float) (pgSize.getHeight() / ih); // preserve the aspect ratio float sf = (float) Math.min(sfx, sfy); cb.addTemplate(tp, sf, 0f, 0f, sf, 0f, 0f); } catch (DocumentException de) { ExceptionHandler.popupException("" + de); } catch (IOException ioe) { ExceptionHandler.popupException("" + ioe); } catch (Exception ex) { ExceptionHandler.popupException("" + ex); } // step 5: we close the document document.close(); if (iw != w || ih != h) { c.setSize(w, h); } } return true; }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionSocialDiagram(Section section, Document document) { Image i = rsp.generateScrenshot(ViewsManager.SOCIAL_VIEW); float reductionScale = fitImageInArea(i, document.getPageSize().getWidth() - document.rightMargin() - document.leftMargin(), 310, false); if (reductionScale <= getMaximumReductionScale()) { setAppendixASocialDiagram(true); }//from w w w . j a va 2 s. c o m StringBuilder sectionIntro = new StringBuilder(); sectionIntro.append(ftc.getFigure(FigureConstant.SOCIAL_DIAGRAM) + " presents the graphical representation of the social view"); if (needSocialDiagramInAppendixA()) { sectionIntro.append(" (a larger picture is shown in appendix A)"); } sectionIntro.append("."); section.add(createParagraph(sectionIntro.toString())); section.add(decorateImage(i, ftc.getFigure(FigureConstant.SOCIAL_DIAGRAM) + " - Social View for the " + getProjectName() + " project")); section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionInformationViewDiagram(Section section, Document document) { Image i = rsp.generateScrenshot(ViewsManager.RESOURCE_VIEW); float reductionScale = fitImageInArea(i, document.getPageSize().getWidth() - document.rightMargin() - document.leftMargin(), 310, false); if (reductionScale <= getMaximumReductionScale()) { setAppendixAInformationDiagram(true); }/* w w w . ja v a 2 s . c om*/ StringBuilder sectionIntro = new StringBuilder(); sectionIntro.append(ftc.getFigure(FigureConstant.INFORMATION_DIAGRAM) + " presents the graphical representation of the information view"); if (needInformationDiagramInAppendixA()) { sectionIntro.append(" (a larger picture is shown in appendix A)"); } sectionIntro.append("."); section.add(createParagraph(sectionIntro.toString())); section.add(decorateImage(i, ftc.getFigure(FigureConstant.INFORMATION_DIAGRAM) + " - Information View for the " + getProjectName() + " project")); section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
private void buildSectionAuthorisationDiagram(Section section, Document document) { Image i = rsp.generateScrenshot(ViewsManager.AUTHORIZATION_VIEW); float reductionScale = fitImageInArea(i, document.getPageSize().getWidth() - document.rightMargin() - document.leftMargin(), 310, false); if (reductionScale <= getMaximumReductionScale()) { setAppendixASocialDiagram(true); }//from www. j a va 2s.c om StringBuilder sectionIntro = new StringBuilder(); sectionIntro.append(ftc.getFigure(FigureConstant.AUTH_DIAGRAM) + " presents the graphical representation of the Authorisation view"); if (needAuthorisationDiagramInAppendixA()) { sectionIntro.append(" (a larger picture is rappresented in appendix A)"); } sectionIntro.append("."); section.add(createParagraph(sectionIntro.toString())); section.add(decorateImage(i, ftc.getFigure(FigureConstant.AUTH_DIAGRAM) + " - Authorisation View for the " + getProjectName() + " project")); section.setComplete(true); }
From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.ReportContentFactory.java
License:Open Source License
/******************************************************************************************/ private void buildAppendixAChapter(Chapter c, Document d) { c.setTitle(getChapterTitleParagraph("Appendix A")); c.setNumberDepth(0);// ww w . ja va 2 s . c om c.setTriggerNewPage(true); float width = d.getPageSize().getWidth() - d.leftMargin() - d.rightMargin(); float height = d.getPageSize().getHeight() - d.topMargin() - d.bottomMargin() - 70; if (needSocialDiagramInAppendixA()) { Image socialImage = rsp.generateScrenshot(ViewsManager.SOCIAL_VIEW); socialImage.setAlignment(Element.ALIGN_CENTER); if (socialImage.getPlainWidth() > socialImage.getPlainHeight()) { fitImageInArea(socialImage, height, width, true); socialImage.setRotationDegrees(90); } else { fitImageInArea(socialImage, width, height, true); } c.add(decorateImage(socialImage, ftc.getFigure(FigureConstant.SOCIAL_DIAGRAM) + " - Social View for the " + getProjectName() + " project")); } if (needInformationDiagramInAppendixA()) { Image informationImage = rsp.generateScrenshot(ViewsManager.RESOURCE_VIEW); informationImage.setAlignment(Element.ALIGN_CENTER); if (informationImage.getPlainWidth() > informationImage.getPlainHeight()) { fitImageInArea(informationImage, height, width, true); informationImage.setRotationDegrees(90); } else { fitImageInArea(informationImage, width, height, true); } // c.add(informationImage); c.add(decorateImage(informationImage, ftc.getFigure(FigureConstant.INFORMATION_DIAGRAM) + " - Information View for the " + getProjectName() + " project")); } if (needInformationDiagramInAppendixA()) { Image authorisationImage = rsp.generateScrenshot(ViewsManager.AUTHORIZATION_VIEW); authorisationImage.setAlignment(Element.ALIGN_CENTER); if (authorisationImage.getPlainWidth() > authorisationImage.getPlainHeight()) { fitImageInArea(authorisationImage, height, width, true); authorisationImage.setRotationDegrees(90); } else { fitImageInArea(authorisationImage, width, height, true); } // c.add(authorisationImage); c.add(decorateImage(authorisationImage, ftc.getFigure(FigureConstant.AUTH_DIAGRAM) + " - Authorisation View for the " + getProjectName() + " project")); } c.setComplete(true); }
From source file:fll.web.report.ReportPageEventHandler.java
License:Open Source License
@Override // initialization of the header table public void onEndPage(final PdfWriter writer, final Document document) { final PdfPTable header = new PdfPTable(2); final Phrase p = new Phrase(); final Chunk ck = new Chunk(_challengeTitle + "\n" + _reportTitle, _font); p.add(ck);// www . ja va 2 s. c o m header.getDefaultCell().setBorderWidth(0); header.addCell(p); header.getDefaultCell().setHorizontalAlignment(com.itextpdf.text.Element.ALIGN_RIGHT); header.addCell(new Phrase(new Chunk("Tournament: " + _tournament + "\nDate: " + _formattedDate, _font))); final PdfPCell blankCell = new PdfPCell(); blankCell.setBorder(0); blankCell.setBorderWidthTop(1.0f); blankCell.setColspan(2); header.addCell(blankCell); final PdfContentByte cb = writer.getDirectContent(); cb.saveState(); header.setTotalWidth(document.right() - document.left()); header.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 10, cb); cb.restoreState(); }
From source file:fr.ybonnel.breizhcamppdf.PdfRenderer.java
License:Apache License
public void render() throws DocumentException, IOException { // Footer//from w ww .j a v a 2 s . c o m pdfWriter.setPageEvent(new PdfPageEventHelper() { @Override public void onEndPage(PdfWriter writer, Document document) { if (writer.getPageNumber() > 1) { Rectangle rect = document.getPageSize(); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("BreizhCamp 2014"), (rect.getLeft() + rect.getRight()) / 2, rect.getBottom() + 18, 0); } } }); createFirstPage(); List<Talk> talksToExplain = createProgrammePages(); createTalksPages(talksToExplain); }
From source file:gov.utah.dts.det.ccl.actions.trackingrecordscreening.letters.reports.LivescanAuthorizationB1591.java
private static void generateDocumentPage1(TrackingRecordScreeningLetter screeningLetter, Document document, PdfWriter writer) throws BadElementException, DocumentException, Exception { PdfPTable table = null;/*from ww w. ja va 2 s .c o m*/ int headerwidths[] = {}; Paragraph paragraph = null; List blist = null; ListItem item = null; ListItem subItem = null; SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); StringBuilder sb; PdfContentByte over = writer.getDirectContent(); // LS Authorization Letter Page 1 addLetterIdentifier(document); paragraph = new Paragraph(fixedLeadingLarge); paragraph.add(new Phrase("Office of Licensing Livescan Authorization", largefontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(30.0f); 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", mediumfontBU)); paragraph.setSpacingBefore(20.0f); document.add(paragraph); /* * Start of Office of Licensing Information generation */ table = new PdfPTable(2); // format the table headerwidths = new int[] { 60, 40 }; // percentage table.setWidths(headerwidths); // percentage table.setWidthPercentage(100); table.setSpacingBefore(pageSeparatorSpace); table.getDefaultCell().setPadding(0); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); paragraph = new Paragraph(fixedLeadingLarge); paragraph.add(new Phrase("TYPE OF TRANSACTION: NFUF", largefontB)); paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase("REASON FINGERPRINTED: UCA 62A-2-120", largefontB)); paragraph.add(Chunk.NEWLINE); paragraph.add(new Phrase("BILLING CODE: B1591", largefontB)); table.addCell(paragraph); paragraph = new Paragraph(fixedLeadingSmall); Calendar cal = Calendar.getInstance(); cal.setTime(screeningLetter.getLetterDate()); cal.add(Calendar.DAY_OF_MONTH, 16); paragraph.add(new Phrase("This Authorization Expires: " + df.format(cal.getTime()), smallfont)); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(paragraph); document.add(table); // Add Fee information paragraph = new Paragraph(fixedLeadingSmall); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee() != null) { paragraph.add(new Phrase("Scan Fee = ", smallfont)); paragraph .add(new Phrase( CommonUtils.fromDoubleToCurrency( screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getScanFee()), smallfontB)); } else { 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.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); // Add Authorized Signature line paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase( "Office of Licensing Authorized Signature ___________________________________________________ Date ________________", smallfont)); paragraph.setSpacingBefore(18.0f); document.add(paragraph); // Stamp the document date over the Date line above // NOTE: Use showColumnBorders as a diagnostic to display borders of column where date will be placed on document. //showColumnBorders(over); ColumnText ct = new ColumnText(over); ct.setLeading(fixedLeadingSmall); ct.addText(new Phrase(df.format(screeningLetter.getLetterDate()), smallfont)); // Write column to document ct.setAlignment(Element.ALIGN_CENTER); ct.setSimpleColumn(COLUMNS[0][0], COLUMNS[0][1], COLUMNS[0][2], COLUMNS[0][3]); ct.go(); over.setLineWidth(3.0f); over.setCMYKColorStroke(166, 92, 0, 145); over.moveTo(document.getPageSize().getLeft(65), BOTTOM_SEPARATOR_EDGE); over.lineTo(document.getPageSize().getRight(65), BOTTOM_SEPARATOR_EDGE); over.stroke(); // Add Program & Applicatant header line paragraph = new Paragraph(fixedLeadingSmall); paragraph.add(new Phrase("Program & Applicant Information and Instructions", smallfontBU)); paragraph.setSpacingBefore((2 * pageSeparatorSpace) + fixedLeadingSmall); document.add(paragraph); /* * 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(pageSeparatorSpace); 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: ", smallfontB)); 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: ", smallfontB)); 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: ", smallfontB)); 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 Application program line paragraph = new Paragraph(fixedLeadingSmall); sb = new StringBuilder(); sb.append("Applicant Program: "); if (screeningLetter.getTrackingRecordScreening().getFacility() != null && StringUtils.isNotBlank(screeningLetter.getTrackingRecordScreening().getFacility().getName())) { sb.append(screeningLetter.getTrackingRecordScreening().getFacility().getName().toUpperCase()); } paragraph.add(new Phrase(sb.toString(), smallfontB)); paragraph.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); // Add Payment information line paragraph = new Paragraph(fixedLeadingSmall); sb = new StringBuilder(); sb.append("Payment issued by: "); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy())) { sb.append(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getIssuedBy().toUpperCase()); } sb.append(" "); sb.append("Check Number: "); if (screeningLetter.getTrackingRecordScreening().getTrsDpsFbi() != null && StringUtils .isNotBlank(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber())) { sb.append(screeningLetter.getTrackingRecordScreening().getTrsDpsFbi().getMoNumber().toUpperCase()); } paragraph.add(new Phrase(sb.toString(), smallfontB)); paragraph.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); // Add READ THIS CAREFULLY paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("READ THIS CAREFULLY", largefontBU)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(pageSeparatorSpace + fixedLeadingLarge); 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. Each site charges a fee for the electronic fingerprint scan. ", smallfont)); item.add(new Phrase( "Scanning fees vary from site to site. This is a separate fee from the one submitted to the Department of Human Services for ", smallfont)); item.add(new Phrase("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. Refund requests require a letter of explanation ", smallfontB)); item.add(new Phrase( "from the licensed program accompanied by this original authorization letter. Failure to complete electronic ", smallfontB)); item.add(new Phrase( "fingerprint submission within this time will result in the denial of the background screening clearance and ", smallfontB)); item.add(new Phrase( "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 I.D. 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("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( "Applicant Signature ___________________________________________________ Date ________________", smallfont)); item.setSpacingBefore(page1ListSpace); blist.add(item); document.add(blist); /* * End of instructions list section */ paragraph = new Paragraph(); paragraph.add(new Phrase( "A current list of Livescan sites is available at www.hslic.utah.gov/docs/livescan sites.pdf", smallfont)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); paragraph = new Paragraph(fixedLeadingMedium); paragraph.add(new Phrase("Live Scan Operator: Keep this original for auditing purposes.", mediumfontB)); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.setSpacingBefore(pageSeparatorSpace); document.add(paragraph); }