List of usage examples for com.itextpdf.text Font BOLDITALIC
int BOLDITALIC
To view the source code for com.itextpdf.text Font BOLDITALIC.
Click Source Link
From source file:de.domjos.schooltools.core.utils.fileUtils.PDFBuilder.java
License:Open Source License
public void addFont(String key, Font.FontFamily fontFamily, float size, boolean bold, boolean italic, BaseColor color) {/* w ww .j av a2s.c o m*/ if (bold) { if (italic) { this.fonts.put(key, new Font(fontFamily, size, Font.BOLDITALIC, color)); } else { this.fonts.put(key, new Font(fontFamily, size, Font.BOLD, color)); } } else { if (italic) { this.fonts.put(key, new Font(fontFamily, size, Font.ITALIC, color)); } else { this.fonts.put(key, new Font(fontFamily, size, Font.NORMAL, color)); } } }
From source file:de.domjos.schooltools.core.utils.fileUtils.PDFBuilder.java
License:Open Source License
public void addTable(List<String> headers, float[] headerWidth, List<List<Map.Entry<String, BaseColor>>> cells) throws Exception { PdfPTable table = new PdfPTable(headers.size()); if (headerWidth != null) { table.setWidths(headerWidth);/* w w w . j av a 2 s . c o m*/ } for (String header : headers) { PdfPCell cell = new PdfPCell( new Phrase(header, new Font(Font.FontFamily.HELVETICA, 18, Font.BOLDITALIC))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); } for (List<Map.Entry<String, BaseColor>> row : cells) { for (Map.Entry<String, BaseColor> cellItem : row) { PdfPCell cell = new PdfPCell( new Phrase(cellItem.getKey(), new Font(Font.FontFamily.HELVETICA, 14, Font.NORMAL))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(cellItem.getValue()); table.addCell(cell); } } this.document.add(table); }
From source file:de.extra.xtt.util.pdf.PdfCreatorImpl.java
License:Apache License
private Phrase getPhraseChapterItalic(String text) { return new Phrase(text, FontFactory.getFont(fontNameStandard, fontSizeChapter, Font.BOLDITALIC)); }
From source file:de.knurt.heinzelmann.util.itext.TextBlock.java
License:Creative Commons License
private List<Chunk> getChunks(String content) { Font italic = new Font(this.font); italic.setStyle(Font.ITALIC); Font normal = new Font(this.font); normal.setStyle(Font.NORMAL); Font bold = new Font(this.font); bold.setStyle(Font.BOLD);//from ww w . j a v a 2 s . c o m Font bolditalic = new Font(this.font); bolditalic.setStyle(Font.BOLDITALIC); Font markfont = null; boolean markModus = false; List<Chunk> result = new ArrayList<Chunk>(); List<Chunk> tmp = new ArrayList<Chunk>(); StringTokenizer tokenizer = new StringTokenizer(content, "\\*", true); while (tokenizer.hasMoreTokens()) { String tok = tokenizer.nextToken(); if (tok.equals("*")) { if (markModus) { if (markfont.getStyle() == Font.ITALIC) { markfont = bold; } else { markfont = bolditalic; } } else { if (markfont == null) { markfont = italic; markModus = true; } else if (markfont.getStyle() == Font.BOLDITALIC) { markfont = bold; } else if (markfont.getStyle() == Font.BOLD) { markfont = italic; } else if (markfont.getStyle() == Font.ITALIC) { markfont = null; } } continue; } if (markfont != null) { tmp.add(new Chunk(tok, markfont)); markModus = false; } else { tmp.add(new Chunk(tok, normal)); } } result.addAll(tmp); return result; }
From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java
License:Open Source License
public PDFDocument(String authorName, Map<String, Integer> yearToPublicationCount, Document document, PdfWriter pdfWriter) {//from ww w .j a va2 s . c o m // setPreferredSize(new Dimension(600,400)); try { document.addTitle("PDF Pipeline iText Prototype"); document.addAuthor(authorName); document.addSubject("This example tests text, color, image, transparency & table functionality."); document.addKeywords("text, color, image, transparency, table"); document.addCreator("Standalone PDF Renderer using iText"); Paragraph header = new Paragraph(); Font pageHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLDITALIC | Font.UNDERLINE); Font featureHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, new BaseColor(Color.red)); header.add(new Chunk("PDF Pipeline Prototype v2 using iText\n", pageHeaderStyle)); header.setSpacingAfter(15f); document.add(header); Paragraph content = new Paragraph(); content.add(new Chunk("Publication Count - Author Name - " + authorName, featureHeaderStyle)); content.setSpacingAfter(15f); document.add(content); // step4 PdfPTable publicationCount = createTable(yearToPublicationCount); document.add(publicationCount); content = new Paragraph(); content.add(new Chunk("Transparency of Shapes", featureHeaderStyle)); content.setSpacingAfter(15f); document.add(content); createTransparencyShapes(document, pdfWriter); createImage(document, pdfWriter, featureHeaderStyle); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java
License:Open Source License
private PdfPTable createTable(Map<String, Integer> yearToPublicationCount) { Font normalContentStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11); Font summaryContentStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.BOLDITALIC); BaseColor summaryBackgroundColor = new BaseColor(0xEE, 0xEE, 0xEE); BaseColor headerBackgroundColor = new BaseColor(0xC3, 0xD9, 0xFF); BaseColor bodyBackgroundColor = new BaseColor(Color.white); PdfPTable table = new PdfPTable(2); table.setWidthPercentage(36.0f);//ww w. j a v a 2 s . c o m table.setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setBorderWidth(0.0f); table.setHeaderRows(2); PdfPCell cell; cell = new PdfPCell(new Phrase("Publications per year", normalContentStyle)); setTableCaptionStyle(summaryBackgroundColor, cell); table.addCell(cell); cell = new PdfPCell(new Phrase("Year", normalContentStyle)); setTableHeaderStyle(headerBackgroundColor, cell); table.addCell(cell); cell.setPhrase(new Phrase("Publications", normalContentStyle)); table.addCell(cell); setTableBodyStyle(bodyBackgroundColor, cell); int totalPublications = 0; for (Entry<String, Integer> currentEntry : yearToPublicationCount.entrySet()) { cell.setPhrase(new Phrase(currentEntry.getKey(), normalContentStyle)); table.addCell(cell); cell.setPhrase(new Phrase(currentEntry.getValue().toString(), normalContentStyle)); table.addCell(cell); totalPublications += currentEntry.getValue(); } setTableFooterStyle(summaryBackgroundColor, cell); cell.setPhrase(new Phrase("Total", summaryContentStyle)); table.addCell(cell); cell.setPhrase(new Phrase(String.valueOf(totalPublications), summaryContentStyle)); table.addCell(cell); return table; }
From source file:Evento.action.ZapisDoPdfAction.java
License:Apache License
public void createPDF(String[] imgURL, String place, String album) throws DocumentException { Document document = new Document(); Rectangle pageSize = new Rectangle(szerokosc, wysokosc); document.setPageSize(pageSize);/*from w ww .j a v a2s. c om*/ try { PdfWriter.getInstance(document, new FileOutputStream(new File(place, "nowy.pdf"))); document.open(); Image tlo = Image.getInstance(new URL(zdjecieTla)); tlo.setAbsolutePosition(0f, 0f); document.add(tlo); Paragraph preface = new Paragraph(album, new Font(FontFamily.HELVETICA, 72, Font.BOLDITALIC, new BaseColor(255, 255, 255))); preface.setAlignment(Element.ALIGN_CENTER); document.add(preface); document.newPage(); for (int i = 0; i < imgURL.length; i++) { Image tlo2 = Image.getInstance(new URL(zdjecieTla)); tlo2.setAbsolutePosition(0f, 0f); document.add(tlo2); Image image2 = Image.getInstance(new URL(imgURL[i])); if (szerokosc * 1.5f <= image2.getWidth() || wysokosc * 1.5f <= image2.getHeight()) { image2.scaleAbsolute(image2.getWidth() * 0.25f, image2.getHeight() * 0.25f); image2.setAbsolutePosition(szerokosc / 2f - (image2.getWidth() * 0.25f) / 2, wysokosc / 2 - (image2.getHeight() * 0.25f) / 2); } else if ((szerokosc * 0.8f <= image2.getWidth() || wysokosc * 0.8f <= image2.getHeight()) && (szerokosc * 1.2f >= image2.getWidth() || wysokosc * 1.2f >= image2.getHeight())) { image2.scaleAbsolute(image2.getWidth() * 0.8f, image2.getHeight() * 0.8f); image2.setAbsolutePosition(szerokosc / 2f - (image2.getWidth() * 0.8f) / 2, wysokosc / 2 - (image2.getHeight() * 0.8f) / 2); } else if ((szerokosc * 0.4f >= image2.getWidth() || wysokosc * 0.4f >= image2.getHeight()) && (szerokosc * 0.7f <= image2.getWidth() || wysokosc * 0.7f <= image2.getHeight())) { image2.scaleAbsolute(image2.getWidth() * 1.4f, image2.getHeight() * 1.4f); image2.setAbsolutePosition(szerokosc / 2f - (image2.getWidth() * 1.4f) / 2, wysokosc / 2 - (image2.getHeight() * 1.4f) / 2); } else { image2.scaleAbsolute(image2.getWidth(), image2.getHeight()); image2.setAbsolutePosition(szerokosc / 2f - (image2.getWidth()) / 2, wysokosc / 2 - (image2.getHeight()) / 2); } for (int k = 0; k <= 1000; k++) ; for (int j = 0; j <= 1000; j++) ; document.add(image2); document.newPage(); } document.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:file.PDFWriter.java
License:Open Source License
/** * Set the font styles for the PDF//from ww w. jav a 2s .c o m */ private void setFontStyles() { lineFont = new Font(FontFamily.TIMES_ROMAN); lineFontUnderline = new Font(FontFamily.TIMES_ROMAN); errorFont = new Font(FontFamily.TIMES_ROMAN); lineFontBold = new Font(FontFamily.TIMES_ROMAN); errorFontBold = new Font(FontFamily.TIMES_ROMAN); lineFontUnderline.setStyle(Font.UNDERLINE); lineFontBold.setStyle(Font.BOLD); errorFont.setStyle(Font.ITALIC); errorFontBold.setStyle(Font.BOLDITALIC); }
From source file:frames.main.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { try {/* w w w . j a va2 s. c o m*/ 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, 18, Font.BOLD, new BaseColor(139, 0, 0)); Font font1009 = new Font(unicode, 10, Font.NORMAL, new BaseColor(139, 10, 20)); Font font1005 = new Font(unicode, 18, Font.UNDERLINE, new BaseColor(101, 67, 33)); 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-FORM.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE); Font font110 = new Font(Font.FontFamily.COURIER, 14, Font.NORMAL, BaseColor.GREEN); Font font11 = new Font(Font.FontFamily.COURIER, 12, Font.NORMAL, BaseColor.GREEN); com.itextpdf.text.Image image2 = com.itextpdf.text.Image .getInstance("C:\\smart kid\\src\\frames\\logo.jpg"); image2.scaleAbsolute(115f, 115f); image2.setAbsolutePosition(3, 716); Paragraph p = new Paragraph(); document.add(image2); document.add(new Chunk(" ", font1004)); document.add(new Chunk("ADMISSION FORM", font1005)); document.add(new Paragraph(" SMART KIDS CONVENT SCHOOL", font1004)); document.add(new Paragraph( " Managed By:The Smart Kids Educational Society,")); document.add(new Paragraph( " Reg.No:-00169")); document.add(new Paragraph( " 413A/23,HEERA NAGAR,GURGAON")); document.add(new Paragraph( " MOB:-9911752900 , 9891929835")); document.add(new Paragraph( " Reg.No" + " " + Rtf8.getText())); document.add(new Paragraph( "Admission No." + " " + new Date().toString())); document.add(new Paragraph(" ")); Paragraph p1 = new Paragraph(); p1.add(new Chunk("Certified that " + "Son/Daughter of:", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p1.add(new Chunk(Rtf1.getText(), font11)); document.add(p1); document.add(new Paragraph(" ")); Paragraph p2 = new Paragraph(); p2.add(new Chunk("Father's Name :" + Rtf2.getText() + "Mob:-", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p2.add(new Chunk(Rtf2.getText(), font11)); document.add(p2); document.add(new Paragraph(" ")); Paragraph p3 = new Paragraph(); p3.add(new Chunk("Mother's Name :" + Rtf2.getText() + "Mob:-", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p3.add(new Chunk(Rtf2.getText(), font11)); document.add(p3); document.add(new Paragraph(" ")); Paragraph p4 = new Paragraph(); p4.add(new Chunk("His/Her Date of birth :" + Rtf2.getText() + "Age", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p4.add(new Chunk(Rtf2.getText(), font11)); document.add(p4); document.add(new Paragraph(" ")); Paragraph p5 = new Paragraph(); p5.add(new Chunk("Corrosponding Address :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p5.add(new Chunk("", font11)); document.add(p5); document.add(new Paragraph(" ")); Paragraph p6 = new Paragraph(); p6.add(new Chunk("Parmanent Address :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p6.add(new Chunk("", font11)); document.add(p6); document.add(new Paragraph(" ")); Paragraph p7 = new Paragraph(); p7.add(new Chunk("Previous School & result :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p7.add(new Chunk("He/She Wants Admmisiion in", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(p7); document.add(new Paragraph(" ")); Paragraph p8 = new Paragraph(); p8.add(new Chunk("Smart Kids Convent School in :", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p8.add(new Chunk("Class.He/She will always be regular and punctual to school.", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(p8); document.add(new Paragraph(" ")); Paragraph p9 = new Paragraph(); p9.add(new Chunk("Please admit him/her :" + "Signature", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); p9.add(new Chunk( " in" + "Class" + "Parents/Guardian", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(p9); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph( " Principal(Signature) Permission of Director", FontFactory.getFont(FontFactory.COURIER, 11, Font.ITALIC, BaseColor.BLACK))); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph("NOTE:- FEES WILL NOT BE REFUNDED AFTER ADMISSION.")); cb.saveState(); cb.setColorStroke(BaseColor.BLACK); cb.rectangle(2, 2, 588, 826); cb.stroke(); cb.restoreState(); JOptionPane.showMessageDialog(this, "receipt printed.."); document.close(); ; } catch (Exception ee) { JOptionPane.showMessageDialog(this, ee); } }
From source file:frames.main.java
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) { if (PRINTMODE.getSelectedIndex() == 0) { try {//w w w . ja v a 2 s .c o 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: }