List of usage examples for com.itextpdf.text BaseColor DARK_GRAY
BaseColor DARK_GRAY
To view the source code for com.itextpdf.text BaseColor DARK_GRAY.
Click Source Link
From source file:digiho.DigiHoInitial1.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: jDate1.setText(""); Calendar timer = Calendar.getInstance(); timer.getTime();/*from w w w .j a v a 2 s .co m*/ SimpleDateFormat Tdate = new SimpleDateFormat("dd-MMM-yyy"); jDate1.setText(Tdate.format(timer.getTime())); Document doc = new Document(); try { PdfWriter.getInstance(doc, new FileOutputStream("f:\\DiGiho\\Complaint From\\" + jCustomer1.getText() + ".pdf")); doc.open(); doc.add(new Paragraph("\n", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.DARK_GRAY))); doc.add(new Paragraph("\n\n\n\n\n\n\n\n\n\n")); doc.add(new Phrase("Customer ID.: ")); doc.add(new Phrase(jCustomer1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase(" Date: " + jDate1.getText() + " \n\n")); doc.add(new Phrase("Name: ")); doc.add(new Phrase(jName1.getText() + ". " + jName2.getText() + " " + jName3.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nFather's Name: ")); doc.add(new Phrase(jFatherName1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nAddress: ")); doc.add(new Phrase(jAddress1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nBlock: ")); doc.add(new Phrase(jBlock1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nCity: ")); doc.add(new Phrase(jCity1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nDistrict: ")); doc.add(new Phrase(jDistrict1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nMoblie No.: ")); doc.add(new Phrase(jMobile1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Paragraph("\n\n\n\n\n\n")); doc.add(new Paragraph(" (1) " + jTextField2.getText())); doc.add(new Paragraph(" (2) " + jcomplain1.getText())); doc.add(new Paragraph(" (3) " + jcomplain3.getText())); doc.add(new Paragraph(" (4) " + jcomplain4.getText())); doc.close(); } catch (DocumentException e) { e.printStackTrace(); } catch (FileNotFoundException ex) { Logger.getLogger(DigiHoInitial1.class.getName()).log(Level.SEVERE, null, ex); } JOptionPane.showMessageDialog(null, "File has been created", "deeps message", JOptionPane.WARNING_MESSAGE); }
From source file:femr.ui.controllers.PDFController.java
License:Open Source License
/** * Builds the Header Cell used for every section of the document * * @param title the title for the cell//w w w . j av a 2 s. co m * @param colspan the number of columns in the table it will be added to * @return a formatted PdfPCell ready to insert into a PdfPTable */ private PdfPCell getDefaultHeaderCell(String title, int colspan) { PdfPCell cell = new PdfPCell(); Paragraph titleParagraph = new Paragraph(title, new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD, BaseColor.BLACK)); cell.addElement(titleParagraph); cell.setBorder(PdfPCell.NO_BORDER); cell.setColspan(colspan); cell.setBorderColorBottom(BaseColor.DARK_GRAY); cell.setBorderWidthBottom(1); cell.setPaddingBottom(5); return cell; }
From source file:Forms.CloseCash.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed String sql = "SELECT * FROM `cash` WHERE 1"; Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy"); String date = "" + ft.format(dNow); File theDir = new File("E:\\Reports"); // if the directory does not exist, create it if (!theDir.exists()) { //System.out.println("creating directory: " + directoryName); boolean result = false; try {// w ww . j a v a2 s . c o m theDir.mkdir(); result = true; } catch (SecurityException se) { //handle it } } try { Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/nafis", "root", ""); Statement s = (Statement) con.prepareStatement(sql); ResultSet rs = s.executeQuery(sql); Document document = new Document(PageSize.A5); PdfWriter.getInstance(document, new FileOutputStream("E:\\Reports\\report(" + date + ").pdf")); document.open(); Image image = Image.getInstance("api.png"); document.add(image); document.add(new Paragraph("UNITY POS REPORS", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.BLUE))); document.add(new Paragraph(date, FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph( "--------------------------------------------------------------------------------------")); PdfPTable table = new PdfPTable(4); //table.addCell("Date"); //table.addCell("Cash In/Out"); PdfPCell cell = new PdfPCell(new Phrase("Date")); cell.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(cell); PdfPCell ce = new PdfPCell(new Phrase("Cash In/Out")); ce.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(ce); PdfPCell c = new PdfPCell(new Phrase("Cause")); c.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(c); PdfPCell cel = new PdfPCell(new Phrase("Amount")); cel.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(cel); document.add(new Paragraph(" ")); document.add(table); float in = 0, out = 0; while (rs.next()) { String dateof = rs.getString(5); String inout = rs.getString(2); String cause = rs.getString(3); String amount = rs.getString(4); if (inout.equalsIgnoreCase("Cash In")) { in = in + Float.parseFloat(amount); } else { out = out + Float.parseFloat(amount); } PdfPTable t = new PdfPTable(4); t.addCell(dateof); t.addCell(inout); t.addCell(cause); t.addCell(amount); document.add(t); } System.out.println("in=" + in + "out=" + out); document.add(new Paragraph(" ")); document.add(new Paragraph("Total Invested: " + out, FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph("Total Return: " + in, FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph("Total Earned: " + (in - out), FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK))); document.add(new Paragraph(" ")); document.add(new Paragraph( "--------------------------------------------------------------------------------------")); document.close(); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "problem in memoo"); } /////////////////////////// //to open pdf invoice try { Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler " + "E:\\Reports\\report(" + date + ").pdf"); } catch (IOException ex) { Logger.getLogger(SellPage.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:frames.main.java
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) { if (PRINTMODE.getSelectedIndex() == 0) { try {// w w w . ja va 2 s. co m //mrpno=Integer.parseInt(DTFrpno.getText()); BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font1003 = new Font(unicode, 18, Font.ITALIC, new BaseColor(139, 0, 0)); Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33)); Font font1004 = new Font(unicode, 14, Font.BOLD, new BaseColor(139, 0, 0)); Font font1005 = new Font(unicode, 12, Font.UNDERLINE, new BaseColor(255, 0, 0)); Font font1006 = new Font(unicode, 9, Font.BOLDITALIC, new BaseColor(101, 67, 33)); Rectangle rect = new RectangleReadOnly(590, 470, 0); ///////////////////////////////////// Font font100 = new Font(unicode, 10, Font.ITALIC, BaseColor.BLUE); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("REGISTRATION.pdf")); document.setPageSize(rect); document.open(); // PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(115f, 115f); image2.setAbsolutePosition(2, 350); document.add(image2); document.add(new Chunk( " ", font100)); document.add(new Chunk("RECEIPT", font1005)); //document.add(p); // document.add(new Paragraph( )); document.add(new Paragraph( " SMART KID CONVENT SCHOOL ", font1003)); // document.add(new Chunk(" SMART KID CONVENT SCHOOL ",font1003)); // document.add(new Chunk(" 413A/23,HEERA NAGAR GURGAON. ",font100)); document.add(new Paragraph( " 413A/23,HEERA NAGAR GURGAON. ", font100)); // document.add(new Chunk(" ph:9911752900,9891929835 ",font100)); document.add(new Paragraph( " ph:9911752900,9891929835 ", font100)); // document.add(new Chunk(" E-mail:info.smartkids@gmail.com",FontFactory.getFont(FontFactory.COURIER,9,Font.BOLDITALIC,BaseColor.DARK_GRAY))); document.add(new Paragraph(" E-mail:info.smartkids@gmail.com", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLDITALIC, BaseColor.DARK_GRAY))); document.add(new Paragraph(" ")); PdfPTable table1 = new PdfPTable(4); PdfPCell c = new PdfPCell(new Paragraph("STUDENT PARTICULARS")); c.setColspan(4); c.setBackgroundColor(BaseColor.GREEN); c.setHorizontalAlignment(Element.ALIGN_CENTER); table1.addCell(c); table1.addCell("Student Name:"); table1.addCell(new PdfPCell(new Paragraph(Dtf2.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Class:"); table1.addCell(new Paragraph((String) Dtf5.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Section:"); table1.addCell(new Paragraph((String) Dtf22.getText() + " " + "Phone.:" + Dtf20.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Registration No:"); table1.addCell(new PdfPCell(new Paragraph(Dtf1.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Session:"); table1.addCell(new Paragraph("NA", FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Month:"); table1.addCell(new Paragraph((String) Djc1.getSelectedItem(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); float[] ColumnWidths1 = new float[] { 12f, 19f, 10f, 24f }; table1.setWidths(ColumnWidths1); table1.setWidthPercentage(113); document.add(table1); // document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(5); PdfPCell cc = new PdfPCell(new Paragraph("FEE INFORMATION")); cc.setBackgroundColor(BaseColor.GREEN); cc.setHorizontalAlignment(Element.ALIGN_CENTER); cc.setColspan(5); table.addCell(cc); PdfPCell cell99 = new PdfPCell(new Paragraph("Sl No", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell90 = new PdfPCell(new Paragraph("Particulars", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell91 = new PdfPCell(new Paragraph("Cash", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell92 = new PdfPCell(new Paragraph("Cheque", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell93 = new PdfPCell(new Paragraph("Total", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell99); table.addCell(cell90); table.addCell(cell91); table.addCell(cell92); table.addCell(cell93); table.addCell("1"); PdfPCell cell1 = new PdfPCell(new Paragraph("Registration Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell1); table.addCell(Dtf11.getText()); table.addCell(" "); table.addCell(" "); table.addCell("2"); PdfPCell cell2 = new PdfPCell(new Paragraph("Admission/Re admission fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell2); table.addCell(Dtf12.getText()); table.addCell(" "); table.addCell(" "); table.addCell("3"); PdfPCell cell3 = new PdfPCell(new Paragraph("Building fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell3); table.addCell(Dtf13.getText()); table.addCell(" "); table.addCell(" "); table.addCell("4"); PdfPCell cell4 = new PdfPCell(new Paragraph("Annual Charge", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell4); table.addCell(Dtf14.getText()); table.addCell(" "); table.addCell(" "); table.addCell("5"); PdfPCell cell14 = new PdfPCell(new Paragraph("Security (Refundable)", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell14); table.addCell(Dtf17.getText()); table.addCell(" "); table.addCell(" "); table.addCell("6"); PdfPCell cell5 = new PdfPCell(new Paragraph("Tution", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell5); table.addCell(Dtf6.getText()); table.addCell(" "); table.addCell(" "); table.addCell("7"); PdfPCell cell6 = new PdfPCell(new Paragraph("Total pupils fund", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell6); table.addCell(Dtf16.getText()); table.addCell(" "); table.addCell(" "); table.addCell("8"); PdfPCell cell7 = new PdfPCell(new Paragraph("Computer Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell7); table.addCell(Dtf7.getText()); table.addCell(" "); table.addCell(" "); table.addCell("9"); PdfPCell cell8 = new PdfPCell(new Paragraph("Sports Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell8); table.addCell(Dtf15.getText()); table.addCell(" "); table.addCell(" "); table.addCell("10"); PdfPCell cell9 = new PdfPCell(new Paragraph("House exam Fee", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell9); table.addCell(Dtf8.getText()); table.addCell(" "); table.addCell(" "); table.addCell("11"); PdfPCell cell10 = new PdfPCell(new Paragraph("Conveyance Charge", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell10); table.addCell(Dtf18.getText()); table.addCell(" "); //table.addCell(" "); table.addCell(""); PdfPCell cell12 = new PdfPCell(new Paragraph("12", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); PdfPCell cell13 = new PdfPCell(new Paragraph("Grand Total", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); table.addCell(cell12); table.addCell(cell13); table.addCell( String.valueOf((Integer.parseInt(Dtf11.getText())) + (Integer.parseInt(Dtf12.getText())) + (Integer.parseInt(Dtf13.getText())) + (Integer.parseInt(Dtf14.getText())) + (Integer.parseInt(Dtf17.getText())) + (Integer.parseInt(Dtf6.getText())) + (Integer.parseInt(Dtf16.getText())) + (Integer.parseInt(Dtf7.getText())) + (Integer.parseInt(Dtf15.getText())) + (Integer.parseInt(Dtf8.getText())) + (Integer.parseInt(Dtf18.getText())) + (Integer.parseInt(Dtf9.getText())))); float[] ColumnWidths = new float[] { 8f, 25f, 11f, 10f, 10f }; table.setWidths(ColumnWidths); table.setWidthPercentage(113); table.completeRow(); document.add(table); document.add(new Chunk( "# Fee once paid is not refundable . For Smart kid convent school Signature ")); //document.add(new Chunk("# The monthly fee has to be deposited before 10th of every month Signature ")); JOptionPane.showMessageDialog(this, "receipt printed.."); Dtf21.setText(String.valueOf(Integer.parseInt(Dtf21.getText()) + 1)); document.close(); ; } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } } else if (PRINTMODE.getSelectedIndex() == 1) { try { //mrpno=Integer.parseInt(DTFrpno.getText()); BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font1003 = new Font(unicode, 18, Font.ITALIC, new BaseColor(139, 0, 0)); Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33)); Font font1004 = new Font(unicode, 14, Font.BOLD, new BaseColor(139, 0, 0)); Font font1005 = new Font(unicode, 12, Font.UNDERLINE, new BaseColor(255, 0, 0)); Font font1006 = new Font(unicode, 9, Font.BOLDITALIC, new BaseColor(101, 67, 33)); Rectangle rect = new RectangleReadOnly(590, 460, 0); ///////////////////////////////////// Font font100 = new Font(unicode, 10, Font.ITALIC, BaseColor.BLUE); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Feeslipp(MONTHLY).pdf")); document.setPageSize(rect); document.open(); // PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(115f, 115f); image2.setAbsolutePosition(2, 350); document.add(image2); Paragraph p = new Paragraph(); p.add(new Chunk(" ")); //p.add(new Chunk("RECEIPT",font1005)); //document.add(p); document.add(new Chunk(" RECEIPT", font1003)); document.add(new Paragraph(" SMART KID CONVENT SCHOOL ", font1003)); // document.add(new Chunk(" SMART KID CONVENT SCHOOL ",font1003)); // document.add(new Chunk(" 413A/23,HEERA NAGAR GURGAON. ",font100)); document.add(new Paragraph( " 413A/23,HEERA NAGAR GURGAON. ", font100)); // document.add(new Chunk(" ph:9911752900,9891929835 ",font100)); document.add(new Paragraph( " ph:9911752900,9891929835 ", font100)); // document.add(new Chunk(" E-mail:info.smartkids@gmail.com",FontFactory.getFont(FontFactory.COURIER,9,Font.BOLDITALIC,BaseColor.DARK_GRAY))); document.add(new Paragraph(" E-mail:info.smartkids@gmail.com", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLDITALIC, BaseColor.DARK_GRAY))); document.add(new Paragraph(" ")); PdfPTable table1 = new PdfPTable(4); PdfPCell c = new PdfPCell(new Paragraph("STUDENT PARTICULARS")); c.setColspan(4); c.setBackgroundColor(BaseColor.GREEN); c.setHorizontalAlignment(Element.ALIGN_CENTER); table1.addCell(c); table1.addCell("Student Name:"); table1.addCell(new PdfPCell(new Paragraph(Dtf2.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Class:"); table1.addCell(new Paragraph(Dtf5.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Section:"); table1.addCell(new Paragraph(Dtf21.getText() + " " + "Phone.:" + Dtf20.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); table1.addCell("Registration No:"); table1.addCell(new PdfPCell(new Paragraph(Dtf1.getText(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN)))); table1.addCell("Month:"); table1.addCell(new Paragraph((String) Djc1.getSelectedItem(), FontFactory.getFont(FontFactory.COURIER, 12, Font.BOLDITALIC, BaseColor.GREEN))); float[] ColumnWidths1 = new float[] { 12f, 19f, 10f, 24f }; table1.setWidths(ColumnWidths1); table1.setWidthPercentage(113); document.add(table1); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(5); PdfPCell cc = new PdfPCell(new Paragraph("FEE INFORMATION")); cc.setBackgroundColor(BaseColor.GREEN); cc.setHorizontalAlignment(Element.ALIGN_CENTER); cc.setColspan(5); table.addCell(cc); PdfPCell cell99 = new PdfPCell(new Paragraph("Sl No", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell90 = new PdfPCell(new Paragraph("Particulars", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell91 = new PdfPCell(new Paragraph("Cash", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell92 = new PdfPCell(new Paragraph("Cheque", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); PdfPCell cell93 = new PdfPCell(new Paragraph("Total", FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell99); table.addCell(cell90); table.addCell(cell91); table.addCell(cell92); table.addCell(cell93); table.addCell("1"); PdfPCell cell1 = new PdfPCell(new Paragraph("TUITION FEE", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell1); table.addCell(Dtf6.getText()); table.addCell(" "); table.addCell(" "); table.addCell("2"); PdfPCell cell2 = new PdfPCell(new Paragraph("COMPUTER FEE", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell2); table.addCell(Dtf7.getText()); table.addCell(" "); table.addCell(" "); table.addCell("3"); PdfPCell cell5 = new PdfPCell(new Paragraph("HOUSE EXAM FEE", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell5); table.addCell(Dtf8.getText()); table.addCell(" "); table.addCell(" "); table.addCell("4"); PdfPCell cell6 = new PdfPCell(new Paragraph("FINES", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell6); table.addCell(Dtf9.getText()); table.addCell(" "); table.addCell(" "); table.addCell("5"); PdfPCell cell7 = new PdfPCell(new Paragraph("OTHERS", FontFactory.getFont(FontFactory.COURIER, 9, Font.NORMAL, BaseColor.BLACK))); table.addCell(cell7); table.addCell(Dtf10.getText()); table.addCell(" "); table.addCell(""); PdfPCell cell9 = new PdfPCell(new Paragraph("6", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); PdfPCell cell8 = new PdfPCell(new Paragraph("Grand Total", FontFactory.getFont(FontFactory.COURIER, 9, Font.BOLD, BaseColor.BLACK))); table.addCell(cell7); table.addCell(cell8); table.addCell(String.valueOf((Integer.parseInt(Dtf6.getText())) + (Integer.parseInt(Dtf7.getText())) + (Integer.parseInt(Dtf8.getText())) + (Integer.parseInt(Dtf9.getText())) + (Integer.parseInt(Dtf10.getText())))); float[] ColumnWidths = new float[] { 8f, 25f, 11f, 10f, 10f }; table.setWidths(ColumnWidths); table.setWidthPercentage(113); table.completeRow(); document.add(table); document.add(new Chunk( "# Fee once paid is not refundable . For smart kid convent School ")); document.add(new Chunk( "# The monthly fee has to be deposited before 10th of every month Signature ")); JOptionPane.showMessageDialog(this, "receipt printed.."); Dtf21.setText(String.valueOf(Integer.parseInt(Dtf21.getText()) + 1)); document.close(); ; } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } } // TODO add your handling code here: }
From source file:helpers.PDFHeaderFooter.java
@Override public void onEndPage(PdfWriter writer, Document document) { Rectangle rect = writer.getBoxSize("art"); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(""), rect.getLeft(), rect.getBottom(), 0);//from ww w . ja v a 2s . c om ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("Copyright @" + new SetDateCreated().getYear() + " (Wellington Mapiku)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.ITALIC, BaseColor.DARK_GRAY)), rect.getRight(), rect.getBottom(), 0); }
From source file:library.Report.java
public void createPdf(String filename) throws DocumentException, IOException { // step 1/*from w w w .jav a2s. c o m*/ Document document = new Document(); // step 2 PdfWriter.getInstance(document, new FileOutputStream(filename)); document.addAuthor("Admin"); document.addTitle("Library report"); document.setPageSize(PageSize.A4); document.setMargins(36, 72, 108, 180); document.setMarginMirroring(true); document.open(); Font normal = new Font(Font.FontFamily.HELVETICA, 36f, Font.NORMAL, BaseColor.DARK_GRAY); Font normal1 = new Font(Font.FontFamily.HELVETICA, 18f, Font.NORMAL); Font normal2 = new Font(Font.FontFamily.HELVETICA, 12f, Font.NORMAL); document.add(new Paragraph("KNOWLEDGICA LIBRARY REPORT", normal)); document.add(new Phrase("\n")); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()); document.add(new Paragraph(timeStamp, normal1)); document.add(new Paragraph("Amount of books " + DF.getText() + "\nAmount of Amount of checked in books " + jTextField1.getText() + "\nAmount of checked out books " + jTextField3.getText() + "" + "\nNunber of users " + jTextField4.getText() + "\nNumber of admins " + jTextField5.getText() + "\nNumber of librarians " + jTextField6.getText() + "\nNumber of guest " + jTextField7.getText() + "\nMost logged user " + jTextField8.getText() + "\nAmount of males " + jTextField9.getText() + "\nAmount of female " + jTextField10.getText() + "", normal2)); document.close(); }
From source file:login.DigiHoInitial.java
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed // TODO add your handling code here: Calendar timer = Calendar.getInstance(); timer.getTime();/*from w ww .ja v a 2s.c o m*/ SimpleDateFormat Tdate = new SimpleDateFormat("dd-MMM-yyy"); jTextField17.setText(Tdate.format(timer.getTime())); jLabel15.setText(""); Random rand = new Random(); int number, number1; number = rand.nextInt(8999); number1 = 1000 + number; jTextField11.setText(jTextField11.getText() + number1); Document doc = new Document(); try { PdfWriter.getInstance(doc, new FileOutputStream("f:\\DiGiho\\Registration Form\\" + jTextField11.getText() + ".pdf")); doc.open(); Paragraph para = new Paragraph(); doc.add(new Paragraph("\n", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.DARK_GRAY))); doc.add(new Paragraph("\n\n\n\n\n\n\n\n\n\n")); doc.add(new Phrase("Customer ID ")); doc.add(new Phrase(jTextField11.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase(" Date " + jTextField17.getText() + " \n\n")); doc.add(new Phrase("Name:- ")); doc.add(new Phrase(jTextField5.getText() + ". " + jTextField6.getText() + " " + jTextField1.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nFather's Name:- ")); doc.add(new Phrase(jTextField2.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nAddress ")); doc.add(new Phrase(jTextField3.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nBlock ")); doc.add(new Phrase(jTextField16.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase(" District ")); doc.add(new Phrase(jTextField10.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nCity ")); doc.add(new Phrase(jTextField15.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase(" Pin Code ")); doc.add(new Phrase(jTextField9.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase()); doc.add(new Phrase("\nState ")); doc.add(new Phrase(jTextField14.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase(" Date of Birth ")); doc.add(new Phrase(jTextField12.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nMoblie No. ")); doc.add(new Phrase(jTextField7.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase(" Phone No. ")); doc.add(new Phrase(jTextField13.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase()); doc.add(new Phrase("\nEmail address ")); doc.add(new Phrase(jTextField8.getText(), FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(new Phrase("\nOccupation: ")); doc.add(new Phrase(a, FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.BOLD, BaseColor.BLACK))); doc.add(para); doc.add(new Phrase( " \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n " + jTextField6.getText() + " " + jTextField1.getText())); doc.close(); } catch (DocumentException e) { e.printStackTrace(); } catch (FileNotFoundException ex) { Logger.getLogger(DigiHoInitial.class.getName()).log(Level.SEVERE, null, ex); } JOptionPane.showMessageDialog(null, "File has been created", "deeps message", JOptionPane.PLAIN_MESSAGE); }
From source file:net.sf.texprinter.generators.PDFGenerator.java
License:Open Source License
/** * Generates a PDF file from a Question object. * //from w w w . j a va 2 s . c o m * @param question The question. * @param filename The filename. */ public static void generate(Question question, String filename) { // wait window ProgressMessage pm = new ProgressMessage("TeXPrinter is printing your PDF file."); // start wait window //pm.start(); // log message log.log(Level.INFO, "Starting PDF generation of {0}.", filename); // define a new PDF document Document document = null; // define a new PDF writer PdfWriter writer = null; // lets try try { // create a new PDF document document = new Document(); // define a new PDF Writer writer = PdfWriter.getInstance(document, new FileOutputStream(filename)); // set the PDF version writer.setPdfVersion(PdfWriter.VERSION_1_6); // open the document document.open(); // set the title font Font titleFont = new Font(FontFamily.HELVETICA, 16, Font.BOLD, BaseColor.BLACK); // set the chunk for the question title Chunk questionTitle = new Chunk(question.getQuestion().getTitle(), titleFont); // create a paragraph from that chunk Paragraph paragraphQuestionTitle = new Paragraph(questionTitle); // log message log.log(Level.INFO, "Adding the question title."); // add the question title to the document document.add(paragraphQuestionTitle); // set the asker font Font askerFont = new Font(FontFamily.HELVETICA, 10, Font.ITALIC, BaseColor.DARK_GRAY); // set the chunk for the asker Chunk questionAsker = new Chunk("Asked by " + question.getQuestion().getUser().getName() + " (" + question.getQuestion().getUser().getReputation() + ") on " + question.getQuestion().getDate() + " (" + String.valueOf(question.getQuestion().getVotes()) + (question.getQuestion().getVotes() == 1 ? " vote" : " votes") + ")", askerFont); // create a paragraph from that chunk Paragraph paragraphQuestionAsker = new Paragraph(questionAsker); // log message log.log(Level.INFO, "Adding both asker and reputation."); // add the asker to the document document.add(paragraphQuestionAsker); // create a line separator LineSeparator line = new LineSeparator(1, 100, null, Element.ALIGN_CENTER, -5); // add the line to the document document.add(line); // add a new line document.add(Chunk.NEWLINE); // create a list of elements from the question objects List<Element> questionTextObjects = getPostText(question.getQuestion().getText()); // log message log.log(Level.INFO, "Adding the question text."); // for each element for (Element questionTextObject : questionTextObjects) { // add it to the document document.add(questionTextObject); } // add a new line document.add(Chunk.NEWLINE); // create a new font for the comments title Font commentsTitleFont = new Font(FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.BLACK); // create a new chunk based on that font Chunk commentsTitle = new Chunk( "This question has " + question.getQuestion().getComments().size() + ((question.getQuestion().getComments().size() == 1) ? " comment:" : " comments:"), commentsTitleFont); // create a paragraph from that chunk Paragraph paragraphCommentsTitle = new Paragraph(commentsTitle); // if there are comments to this question if (!question.getQuestion().getComments().isEmpty()) { // log message log.log(Level.INFO, "Adding the question comments."); // add that paragraph to the document document.add(paragraphCommentsTitle); // add a new line document.add(Chunk.NEWLINE); // get all the comments List<Comment> questionComments = question.getQuestion().getComments(); // for each comment for (Comment questionComment : questionComments) { // get the elements of the comment text List<Element> questionCommentObjects = getPostText(questionComment.getText()); // for each element for (Element questionCommentObject : questionCommentObjects) { // add it to the document document.add(questionCommentObject); } // create a new paragraph about the comment author Paragraph paragraphCommentAuthor = new Paragraph(questionComment.getAuthor() + " on " + questionComment.getDate() + " (" + String.valueOf(questionComment.getVotes()) + (questionComment.getVotes() == 1 ? " vote" : " votes") + ")", askerFont); // set the alignment to the right paragraphCommentAuthor.setAlignment(Element.ALIGN_RIGHT); // add the paragraph to the document document.add(paragraphCommentAuthor); // add a new line document.add(Chunk.NEWLINE); } } // add a line separator document.add(line); // add two new lines document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); // get the list of answers List<Post> answersList = question.getAnswers(); // if there are no answers if (answersList.isEmpty()) { // log message log.log(Level.INFO, "This question has no answers."); // create a new chunk Chunk noAnswersTitle = new Chunk("Sorry, this question has no answers yet.", titleFont); // create a paragraph from that chunk Paragraph paragraphNoAnswersTitle = new Paragraph(noAnswersTitle); // add the paragraph to the document document.add(paragraphNoAnswersTitle); } else { // log message log.log(Level.INFO, "Adding answers."); // there are answers, so create a counter for answers int answerCount = 1; // for each answer for (Post answer : answersList) { // log message log.log(Level.INFO, "Adding answer {0}.", answerCount); // set the message text as empty String answerAccepted = ""; // if the answer is accepted if (answer.isAccepted()) { // add that to the message answerAccepted = " - Marked as accepted."; } // create a new chunk Chunk answerTitle = new Chunk("Answer #" + answerCount, titleFont); // create a paragraph from that chunk Paragraph paragraphAnswerTitle = new Paragraph(answerTitle); // add the paragraph to the document document.add(paragraphAnswerTitle); // increase the counter answerCount++; // create a new chunk Chunk questionAnswerer = new Chunk("Answered by " + answer.getUser().getName() + " (" + answer.getUser().getReputation() + ") on " + answer.getDate() + answerAccepted + " (" + String.valueOf(answer.getVotes()) + (answer.getVotes() == 1 ? " vote" : " votes") + ")", askerFont); // create a paragraph from that chunk Paragraph paragraphQuestionAnswerer = new Paragraph(questionAnswerer); // add that paragraph to the document document.add(paragraphQuestionAnswerer); // add a line separator document.add(line); // add a new line document.add(Chunk.NEWLINE); // create a list of elements from the answer text List<Element> answerTextObjects = getPostText(answer.getText()); // for each element for (Element answerTextObject : answerTextObjects) { // add it to the document document.add(answerTextObject); } // add a new line document.add(Chunk.NEWLINE); // create a new font style Font answerCommentsTitleFont = new Font(FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.BLACK); // create a new chunk Chunk answerCommentsTitle = new Chunk( "This answer has " + answer.getComments().size() + ((answer.getComments().size() == 1) ? " comment:" : " comments:"), answerCommentsTitleFont); // create a paragraph from that chunk Paragraph paragraphAnswerCommentsTitle = new Paragraph(answerCommentsTitle); // if there are comments for that answer if (!answer.getComments().isEmpty()) { // log message log.log(Level.INFO, "Adding comments for answer {0}.", (answerCount - 1)); // add that paragraph to the document document.add(paragraphAnswerCommentsTitle); // add a new line document.add(Chunk.NEWLINE); // get all the comments List<Comment> answerComments = answer.getComments(); // for each comment for (Comment answerComment : answerComments) { // create a list of elements from the comment text List<Element> answerCommentObjects = getPostText(answerComment.getText()); // for each element for (Element answerCommentObject : answerCommentObjects) { // add it to the document document.add(answerCommentObject); } // create a new paragraph for the comment author Paragraph paragraphAnswerCommentAuthor = new Paragraph( answerComment.getAuthor() + " on " + answerComment.getDate() + " (" + String.valueOf(answerComment.getVotes()) + (answerComment.getVotes() == 1 ? " vote" : " votes") + ")", askerFont); // set the aligment to the right paragraphAnswerCommentAuthor.setAlignment(Element.ALIGN_RIGHT); // add the paragraph to the document document.add(paragraphAnswerCommentAuthor); // add a new line document.add(Chunk.NEWLINE); } } // add a line separator document.add(line); // add two new lines document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); } } // log message log.log(Level.INFO, "PDF generation complete, closing {0}.", filename); // close the document document.close(); // stop wait window pm.interrupt(); } catch (IOException ioexception) { // stop wait window pm.interrupt(); // log message log.log(Level.SEVERE, "An IO error occurred while trying to create the PDF file. MESSAGE: {0}", StringUtils.printStackTrace(ioexception)); // critical error, exit Dialogs.showExceptionWindow(); } catch (Exception exception) { // log message log.log(Level.SEVERE, "A generic error occurred while trying to create the PDF file. MESSAGE: {0}", StringUtils.printStackTrace(exception)); // log message log.log(Level.INFO, "I will try to remove the remaining PDF file."); try { // log message log.log(Level.INFO, "Closing both document and writer."); // close the document document.close(); // close the writer writer.close(); } catch (Exception ex) { // log message log.log(Level.WARNING, "I could not close either document or writer. MESSAGE: {0}", StringUtils.printStackTrace(ex)); } try { // reference problematic file File target = new File(filename); // log message log.log(Level.INFO, "Opening problematic file {0}.", filename); // check if file exists if (target.exists()) { // log message log.log(Level.INFO, "File exists, trying to delete it."); // trying to remove it if (target.delete()) { // log message log.log(Level.INFO, "File {0} was successfully removed.", filename); } else { // log message log.log(Level.SEVERE, "File {0} could not be removed.", filename); } } } catch (SecurityException se) { // log message log.log(Level.SEVERE, "A security exception was raised. MESSAGE: {0}", StringUtils.printStackTrace(se)); } // stop wait window pm.interrupt(); // critical error, exit Dialogs.showExceptionWindow(); } }
From source file:org.jfree.chart.swt.ChartPdf.java
License:Open Source License
public static void saveChartAsPDF(File file, JFreeChart chart, int width, int height) throws DocumentException, FileNotFoundException, IOException { if (chart != null) { boolean success = false; String old = null;/*from ww w.ja v a 2 s .c o m*/ File oldFile = null; boolean append = file.exists(); if (append) { old = file.getAbsolutePath() + ".old"; //$NON-NLS-1$ oldFile = new File(old); oldFile.delete(); file.renameTo(oldFile); } try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { // convert chart to PDF with iText: Rectangle pagesize = new Rectangle(width, height); if (append) { PdfReader reader = new PdfReader(old); PdfStamper stamper = new PdfStamper(reader, out); try { int n = reader.getNumberOfPages() + 1; stamper.insertPage(n, pagesize); PdfContentByte overContent = stamper.getOverContent(n); writeChart(chart, width, height, overContent); ColumnText ct = new ColumnText(overContent); ct.setSimpleColumn(width - 50, 50, width - 12, height, 150, Element.ALIGN_RIGHT); Paragraph paragraph = new Paragraph(String.valueOf(n), new Font(FontFamily.HELVETICA, 9, Font.NORMAL, BaseColor.DARK_GRAY)); paragraph.setAlignment(Element.ALIGN_RIGHT); ct.addElement(paragraph); ct.go(); success = true; } finally { stamper.close(); reader.close(); oldFile.delete(); } } else { Document document = new Document(pagesize, 50, 50, 50, 50); document.addCreationDate(); document.addCreator(Constants.APPLICATION_NAME); document.addAuthor(System.getProperty("user.name")); //$NON-NLS-1$ try { PdfWriter writer = PdfWriter.getInstance(document, out); document.open(); writeChart(chart, width, height, writer.getDirectContent()); success = true; } finally { document.close(); } } } if (!success) { file.delete(); if (oldFile != null) oldFile.renameTo(file); } } }
From source file:pdf.PDFDesign.java
public PDFDesign(String s, String c, String sn, Map<String, String> fontMap) { size = s;/*from w w w .ja va 2 s . c o m*/ titleLineFixedHeight = 15.0f; priceFontInc = 0; textFontInc = 0; styleName = sn; fontPaths = new FontPaths(fontMap); nColumns = 6; switch (c) { case "black": color = BaseColor.BLACK; break; case "gray": color = BaseColor.DARK_GRAY; break; case "red": color = BaseColor.RED.darker(); break; case "green": color = BaseColor.GREEN.darker().darker().darker(); break; case "blue": color = BaseColor.BLUE.darker().darker().darker(); break; default: this.color = BaseColor.BLACK; } switch (size) { case "3x5": cellHeight = 83.8f; break; case "3.5x5": cellHeight = 97.8f; break; case "3.5x6": priceFontInc = 8; cellHeight = 97.8f; nColumns = 5; break; case "3.5x7": cellHeight = 97.8f; nColumns = 4; break; case "4x6": titleLineFixedHeight = 26.0f; priceFontInc = 8; cellHeight = 117.0f; nColumns = 5; break; case "4x7": titleLineFixedHeight = 26.0f; priceFontInc = 8; cellHeight = 117.0f; nColumns = 4; break; case "5x6": titleLineFixedHeight = 30.0f; priceFontInc = 13; textFontInc = 2; cellHeight = 145.0f; nColumns = 5; break; case "5x7": titleLineFixedHeight = 30.0f; priceFontInc = 18; textFontInc = 3; cellHeight = 145.0f; nColumns = 4; break; case "6x7": titleLineFixedHeight = 34.0f; priceFontInc = 26; textFontInc = 5; cellHeight = 175.0f; nColumns = 4; break; } try { int normal = Font.NORMAL; int bold = Font.BOLD; droidsans = BaseFont.createFont(fontPaths.getPath("droidsans"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); BaseFont impact = BaseFont.createFont(fontPaths.getPath("impact"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); switch (styleName) { case "style1": BaseFont courier = BaseFont.createFont(fontPaths.getPath("courier"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); initValues(42f, new Font(courier, 12 + textFontInc, normal, color), new Font(courier, 9 + textFontInc, normal, color), new Font(impact, 43 + priceFontInc + textFontInc, normal, color), new Font(courier, 20 + textFontInc, normal, color), new Font(courier, 8 + textFontInc, normal, color)); break; case "style2": BaseFont digital7 = BaseFont.createFont(fontPaths.getPath("digital7"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); initValues(42f, new Font(droidsans, 10 + textFontInc, normal, color), new Font(droidsans, 7 + textFontInc, normal, color), new Font(digital7, 55 + priceFontInc + textFontInc, normal, color), new Font(digital7, 30, normal, color), new Font(droidsans, 7 + textFontInc, normal, color)); break; case "style3": BaseFont modern = BaseFont.createFont(fontPaths.getPath("modern"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); initValues(40f, new Font(droidsans, 10 + textFontInc, normal, color), new Font(droidsans, 7 + textFontInc, normal, color), new Font(modern, 55 + priceFontInc + textFontInc, normal, color), new Font(modern, 30, normal, color), new Font(droidsans, 7 + textFontInc, normal, color)); break; case "style4": BaseFont gothic = BaseFont.createFont(fontPaths.getPath("gothic"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); initValues(40f, new Font(droidsans, 10 + textFontInc, normal, color), new Font(droidsans, 7 + textFontInc, normal, color), new Font(gothic, 48 + priceFontInc + textFontInc, bold, color), new Font(gothic, 30, bold, color), new Font(droidsans, 7 + textFontInc, normal, color)); break; case "style5": BaseFont bookman = BaseFont.createFont(fontPaths.getPath("bookman"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); initValues(35f, new Font(droidsans, 10 + textFontInc, normal, color), new Font(droidsans, 7 + textFontInc, normal, color), new Font(bookman, 45 + priceFontInc + textFontInc, bold, color), new Font(bookman, 25, normal, color), new Font(droidsans, 7 + textFontInc, normal, color)); break; case "style6": initValues(45f, new Font(droidsans, 10 + textFontInc, normal, color), new Font(droidsans, 7 + textFontInc, normal, color), new Font(impact, 45 + priceFontInc + textFontInc, normal, color), new Font(droidsans, 20 + textFontInc, normal, color), new Font(droidsans, 7 + textFontInc, normal, color)); break; default: System.out.println("[*] Unknown Style"); break; } } catch (DocumentException | IOException ex) { System.out.println("[E] " + ex.getMessage()); } }