服务器无法读取字体文件
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package com.cool.store.utils;
|
package com.cool.store.utils;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.lowagie.text.Document;
|
import com.lowagie.text.Document;
|
||||||
@@ -73,7 +72,7 @@ public class PassLetterUtils {
|
|||||||
try {
|
try {
|
||||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||||
PdfReader pdfReader = new PdfReader(inputStream);
|
PdfReader pdfReader = new PdfReader(inputStream);
|
||||||
String fontFamilyPath = PassLetterUtils.class.getResource("/static/Alibaba-PuHuiTi-Regular.ttf").getPath();
|
String fontFamilyPath = PassLetterUtils.class.getResource("/static/Alibaba-PuHuiTi-Regular.ttf").toString();
|
||||||
BaseFont font = BaseFont.createFont(fontFamilyPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
BaseFont font = BaseFont.createFont(fontFamilyPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||||
PDFUtils.putParagraphAbsolutely(pdfReader, outputStream, x, y, content, font, 19, 1, new Color(255, 82,25));
|
PDFUtils.putParagraphAbsolutely(pdfReader, outputStream, x, y, content, font, 19, 1, new Color(255, 82,25));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user