Tag: pdf annotations

复制页面时,iText会复制/弹出注释

当使用以下代码复制带注释的页面时,iText 7.1.0复制/Popup注释,“原始”和副本之间的唯一区别是,一个具有/Parent条目而另一个没有。 不幸的是,没有丢失/Parent那个被注册在/Page字典的/Annots列表中。 如何让iText不复制注释或至少注册带有/Parent条目的注释? 对奇怪行为的任何解释? import com.itextpdf.kernel.pdf.*; import java.io.IOException; public class CopyPdfTest { public static void main(String[] args) throws IOException { PdfDocument inputDoc = new PdfDocument(new PdfReader(“input.pdf”)); PdfWriter writer = new PdfWriter(“output.pdf”); writer.setCompressionLevel(0); PdfDocument outputDoc = new PdfDocument(writer); for (int i = 1; i <= inputDoc.getNumberOfPages(); i++) { inputDoc.copyPagesTo(i, i, outputDoc); } inputDoc.close(); outputDoc.close(); } […]

iText – 可点击的图片应该打开ms word附件

如何使图像可单击以便打开附加的ms word文档? 我在这里有一些PDF文件,其中有一些图像(图标下方带有ms文件名的ms字图标),通过点击图像打开附加的ms word文档,我想知道如何使用iText库执行此操作。 我可以添加图像并附加ms word文档,但我还没弄清楚如何应用somwthing就像一个动作(GoToE似乎只适用于PDF附件)或链接?

使用iText复制带注释的PDF

我们需要将现有的多个PDF导入到一个新的PDF中。 部分代码与第2版​​动作中的iText第6.2.1节中的示例代码类似: Document document = new Document(); PdfWriter writer = PdfWriter.getInstance( document, new FileOutputStream(RESULT)); document.open(); PdfPTable table = new PdfPTable(2); PdfReader reader = new PdfReader(MovieTemplates.RESULT); int n = reader.getNumberOfPages(); PdfImportedPage page; for (int i = 1; i <= n; i++) { page = writer.getImportedPage(reader, i); table.addCell(Image.getInstance(page)); } document.add(table); document.close(); 但是,我们刚刚意识到在处理带注释的可填写PDF时(在我们的例子中,那些PDF已经填充了数据),所有填充的数据都会丢失在新的PDF中。 我们在本书的同一部分找到了答案: 了解呈现页面内容所需的资源与页面的交互function之间的区别非常重要。 通常,这些function称为注释。 它们包括链接,文本注释和表单字段。 注释不是内容流的一部分。 […]