版本23.6
我参考了这个流程:Aspose.pdf 将原有pdf里面的每页设置A4纸大小,内容也要A4纸大小。
来修改我的pdf文件,确实生效了,但是pdf里面携带的注释没有按照比例缩小
我的文件及问题截图:
zip.zip (3.1 MB)
我的代码:
License license = new License();
license.setLicense(“./lib/newlic.lic”);
Document document = new Document("C:\\Users\\Administrator\\Downloads\\0.pdf");
PdfFileEditor fileEditor = new PdfFileEditor();
PdfFileEditor.ContentsResizeParameters parameters = new PdfFileEditor.ContentsResizeParameters(
PdfFileEditor.ContentsResizeValue.percents(0),
PdfFileEditor.ContentsResizeValue.units(500),
PdfFileEditor.ContentsResizeValue.percents(0),
PdfFileEditor.ContentsResizeValue.percents(0),
PdfFileEditor.ContentsResizeValue.units(500),
PdfFileEditor.ContentsResizeValue.percents(0)
);
fileEditor.resizeContents(document, parameters);
PdfPageEditor pageEditor = new PdfPageEditor(document);
pageEditor.setZoom(1.0f);
pageEditor.setPageSize(new PageSize(500,500));
pageEditor.save("C:\\Users\\Administrator\\Downloads\\out.pdf");