feat: pdf加水印支持部分加密的pdf文档
This commit is contained in:
@@ -80,7 +80,7 @@ public class SysWaterMarkUtil {
|
|||||||
public synchronized InputStream addWatermarkToPdf(InputStream inputStream) throws IOException {
|
public synchronized InputStream addWatermarkToPdf(InputStream inputStream) throws IOException {
|
||||||
List<String> watermarkText = getWaterMarkConfig();
|
List<String> watermarkText = getWaterMarkConfig();
|
||||||
PDDocument document = PDDocument.load(inputStream);
|
PDDocument document = PDDocument.load(inputStream);
|
||||||
|
document.setAllSecurityToBeRemoved(true);
|
||||||
// 加载水印字体
|
// 加载水印字体
|
||||||
ClassPathResource fontResource = new ClassPathResource("fonts/SourceHanSerif-VF.ttf");
|
ClassPathResource fontResource = new ClassPathResource("fonts/SourceHanSerif-VF.ttf");
|
||||||
PDType0Font font = PDType0Font.load(document, fontResource.getInputStream());
|
PDType0Font font = PDType0Font.load(document, fontResource.getInputStream());
|
||||||
|
|||||||
Reference in New Issue
Block a user