| | |
| | | fontName = fontName + ",0"; |
| | | } |
| | | String font = FONT_PATH + fontName; |
| | | log.info("字体路径 -> {}",font); |
| | | // log.info("字体路径 -> {}",font); |
| | | return BaseFont.createFont(font, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); |
| | | } |
| | | |
| | |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public static PdfPTable setTable(Font headFont, Font textFont, String[] title, List<TjPdfVO> list) { |
| | | public static PdfPTable setTable(Font headFont, Font textFont, String[] title, List<TjPdfVO> list,boolean flag) { |
| | | //四列 |
| | | PdfPTable table = createTable(new float[]{120, 120, 120}); |
| | | //画标题 |
| | |
| | | table.addCell(createCell(tjPdfVO.getProResult(), textFont)); |
| | | table.addCell(createCell(tjPdfVO.getCompany(), textFont)); |
| | | // table.addCell(createCell(tjPdfVO.getStandardValue(), textFont)); |
| | | if ((tjPdfVO.getSj() != null || tjPdfVO.getTs() != null) && flag){ |
| | | PdfPCell cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase("检查所见:", textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | |
| | | cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase(tjPdfVO.getSj(), textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | |
| | | cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase("结论:", textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | |
| | | cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase(tjPdfVO.getTs(), textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | } |
| | | } |
| | | return table; |
| | | } |
| | |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public static PdfPTable setTable2(Font headFont, Font textFont, String[] title, List<TjPdfVO> list) { |
| | | public static PdfPTable setTable2(Font headFont, Font textFont, String[] title, List<TjPdfVO> list,boolean flag) { |
| | | //四列 |
| | | PdfPTable table = createTable(new float[]{240, 240,240}); |
| | | //画标题 |
| | |
| | | table.addCell(createCell(tjPdfVO.getProName(), textFont)); |
| | | table.addCell(createCell(tjPdfVO.getProResult(), textFont)); |
| | | table.addCell(createCell(tjPdfVO.getCompany(), textFont)); |
| | | if ((tjPdfVO.getSj() != null || tjPdfVO.getTs() != null) && flag){ |
| | | PdfPCell cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase("检查所见:", textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | |
| | | cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase(tjPdfVO.getSj(), textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | |
| | | cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase("结论:", textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | |
| | | cell = new PdfPCell(); |
| | | // 水平、垂直居中 |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | cell.setPhrase(new Phrase(tjPdfVO.getTs(), textFont)); |
| | | // 设置无边框 |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setColspan(3); |
| | | table.addCell(cell); |
| | | } |
| | | } |
| | | return table; |
| | | } |