欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Spire.PDF for Java 版本3.10.5 支持获取 PDF 水印

程序员文章站 2022-03-25 12:52:19
...

Spire.PDF for Java 3.10.5 版本已发布。该版本优化了转换PDF到图片的转换时间和加文本水印到PDF的时间,支持获取PDF水印和插入SVG到PDF的功能,以及修复了PDF转化到Word/Image时出现的问题。详情请阅读以下内容:

优化:

新功能:

PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(outputFile);
PdfAnnotationCollection annotationWidget= pdf.getPages().get(0).getAnnotationsWidget();
StringBuffer stringBuffer = new StringBuffer();
for(int i=0;i < annotationWidget.getCount();i++){
if (annotationWidget.get(i) instanceof PdfWatermarkAnnotationWidget){
  stringBuffer.append(annotationWidget.get(i).getText()+"\r\n");
}

 

String inputFile_svg = "data/sample.svg";
String inputFile_pdf = "data/sample.pdf";
String outputFile = "result.pdf";
PdfDocument doc1 = new PdfDocument();
doc1.loadFromSvg(inputFile_svg);
PdfDocument doc2 = new PdfDocument();
doc2.loadFromFile(inputFile_pdf);
PdfTemplate template = doc1.getPages().get(0).createTemplate();
template.draw(doc2.getPages().get(0).getCanvas(), new Point2D.Float());
doc2.saveToFile(outputFile, FileFormat.PDF);

 问题修复:


注:Spire.PDF for Java  Version_3.10.5 获取地址