如何在Java中以编程方式减少PDF文件大小? [英] How to reduce PDF file size programmatically in Java?
本文介绍了如何在Java中以编程方式减少PDF文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Document document = new Document(reader.getPageSizeWithRotation(1));
PdfCopy writer = new PdfCopy(document, new FileOutputStream(outFile));
document.open();
PdfImportedPage page = writer.getImportedPage(reader, ++i);
writer.setFullCompression();
writer.addPage(page);
document.close();
writer.close();
我使用iText分割和合并PDF,我需要你的帮助来减少(压缩)以编程方式输出PDF大小。请让我知道实现相同目标的步骤。
I am using iText to split and merger the PDF, I need your help to reduce (compress) the output PDF size programmatically. Please let me know the steps to achieve the same.
推荐答案
使用 writer.setFullCompression()
您已尽可能压缩文件。使用iText,你无法做更多的事情。
With writer.setFullCompression()
you already compressed file as much as possible. With iText you can't do anything more.
这篇关于如何在Java中以编程方式减少PDF文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文