| | |
| | | package com.ltkj.web.config.pdfutils; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.itextpdf.text.*; |
| | | import com.itextpdf.text.pdf.BaseFont; |
| | | import com.itextpdf.text.pdf.PdfContentByte; |
| | |
| | | import com.ltkj.hosp.domain.TjPdfVO; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.nio.file.Files; |
| | | import java.util.List; |
| | | |
| | | import static com.itextpdf.text.Rectangle.NO_BORDER; |
| | |
| | | /** |
| | | * 字体存放的跟路径,默认为'C:\Windows\Fonts\' |
| | | */ |
| | | private static final String FONT_PATH = "C:\\Windows\\Fonts\\"; |
| | | private static final String FONT_PATH = System.getProperty("user.dir") + File.separator + "ltkj-admin"+File.separator+"src"+File.separator+"main"+File.separator+"resources"+File.separator+"Font"+File.separator; |
| | | // private static final String FONT_PATH = "/Users/chacca/开发相关/代码/ltkj_peis/ltkj-admin/src/main/resources/Font/"; |
| | | |
| | | /** |
| | |
| | | return BaseFont.createFont(font, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | BaseFont simsun = createBaseFont(null); |
| | | System.out.println("simsun = " + simsun); |
| | | } catch (DocumentException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置字体 |
| | | * |