List of usage examples for com.itextpdf.text Chunk Chunk
private Chunk(final Float tabInterval, final boolean isWhitespace)
From source file:GUI_Apoteker.Panel_Detil_PO.java
private Paragraph getPreface(String status) { Paragraph preface = new Paragraph(); Calendar cal = new GregorianCalendar(); String tanggal = "0"; if (cal.get(Calendar.DATE) < 0) { tanggal = "0" + cal.get(Calendar.DATE); } else {// www . j ava2s.c o m tanggal = "" + cal.get(Calendar.DATE); } int bulan = (cal.get(Calendar.MONTH)) + 1; ; int tahun = cal.get(Calendar.YEAR); preface.setAlignment(Element.ALIGN_CENTER); Chunk chunk = new Chunk("Laporan Pemesanan Obat dengan ID - PO" + po.getId_Pemesanan_obat(), font1); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Apotek 'SI-KLINIK'", font2); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Tanggal : " + po.getTgl_Pemesanan(), font3); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Nama Supplier : " + po.getNama_supplier(), font5); preface.add(Chunk.NEWLINE); preface.add(chunk); return preface; }
From source file:GUI_StafKlinik.Panel_Laporan_Keuangan.java
private Paragraph getPreface(String status) { Paragraph preface = new Paragraph(); Calendar cal = new GregorianCalendar(); String tanggal = "0"; if (cal.get(Calendar.DATE) < 0) { tanggal = "0" + cal.get(Calendar.DATE); } else {//from w ww .jav a 2s .co m tanggal = "" + cal.get(Calendar.DATE); } int bulan = (cal.get(Calendar.MONTH)) + 1; ; int tahun = cal.get(Calendar.YEAR); preface.setAlignment(Element.ALIGN_CENTER); Chunk chunk = new Chunk("Laporan Keuangan", font1); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("SI Klinik", font2); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Periode : " + tanggal1 + " s/d " + tanggal2, font3); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Diambil pada tanggal " + tanggal + "/" + bulan + "/" + tahun, font5); preface.add(Chunk.NEWLINE); preface.add(chunk); return preface; }
From source file:GUI_StafKlinik.Panel_Penggajian.java
private Paragraph getPreface(String status) { lk = new Laporan_Keuangan(); Paragraph preface = new Paragraph(); Calendar cal = new GregorianCalendar(); String tanggal = "0"; if (cal.get(Calendar.DATE) < 0) { tanggal = "0" + cal.get(Calendar.DATE); } else {//from ww w . ja v a 2 s . c o m tanggal = "" + cal.get(Calendar.DATE); } int bulan = (cal.get(Calendar.MONTH)) + 1; ; int tahun = cal.get(Calendar.YEAR); String id1 = lk.getId(); String id2 = p.getIdPegawai(); String id = id = id1 + id2; preface.setAlignment(Element.ALIGN_CENTER); Chunk chunk = new Chunk("Slip Gaji", font2); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("SI Klinik", font2); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Jalan Pahlawan 45 Surabaya", font1); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("Telepon : 031 7564231", font1); preface.add(Chunk.NEWLINE); preface.add(chunk); preface.add(Chunk.NEWLINE); preface.add(Chunk.NEWLINE); preface.setAlignment(Element.ALIGN_RIGHT); chunk = new Chunk("Tanggal " + tanggal + "/" + bulan + "/" + tahun, font1); preface.add(Chunk.NEWLINE); preface.add(chunk); chunk = new Chunk("No. Referensi :" + id, font1); preface.add(Chunk.NEWLINE); preface.add(chunk); return preface; }
From source file:IAS.Class.BackIssueLabels.java
public Paragraph prepareBILLabelPDFContent(subInfo sLabelInfo, String bilLabel) { Paragraph info = null;/*w w w. jav a 2 s. c o m*/ info = new Paragraph(); info.setLeading(lfixedLeading, lmultipliedLeadingPlus); info.setAlignment(textAlignment); Font font; font = new Font(sfontType, sfontSizeHeader - 1, sfontStyle, BaseColor.BLACK); if (!bilLabel.isEmpty() && !sLabelInfo.getsubscriberNumber().isEmpty()) { String header = sLabelInfo.getsubscriberNumber() + " " + bilLabel; info.add(new Chunk(header, font)); info.add(Chunk.NEWLINE); } font = new Font(sfontType, sfontSize, sfontStyle, BaseColor.BLACK); String firstLine = sLabelInfo.getsubscriberName(); // + " " + sLabelInfo.getjournalCode(); //if(!noHeader){ //if(sLabelInfo.getcopies() > 1){ // firstLine = firstLine + " " + sLabelInfo.getcopies(); //} //firstLine = firstLine + " " + sLabelInfo.getsubtypecode(); //if(sLabelInfo.equals("Paid")) { // firstLine = firstLine + " " + sLabelInfo.getstartDate()+ // " " + "to" + // " " + sLabelInfo.getendDate(); //} if (!firstLine.isEmpty()) { info.add(new Chunk(firstLine, font)); info.add(Chunk.NEWLINE); } //} //info.add(new Chunk(sLabelInfo.getsubscriberName(), font)); //info.add(Chunk.NEWLINE); if (!sLabelInfo.getdepartment().isEmpty()) { info.add(new Chunk(sLabelInfo.getdepartment(), font)); info.add(Chunk.NEWLINE); } if (!sLabelInfo.getinstitution().isEmpty()) { info.add(new Chunk(sLabelInfo.getinstitution(), font)); info.add(Chunk.NEWLINE); } if (!sLabelInfo.getaddress().isEmpty()) { info.add(new Chunk(sLabelInfo.getaddress(), font)); info.add(Chunk.NEWLINE); } font = new Font(sfontType, sfontSize, Font.BOLD); /* String lastLine = sLabelInfo.getcity() + " " + sLabelInfo.getpincode() + " " + sLabelInfo.getstate() + " "; if(!sLabelInfo.getcountry().equals("India")){ lastLine = lastLine + sLabelInfo.getcountry(); } */ String lastLine = ""; if (!sLabelInfo.getcity().isEmpty()) { lastLine = lastLine + sLabelInfo.getcity(); } if (sLabelInfo.getcity().isEmpty()) { lastLine = lastLine + sLabelInfo.getpincode(); } else { lastLine = lastLine + " " + sLabelInfo.getpincode(); } if (sLabelInfo.getpincode().isEmpty()) { lastLine = lastLine + sLabelInfo.getstate(); } else { lastLine = lastLine + " " + sLabelInfo.getstate(); } String country = ""; if (!sLabelInfo.getcountry().equals("India")) { country = sLabelInfo.getcountry(); } if (sLabelInfo.getstate().isEmpty()) { lastLine = lastLine + country; } else { lastLine = lastLine + " " + country; } if (!lastLine.isEmpty()) { lastLine = lastLine.trim(); // Remove the leading spaces //lastLine.replaceAll("^\\s+", ""); info.add(new Chunk(lastLine, font)); } return info; }
From source file:ictproject.ReportGenerator.java
private Paragraph getParagraph(String name, String type) { Paragraph paragraph = new Paragraph(); paragraph.setSpacingAfter(10);/*from w w w. ja va 2s . co m*/ switch (type) { case "pani ko sroth": { Paragraph para1 = new Paragraph("@= ljBfdfg kfgLsf >f]tx?sf] cj:yfM", fontNormal); para1.setAlignment(Element.ALIGN_CENTER); paragraph.add(para1); break; } case "pani janya rog ko bibaran": { Paragraph para1 = new Paragraph("%= kfgLhGo /f]ux?sf] ljj/0f M", fontNormal); para1.setAlignment(Element.ALIGN_CENTER); Paragraph para3 = new Paragraph( "uflj;:t/Lo kfgLhGo /f]ux?sf] ljj/0f :jf:Yo rf}sLaf6 jf dlxnf ;jo+;]ljsf af6 lng]", fontNormal); paragraph.add(para1); break; } case "actual budget": { Paragraph para1 = new Paragraph( "# -s_ ut tLg jif{sf nflu uflj;n] vfg]kfgL tyf ;/;kmfO If]qdf 5'6fPsf] jh]6 ljj/0fM", fontNormal); // Paragraph para3=new Paragraph("uflj;sf] hDdf ;Defljt nufgL ? ",fontNormal); // Paragraph para4=new Paragraph(getDistinctResult(name, "gabisaKoLagani", "actualBudget")); para1.setAlignment(Element.ALIGN_CENTER); Paragraph para5 = new Paragraph(); para5.add(new Chunk("uflj;sf] hDdf ;Defljt nufgL ? ", fontNormal)); para5.add(getDistinctResult(name, "gabisaKoLagani", "actualBudget")); paragraph.add(para1); paragraph.add(para5); break; } case "expected budget": { Paragraph para1 = new Paragraph( "# -v_ cfufdL # jif{sf nflu uflj;sf] vfg]kfgL tyf ;/;kmfO If]qdf x'g ;Sg] ;Defljt ah]6M", fontNormal); para1.setAlignment(Element.ALIGN_CENTER); Paragraph para5 = new Paragraph(); para5.add(new Chunk("uflj;sf] hDdf ;Defljt nufgL ? ", fontNormal)); para5.add(getDistinctResult(name, "gabisaKoLagani", "expectedBudget")); paragraph.add(para1); paragraph.add(para5); break; } case "janajatiAnusar": { Paragraph para2 = new Paragraph("uflj;sf] gfdMM" + converter(name), fontNormal); para2.setIndentationLeft(50); Paragraph para1 = new Paragraph("!= hfthftL cg';f/sf] 3/w'/L ljj/0fM", fontNormal); para1.setAlignment(Element.ALIGN_CENTER); paragraph.add(para2); paragraph.add(Chunk.NEWLINE); paragraph.add(Chunk.NEWLINE); paragraph.add(para1); break; } case "sauchalayKoAwasta": { Paragraph para1 = new Paragraph("$= zf}rfnosf] cj:yf M", fontNormal);//. ? ",fontNormal); para1.setAlignment(Element.ALIGN_CENTER); paragraph.add(para1); break; } case "gulmi": { Paragraph para = new Paragraph(); Paragraph para1 = new Paragraph("lhNnf ljsf; ;ldltsf] sfof{no", fontNormal); para1.setAlignment(Element.ALIGN_CENTER); Paragraph para3 = new Paragraph("u'NdL", fontNormal); para3.setAlignment(Element.ALIGN_CENTER); Paragraph para4 = new Paragraph("vfg]kfgL tyf ;/;kmfO OsfO{", fontNormal); para4.setAlignment(Element.ALIGN_CENTER); para.add(para1); para.add(para3); para.add(para4); return para; } case "name": { Paragraph para = new Paragraph(converter(name), fontNormal); para.setAlignment(Element.ALIGN_CENTER); return para; } } return paragraph; }
From source file:ictproject.ReportGenerator.java
public PdfPCell getNepaliPhrase(String word) { PdfPCell cell = new PdfPCell(new Phrase(new Chunk(word, fontNormal))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); return cell;//from w w w . j a v a2s. c o m }
From source file:ictproject.ReportGenerator.java
public Chunk getNepaliPhraseInChunk(String word) { return new Chunk(word, fontNormal); }
From source file:Integral.PDF.java
/** * crea una celda con texto adentro para una tabla * @param texto Texto que se va a incluir en la celda * @param font Fuente para el texto/*from w ww . j ava 2 s. c om*/ * @param color color del texto * @param alineacion alineacion del texto respecto a la celda * @param expandirCol expandir la celda x columnas ej:3 junta la celda y 2 mas a la derecha * @param expandirRow Expandir la celda x renglones ej: 3 junta la celda y 2 mas hacia abajo * @param borde tipo de borde de la celda * @return */ public PdfPCell celda(String texto, Font font, BaseColor color, int alineacion, int expandirCol, int expandirRow, int borde) { try { PdfPCell c1 = new PdfPCell(new Paragraph(new Chunk(texto, font))); c1.setColspan(expandirCol); c1.setRowspan(expandirRow); c1.setBackgroundColor(color); c1.setHorizontalAlignment(alineacion); c1.setBorder(borde); return c1; } catch (Exception e) { System.out.println(e); return null; } }
From source file:jdbreport.model.io.pdf.itext5.PdfWriter.java
License:Apache License
protected void writeHTMLText(CellStyle parentStyle, jdbreport.model.Cell cell, PdfPCell pdfCell) { if (cell.isNull() || cell.isChild()) return;//from w w w .ja v a2 s . c om JTextComponent tc = getHTMLReportRenderer(); tc.setText(cell.getText()); List<Content> contentList = Content.getHTMLContentList((HTMLDocument) tc.getDocument()); if (contentList != null) { Phrase phrase = new Phrase(); for (Content content : contentList) { CellStyle newStyle = content.createTextStyle(parentStyle, parentStyle); if (newStyle == null) { newStyle = parentStyle; } if (newStyle != null) { if (newStyle.getTypeOffset() == CellStyle.SS_SUPER || newStyle.getTypeOffset() == CellStyle.SS_SUB) { newStyle = newStyle.deriveFont((float) newStyle.getSize() / 2); } int i = textStyles.indexOf(newStyle); if (i < 0) { textStyles.add(newStyle); i = textStyles.size() - 1; } Font font; String styleId = "T" + (i + 1); if (fonts.containsKey(styleId)) { font = fonts.get(styleId); } else { font = getFontMapper().styleToPdf(newStyle); fonts.put(styleId, font); } Chunk chunk = new Chunk(content.getText(), font); chunk.setBackground(new BaseColor(newStyle.getBackground().getRGB())); if (newStyle.getTypeOffset() == CellStyle.SS_SUPER) { chunk.setTextRise(newStyle.getSize() / 2); } else if (newStyle.getTypeOffset() == CellStyle.SS_SUB) { chunk.setTextRise(-newStyle.getSize() / 2); } phrase.add(chunk); } else { phrase.add(new Chunk(content.getText())); } } pdfCell.setPhrase(phrase); } }
From source file:kafe.BayarSemuaFrame.java
private static void addContent(Document document, String id_pesanan, String bayar, String kembali) throws DocumentException { Paragraph preface = new Paragraph(); preface.add(new Paragraph("============================================================================\n", smallBold));/*w w w.j av a 2 s. c om*/ addEmptyLine(preface, 1); preface.setTabSettings(new TabSettings(250f)); preface.add(Chunk.TABBING); preface.add(new Chunk("---------SEDAP MALAM---------", catFont)); addEmptyLine(preface, 1); preface.setTabSettings(new TabSettings(150f)); preface.add(Chunk.TABBING); preface.add(new Chunk("__________Jalan Informatika No.8__________", smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("============================================================================\n", smallBold)); addEmptyLine(preface, 1); try { Class.forName(driver); Connection connection = DriverManager.getConnection(url, user, pass); Statement statement = connection.createStatement(); String sql = "select a.id_pesanan,d.nama_meja,b.waktu,c.nama_makanan,c.harga_makanan,a.jumlah_makanan,a.status from isi_pesanan a, pesanan b, makanan c, meja d where b.id_pesanan='" + id_pesanan + "' and a.id_pesanan=b.id_pesanan and a.id_makanan=c.id_makanan and b.meja=d.id_meja"; ResultSet rs = statement.executeQuery(sql); int i = 0; int harga_tot = 0; while (rs.next()) { int id = rs.getInt(1); String nama_meja = rs.getString(2); String firstName = rs.getString(3); String surname = rs.getString(4); if (i == 0) { preface.add(new Chunk("ID Pesanan: " + rs.getInt(1) + "\n", normalFont)); preface.add(new Chunk("Meja: " + rs.getString(2) + "\n", normalFont)); preface.add(new Chunk("Waktu Pesanan: " + rs.getString(3), normalFont)); addEmptyLine(preface, 1); preface.add(new Paragraph( "---------------------------------------------------------------------------------------------------------------------------------\n", smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("Rincian Pesananan:", smallBold)); addEmptyLine(preface, 1); } preface.add(new Paragraph( rs.getString(4) + " @ " + rs.getString(6) + " = Rp. " + rs.getString(5) + "\n", normalFont)); harga_tot += Integer.parseInt(rs.getString(5)) * Integer.parseInt(rs.getString(6)); i++; } addEmptyLine(preface, 1); preface.add(new Paragraph( "---------------------------------------------------------------------------------------------------------------------------------\n", smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("Harga Total: Rp. " + harga_tot, smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("Bayar: Rp. " + bayar, normalFont)); addEmptyLine(preface, 1); preface.add(new Paragraph("Kembali: Rp. " + kembali, smallBold)); addEmptyLine(preface, 3); preface.add(new Paragraph("============================== TERIMA KASIH ==============================", smallBold)); rs.close(); statement.close(); connection.close(); } catch (Exception DBException) { } document.add(preface); document.newPage(); }