使用 iText 裁剪 pdf 而不丢失注释

发布于 2024-10-07 09:01:35 字数 199 浏览 0 评论 0原文

我必须裁剪一个 26 页的 pdf,其中 24 和 25 是带注释的表格。裁剪第 24 和 25 页后,第 24,25 页的 pdf 被签名并存储在数据库中。问题是裁剪后的 pdf(24 页,25 页)丢失了注释。问题是如何裁剪带有注释的pdf?我们应该阅读所有注释,保留它们,然后裁剪 pdf 并将注释放回裁剪后的 pdf 中吗?如果是的话,该怎么做,如果不是的话,还有其他方法吗?

I have to crop a pdf of 26 pages, 24 and 25 being the form with annotations. after croping the 24 and 25th page the 24,25 pdf is signed and stored in the database. the problem is the croped pdf (24the, 25 pages) loses the annotations. the question is how to crop the pdf with annotations? should we read all the annotations, keep them, then crop the pdf and put the annotations back into the croped pdf? if so, how to do this, if not then other ways?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

偷得浮生 2024-10-14 09:01:35

PdfImportedPage 实际上只是该页面的内容和资源。没有标记的内容(保存内容流中的内容,如果没有页面级别的信息,这些内容将毫无用处),没有注释,没有书签等。

但是,如果您使用 PdfCopy.addPage( PdfImportedPage )PdfCopy的额外“管道”会返回并吸出原始页面中的所有内容。注释、附加操作等等。

如果这就是您已经在做的事情,也许您可​​以分享您的代码?

PS:“裁剪”在 PDF 中的含义完全不同。您想要删除页面,而不是更改其大小。但 iText 不支持这一点。 (?!哇,这是一个相当大的洞......对我们来说多么尴尬)

A PdfImportedPage is really just the contents and resources of that page. No marked content (save what's in the content stream which is useless without the info at the page level), no annotations, no bookmarks, etc etc.

BUT, if you use PdfCopy.addPage( PdfImportedPage ), PdfCopys extra "plumbing" goes back and sucks out EVERYTHING from the original page. Annotations, additional actions, that sort of thing.

If that's what you're already doing, perhaps you could share your code?

PS: "Cropping" means something entirely different in PDF. You want to delete pages, not change their size. But iText doesn't support that. (?! Wow, That's a pretty big hole... how embarrassing for us)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文