使用 iText 裁剪 pdf 而不丢失注释
我必须裁剪一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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 )
,PdfCopy
s 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)