List of usage examples for com.itextpdf.text.pdf PdfPTable setWidthPercentage
public void setWidthPercentage(final float widthPercentage)
From source file:pdfMaker.MakePdfFile.java
public void createPdf(String mainTitle, String subTitle, String url, String userName, //String scanType, String comment,//from ww w . ja v a2 s.c o m //String thisPassCode, String passCodeA, String passCodeB, String fileDir, Boolean noBarCodePrint) throws IOException, DocumentException, RuntimeException { Document document = null; try { // step 1 document = new Document(PageSize.A4, 60, 50, 50, 35); // step 2 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileDir)); // step 3 document.open(); // step 4 PdfContentByte cb = writer.getDirectContent(); /* Properties props = new Properties(); String jarPath = System.getProperty("java.class.path"); String dirPath = jarPath.substring(0, jarPath.lastIndexOf(File.separator)+1); FontFactory.registerDirectory("/res"); FontFactory.register("ipag.ttf"); Font ipaGothic = FontFactory.getFont("ipag", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10); //10 is the size InputStream is = getClass().getResourceAsStream("/res/ipag.ttf"); */ Properties props = new Properties(); String jarPath = System.getProperty("java.class.path"); String dirPath = jarPath.substring(0, jarPath.lastIndexOf(File.separator) + 1); System.out.println(jarPath); System.out.println(dirPath); System.out.println(System.getProperty("user.dir")); Font ipaGothic = new Font(BaseFont.createFont(System.getProperty("user.dir") + "\\res\\ipag.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED), 11); //?(2) PdfPTable pdfPTable = new PdfPTable(2); pdfPTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); pdfPTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); pdfPTable.getDefaultCell().setFixedHeight(150); pdfPTable.setWidthPercentage(100f); int pdfPTableWidth[] = { 10, 90 }; pdfPTable.setWidths(pdfPTableWidth); PdfPCell cell_1_1 = new PdfPCell(new Paragraph("??", ipaGothic)); cell_1_1.setVerticalAlignment(Element.ALIGN_MIDDLE); cell_1_1.setHorizontalAlignment(Element.ALIGN_CENTER); cell_1_1.setFixedHeight(50); PdfPCell cell_1_2 = new PdfPCell(new Paragraph(mainTitle, ipaGothic)); cell_1_2.setVerticalAlignment(Element.ALIGN_MIDDLE); cell_1_2.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell cell_2_1 = new PdfPCell(new Paragraph("", ipaGothic)); cell_2_1.setVerticalAlignment(Element.ALIGN_MIDDLE); cell_2_1.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell cell_2_2 = new PdfPCell(new Paragraph(subTitle, ipaGothic)); cell_2_2.setVerticalAlignment(Element.ALIGN_MIDDLE); cell_2_2.setHorizontalAlignment(Element.ALIGN_CENTER); cell_2_2.setFixedHeight(50); pdfPTable.addCell(cell_1_1); pdfPTable.addCell(cell_1_2); pdfPTable.addCell(cell_2_1); pdfPTable.addCell(cell_2_2); PdfPCell cellUrlKey = new PdfPCell(new Paragraph("?", ipaGothic)); cellUrlKey.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUrlKey.setHorizontalAlignment(Element.ALIGN_CENTER); cellUrlKey.setRowspan(2); pdfPTable.addCell(cellUrlKey); PdfPCell cellUrlValue = new PdfPCell(new Paragraph(url, ipaGothic)); cellUrlValue.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUrlValue.setHorizontalAlignment(Element.ALIGN_CENTER); cellUrlValue.setFixedHeight(50); pdfPTable.addCell(cellUrlValue); /* */ //cellUrlValue.getImage(); writer.getDirectContent().addImage(cellUrlValue.getImage(), 100, 100, 100, 100, 100, 100); if (url.length() != 0 && !noBarCodePrint) { /* ? BarcodeQRCode qr = new BarcodeQRCode(url, 50, 50, null); PdfPCell cellUrlValueQr = new PdfPCell(qr.getImage()); cellUrlValueQr.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUrlValueQr.setHorizontalAlignment(Element.ALIGN_CENTER); cellUrlValueQr.setFixedHeight(80); pdfPTable.addCell(cellUrlValueQr); */ Image image = ZxingUti.getQRCode(url); // SHIFT_JIS com.itextpdf.text.Image iTextImage = com.itextpdf.text.Image.getInstance(image, null); PdfPCell cell = new PdfPCell(iTextImage); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setFixedHeight(100); pdfPTable.addCell(cell); // SIFT_JIS } else { PdfPCell cellUrlValueQr = new PdfPCell(new Paragraph("", ipaGothic)); cellUrlValueQr.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUrlValueQr.setHorizontalAlignment(Element.ALIGN_CENTER); cellUrlValueQr.setFixedHeight(80); pdfPTable.addCell(cellUrlValueQr); } PdfPCell cellUserNameKey = new PdfPCell(new Paragraph("", ipaGothic)); cellUserNameKey.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUserNameKey.setHorizontalAlignment(Element.ALIGN_CENTER); cellUserNameKey.setRowspan(2); pdfPTable.addCell(cellUserNameKey); PdfPCell cellUserNameValue = new PdfPCell(new Paragraph(userName, ipaGothic)); cellUserNameValue.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUserNameValue.setHorizontalAlignment(Element.ALIGN_CENTER); cellUserNameValue.setFixedHeight(30); pdfPTable.addCell(cellUserNameValue); if (userName.length() != 0 && !noBarCodePrint) { Barcode128 code128 = new Barcode128(); code128.setCode(userName); code128.setFont(ipaGothic.getBaseFont()); code128.setBarHeight(40f); PdfPCell cellUserNameValueBc = new PdfPCell(code128.createImageWithBarcode(cb, null, null)); cellUserNameValueBc.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUserNameValueBc.setHorizontalAlignment(Element.ALIGN_CENTER); cellUserNameValueBc.setFixedHeight(80); pdfPTable.addCell(cellUserNameValueBc); } else { PdfPCell cellUserNameValueBc = new PdfPCell(new Paragraph("---", ipaGothic)); cellUserNameValueBc.setVerticalAlignment(Element.ALIGN_MIDDLE); cellUserNameValueBc.setHorizontalAlignment(Element.ALIGN_CENTER); cellUserNameValueBc.setFixedHeight(80); pdfPTable.addCell(cellUserNameValueBc); } PdfPCell cellPassCodeKey = new PdfPCell(new Paragraph("?", ipaGothic)); cellPassCodeKey.setVerticalAlignment(Element.ALIGN_MIDDLE); cellPassCodeKey.setHorizontalAlignment(Element.ALIGN_CENTER); cellPassCodeKey.setRowspan(3); pdfPTable.addCell(cellPassCodeKey); PdfPCell cellPassCodeValue = new PdfPCell(new Paragraph(passCodeA + passCodeB, ipaGothic)); cellPassCodeValue.setVerticalAlignment(Element.ALIGN_MIDDLE); cellPassCodeValue.setHorizontalAlignment(Element.ALIGN_CENTER); cellPassCodeValue.setFixedHeight(30); pdfPTable.addCell(cellPassCodeValue); if (passCodeA.length() != 0 && !noBarCodePrint) { Barcode128 code128 = new Barcode128(); code128.setCode(passCodeA); code128.setFont(ipaGothic.getBaseFont()); code128.setBarHeight(40f); PdfPCell cellPassCodeA_Bc = new PdfPCell(code128.createImageWithBarcode(cb, null, null)); cellPassCodeA_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE); cellPassCodeA_Bc.setHorizontalAlignment(Element.ALIGN_CENTER); cellPassCodeA_Bc.setFixedHeight(80); pdfPTable.addCell(cellPassCodeA_Bc); } else { PdfPCell cellPassCodeA_Bc = new PdfPCell(new Paragraph("---", ipaGothic)); cellPassCodeA_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE); cellPassCodeA_Bc.setHorizontalAlignment(Element.ALIGN_CENTER); cellPassCodeA_Bc.setFixedHeight(80); pdfPTable.addCell(cellPassCodeA_Bc); } if (passCodeB.length() != 0 && !noBarCodePrint) { Barcode128 code128 = new Barcode128(); code128.setCode(passCodeB); code128.setFont(ipaGothic.getBaseFont()); code128.setBarHeight(40f); PdfPCell cellPassCodeB_Bc = new PdfPCell(code128.createImageWithBarcode(cb, null, null)); cellPassCodeB_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE); cellPassCodeB_Bc.setHorizontalAlignment(Element.ALIGN_CENTER); cellPassCodeB_Bc.setFixedHeight(80); pdfPTable.addCell(cellPassCodeB_Bc); } else { PdfPCell cellPassCodeB_Bc = new PdfPCell(new Paragraph("---", ipaGothic)); cellPassCodeB_Bc.setVerticalAlignment(Element.ALIGN_MIDDLE); cellPassCodeB_Bc.setHorizontalAlignment(Element.ALIGN_CENTER); cellPassCodeB_Bc.setFixedHeight(80); pdfPTable.addCell(cellPassCodeB_Bc); } PdfPCell cellCommentKey = new PdfPCell(new Paragraph("?", ipaGothic)); cellCommentKey.setVerticalAlignment(Element.ALIGN_MIDDLE); cellCommentKey.setHorizontalAlignment(Element.ALIGN_CENTER); pdfPTable.addCell(cellCommentKey); PdfPCell cellCommentValue = new PdfPCell(new Paragraph(comment, ipaGothic)); cellCommentValue.setVerticalAlignment(Element.ALIGN_TOP); cellCommentValue.setHorizontalAlignment(Element.ALIGN_LEFT); cellCommentValue.setFixedHeight(150); pdfPTable.addCell(cellCommentValue); PdfPCell cellIssueKey = new PdfPCell(new Paragraph("", ipaGothic)); cellIssueKey.setVerticalAlignment(Element.ALIGN_MIDDLE); cellIssueKey.setHorizontalAlignment(Element.ALIGN_CENTER); pdfPTable.addCell(cellIssueKey); Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm"); String strDate = sdf.format(cal.getTime()); PdfPCell cellIssueValue = new PdfPCell(new Paragraph(strDate, ipaGothic)); cellIssueValue.setVerticalAlignment(Element.ALIGN_MIDDLE); cellIssueValue.setHorizontalAlignment(Element.ALIGN_CENTER); cellIssueValue.setFixedHeight(20); pdfPTable.addCell(cellIssueValue); //?? document.add(pdfPTable); /* // CODE 128 document.add(new Paragraph("?? : " + mainTitle, ipaGothic)); document.add(new Paragraph(" : " + subTitle, ipaGothic)); document.add(new Paragraph("-------------------------------------------------------")); document.add(new Paragraph(" " + strDate)); document.add(new Paragraph("-------------------------------------------------------")); BaseFont bf = BaseFont.createFont(BaseFont.COURIER, BaseFont.WINANSI, BaseFont.EMBEDDED); Font font = new Font(bf, 12); document.add(new Paragraph("", ipaGothic)); document.add(new Paragraph(url, ipaGothic)); code128.setCode(url); code128.setFont(bf); code128.setX(1); //document.add(code128.createImageWithBarcode(cb, null, null)); document.add(new Paragraph("USER", ipaGothic)); if (userName.length() != 0) { document.add(new Paragraph(userName, ipaGothic)); code128.setCode(userName); code128.setFont(bf); code128.setBarHeight(40f); document.add(code128.createImageWithBarcode(cb, null, null)); } document.add(new Paragraph("CODE", ipaGothic)); if (passCode.length() != 0) { document.add(new Paragraph(passCode, ipaGothic)); code128.setCode(passCode); code128.setFont(bf); document.add(code128.createImageWithBarcode(cb, null, null)); } document.add(new Paragraph("?", ipaGothic)); document.add(new Paragraph(comment, ipaGothic)); */ // step 5 document.close(); } catch (RuntimeException ex) { document.close(); throw ex; } }
From source file:pdfreporter.PDFGenTable.java
public static void pdfgentable() { Document document = new Document(); try {/*from www . j a v a2 s . c om*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddTableExample.pdf")); document.open(); PdfPTable table = new PdfPTable(4); // 3 columns. table.setWidthPercentage(100); //Width 100% table.setSpacingBefore(10f); //Space before table table.setSpacingAfter(10f); //Space after table //Set Column widths float[] columnWidths = { 1f, 1f, 1f, 1f }; table.setWidths(columnWidths); PdfPCell cell1 = new PdfPCell(new Paragraph("Nemam Pojma")); cell1.setBorderColor(BaseColor.BLACK); cell1.setPaddingLeft(10); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell2 = new PdfPCell(new Paragraph("Nemam pojma 2")); cell2.setBorderColor(BaseColor.BLACK); cell2.setPaddingLeft(10); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell3 = new PdfPCell(new Paragraph("Nemam pojma 3")); cell3.setBorderColor(BaseColor.BLACK); cell3.setPaddingLeft(10); cell3.setHorizontalAlignment(Element.ALIGN_CENTER); cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell4 = new PdfPCell(new Paragraph("Nemam pojma 4")); cell4.setBorderColor(BaseColor.BLACK); cell4.setPaddingLeft(10); cell4.setHorizontalAlignment(Element.ALIGN_CENTER); cell4.setVerticalAlignment(Element.ALIGN_MIDDLE); //To avoid having the cell border and the content overlap, if you are having thick cell borders //cell1.setUserBorderPadding(true); //cell2.setUserBorderPadding(true); //cell3.setUserBorderPadding(true); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); document.add(table); document.close(); writer.close(); } catch (FileNotFoundException | DocumentException e) { } }
From source file:pidevhany.Controllers.GeneratePDF.java
public GeneratePDF(String ReponsesCorretes, String ReponsesFausses) throws FileNotFoundException, IOException { Document document = new Document(); OutputStream outputStream = new FileOutputStream( new File("D:\\Esprit\\Atelier Java\\piweb\\pidevHany\\src\\pidevhany\\TestFile.pdf")); try {//from w w w .j a va 2s . c om PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); document.add(new Paragraph("Resultat du test :")); PdfPTable table = new PdfPTable(2); // 3 columns. table.setWidthPercentage(100); //Width 100% table.setSpacingBefore(10f); //Space before table table.setSpacingAfter(10f); //Space after table //Set Column widths float[] columnWidths = { 1f, 1f }; table.setWidths(columnWidths); PdfPCell cell1 = new PdfPCell(new Paragraph(ReponsesCorretes)); cell1.setBorderColor(BaseColor.BLUE); cell1.setPaddingLeft(10); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell2 = new PdfPCell(new Paragraph(ReponsesFausses)); cell2.setBorderColor(BaseColor.GREEN); cell2.setPaddingLeft(10); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell1); table.addCell(cell2); document.add(table); document.close(); outputStream.close(); writer.close(); } catch (DocumentException e) { e.printStackTrace(); } }
From source file:pipe.PdfMaker.java
/** * Builds and returns the main table./*ww w. j a v a2s. co m*/ * * @return */ Element mainElement(ArrayList values) throws BadElementException { PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f); table.getDefaultCell().setBorderWidth(0.5f); Element element; PdfPCell cell; element = this.firstElement((String) values.get(0)); cell = this.createCell(1, 1); cell.setBorder(15); cell.setPadding(2f); cell.addElement(element); table.addCell(cell); String dirString = "pictures" + File.separator + (String) values.get(0) + "_" + (String) values.get(1) + "_" + (String) values.get(2) + File.separator + "01.jpg"; element = this.fourthLogoElement(dirString); // You need to pass the image to the constructor. // If you add the image, it will be stretched to fill the cell. cell = new PdfPCell((Image) element); cell.setPadding(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidth(0.3f); cell.setRowspan(4); table.addCell(cell); element = this.thirdElement((String) values.get(1), (String) values.get(2)); cell = this.createCell(1, 1); cell.addElement(element); table.addCell(cell); element = this.fifthElement((String) values.get(3), (String) values.get(4), (String) values.get(5)); cell = this.createCell(1, 1); cell.addElement(element); table.addCell(cell); element = this.sixthElement((String) values.get(6), (String) values.get(7)); cell = this.createCell(1, 1); cell.addElement(element); cell.setBorderWidth(0.3f); table.addCell(cell); element = this.seventhElement((String) values.get(8), (String) values.get(9)); cell = this.createCell(1, 1); cell.addElement(element); table.addCell(cell); element = this.eightthElement((String) values.get(10), (String) values.get(11)); cell = this.createCell(2, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.ninethElement((String) values.get(12), (String) values.get(13), (String) values.get(14)); cell = this.createCell(1, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.tenthElement((String) values.get(15), (String) values.get(16), (String) values.get(17)); cell = this.createCell(1, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.eleventhElement((String) values.get(18), (String) values.get(19), (String) values.get(20)); cell = this.createCell(1, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.twelvethElement((String) values.get(21), (String) values.get(22), (String) values.get(23)); cell = this.createCell(1, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.thirteenthElement((String) values.get(24), (String) values.get(25)); cell = this.createCell(1, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.fourteenthElement((String) values.get(26), (String) values.get(27)); cell = this.createCell(1, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); element = this.fifteenthElement((String) values.get(28)); cell = this.createCell(2, 1); cell.setBorderWidth(0.3f); cell.addElement(element); table.addCell(cell); return table; }
From source file:pipe.PdfMaker.java
private Element thirdElement(String hersteller, String modell) { float leading = 9f; PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f); PdfPCell cell;/*from www . j a v a 2s . com*/ cell = new PdfPCell(new Paragraph("Hersteller", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Modell", arialSmall)); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setGrayFill(0.85f); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph herstellerInfo = new Paragraph(hersteller, courier); herstellerInfo.setLeading(leading); cell.addElement(herstellerInfo); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph modellInfo = new Paragraph(modell, courier); modellInfo.setLeading(leading); cell.addElement(modellInfo); table.addCell(cell); return table; }
From source file:pipe.PdfMaker.java
private Element fifthElement(String land, String edition, String jahr) { float leading = 9f; PdfPTable table = new PdfPTable(3); table.setWidthPercentage(100f); PdfPCell cell;// w w w . jav a2 s . c om //Hier die Header zuerst cell = new PdfPCell(new Paragraph("Land", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Edition", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Jahr", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); //Ab hier die Werte cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); Paragraph herkunftInfo = new Paragraph(land, courier); herkunftInfo.setLeading(leading); cell.addElement(herkunftInfo); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); Paragraph editionInfo = new Paragraph(edition, courier); editionInfo.setLeading(leading); cell.addElement(editionInfo); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph yearInfo = new Paragraph(jahr, courier); yearInfo.setLeading(leading); cell.addElement(yearInfo); table.addCell(cell); return table; }
From source file:pipe.PdfMaker.java
private Element sixthElement(String grundform, String mundstck) { float leading = 9f; PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f); PdfPCell cell;//from ww w . ja va2 s . c o m cell = new PdfPCell(new Paragraph("Grundform", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Mundstck", arialSmall)); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setGrayFill(0.85f); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph herstellerInfo = new Paragraph(grundform, courier); herstellerInfo.setLeading(leading); cell.addElement(herstellerInfo); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph modellInfo = new Paragraph(mundstck, courier); modellInfo.setLeading(leading); cell.addElement(modellInfo); table.addCell(cell); return table; }
From source file:pipe.PdfMaker.java
private Element seventhElement(String kopfmat, String mundmat) { float leading = 9f; PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f); PdfPCell cell;//from ww w. jav a 2 s .c o m cell = new PdfPCell(new Paragraph("Kopfmaterial", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Material Mundstck", arialSmall)); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setGrayFill(0.85f); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph mundMatInfo = new Paragraph(kopfmat, courier); mundMatInfo.setLeading(leading); cell.addElement(mundMatInfo); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph modellInfo = new Paragraph(mundmat, courier); modellInfo.setLeading(leading); cell.addElement(modellInfo); table.addCell(cell); return table; }
From source file:pipe.PdfMaker.java
private Element eightthElement(String applikation, String tabak) { float leading = 9f; PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100f); PdfPCell cell;/* w ww. j a va 2 s .c o m*/ cell = new PdfPCell(new Paragraph("Applikation", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Eingerauchter Tabak", arialSmall)); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setGrayFill(0.85f); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph mundMatInfo = new Paragraph(applikation, courier); mundMatInfo.setLeading(leading); cell.addElement(mundMatInfo); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph modellInfo = new Paragraph(tabak, courier); modellInfo.setLeading(leading); cell.addElement(modellInfo); table.addCell(cell); return table; }
From source file:pipe.PdfMaker.java
private Element ninethElement(String kaufpreis, String gekauft_bei, String datum) { float leading = 9f; PdfPTable table = new PdfPTable(3); table.setWidthPercentage(100f); PdfPCell cell;//from w w w.j av a 2 s .c o m //Hier die Header zuerst cell = new PdfPCell(new Paragraph("Einstandspreis", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Gekauft bei / von", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); cell = new PdfPCell(new Paragraph("Kaufdatum", arialSmall)); cell.setPadding(2); cell.setGrayFill(0.85f); cell.setBorderWidth(0.3f); table.addCell(cell); //Ab hier die Werte cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); Paragraph herkunftInfo = new Paragraph(kaufpreis, courier); herkunftInfo.setLeading(leading); cell.addElement(herkunftInfo); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(2); cell.setBorderWidth(0.3f); Paragraph editionInfo = new Paragraph(gekauft_bei, courier); editionInfo.setLeading(leading); cell.addElement(editionInfo); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidth(0.3f); cell.setFixedHeight(30f); Paragraph yearInfo = new Paragraph(datum, courier); yearInfo.setLeading(leading); cell.addElement(yearInfo); table.addCell(cell); return table; }