pdfbox

使用Hutools的对称加密时出现的一个问题

有些话、适合烂在心里 提交于 2020-03-02 08:37:50
首先 这不是Hutools的一个bug 而是pdfbox-app这个组件的bug 在2.0.0版本的pdfbox-app jar包中 集成了一个叫 bouncycastle的加密工具包(貌似是个jdk级别的jar)的源代码,pdfbox直接将其源码都写在自己jar里 所以我们这项目里其他的关于bouncycastle加密包的引用都取消了,这也就是问题导致的原因,pdfbox-app.jar包由于自身问题,以及bouncycastle本身的特性,就是会检测自身所在jar的签名是否有效,所以pdfbox-app.jar 的 2.0.0 版本的签名不知道为什么,无法通过检测,所以导致,加密不能使用抛出那个什么 jce 什么 cannot 啥的异常 简单点说就是,bouncycastle这个组件会对自身jar包进行签名检测,不符合就会抛异常,而pdfbox-app 2.0.0 集成了这个组件的所有源代码,而且在签名上没处理好,导致我们无法使用这个组件来加密,hutools加密代码底层有用到bouncycastle所以就无法运行加密了。 解决方式很简单 将pdfbox-app的版本由 2.0.0 改为2.0.13或者其他版本,问题解决。 顺便提一句,Hutools这个工具包真的很好用,为贡献者们点个赞,感谢你们的贡献。 来源: oschina 链接: https://my.oschina

In PDFBox, Is it possible to add a tooltip (hint) to a mark annotation?

拜拜、爱过 提交于 2020-02-25 04:18:52
问题 In a Nutshell I've been working on a program that gets a pdf, highlights some words (via pdfbox Mark Annotation obj) and saves the new pdf. I'd like my highlighted words to show a tooltip with some small description on it, like a hint. For instance, I want that on my pdf, the highlighted word activated shows the tooltip important word found when I stop the mouse over it. This is the original test pdf. My Code With a couple of abstractions, in a nutshell, I have: File file = new File("path/to

Calculating the exact positions of(Td, TD, Tm, cm, T*) content stream in pdf?

那年仲夏 提交于 2020-02-24 05:00:08
问题 Getting or calculating the exact positions of(Td, TD, Tm, cm, T*) content stream in pdf? As a human I am able to calculate(whether it is replacing last Td or adding to last Td or multiplication with fontsize) the positions of tags in pdf content stream by comparing , where the glyphs are located in pdf and content stream position values. But I am unable to calculate perfect positions of glyph's programatically . Please see the screen short. In above image left side box is pdf ui glyphs and

PDFBox 2.0: invisible lines on rotated page - clip path issue

ε祈祈猫儿з 提交于 2020-02-23 07:11:33
问题 File example: click here Using great solution from this topic I try to extract visible text. Attached document has very small text which maybe cause this clip path problem where some part of letters could be hidden. For such rotated text I changed code from linked issue a bit: @Override protected void processTextPosition(TextPosition text) { PDGraphicsState gs = getGraphicsState(); Vector center = getTextPositionCenterPoint(text); Area area = gs.getCurrentClippingPath(); if (area == null ||

PDFBox 2.0: invisible lines on rotated page - clip path issue

徘徊边缘 提交于 2020-02-23 07:09:59
问题 File example: click here Using great solution from this topic I try to extract visible text. Attached document has very small text which maybe cause this clip path problem where some part of letters could be hidden. For such rotated text I changed code from linked issue a bit: @Override protected void processTextPosition(TextPosition text) { PDGraphicsState gs = getGraphicsState(); Vector center = getTextPositionCenterPoint(text); Area area = gs.getCurrentClippingPath(); if (area == null ||

PDFBox 2.0: invisible lines on rotated page - clip path issue

[亡魂溺海] 提交于 2020-02-23 07:09:14
问题 File example: click here Using great solution from this topic I try to extract visible text. Attached document has very small text which maybe cause this clip path problem where some part of letters could be hidden. For such rotated text I changed code from linked issue a bit: @Override protected void processTextPosition(TextPosition text) { PDGraphicsState gs = getGraphicsState(); Vector center = getTextPositionCenterPoint(text); Area area = gs.getCurrentClippingPath(); if (area == null ||

How to add VRI dictonary into a PDF

我的未来我决定 提交于 2020-02-08 08:52:09
问题 there! I'm using pdfbox 1.8.11 to do pdf signature, I could create a LTV-enabled signature with DSS dictionary embedded. Now the problem is the certificate verification when there are multiple signatures. According to PDF 2.0 LTV and PAdES LTV specification, it is allowed to add VRI for each signature, so that it is possible verify related revocation data for each specific signature. Any idea how to add VRI dictionary for the signature? As the key for VRI is the a base-16-encoded hash, which

Using PDFBox to get location of line of text

依然范特西╮ 提交于 2020-02-02 05:03:08
问题 I'm using PDFBox to extract information from a pdf, and the information I'm currently trying to find is related to the x-position of the first character in the line. I can't find anything related to how to get that information though. I know pdfbox has a class called TextPosition, but I can't find out how to get a TextPosition object from the PDDocument either. How do I get the location information of a line of text from a pdf? 回答1: In general To extract text (with or without extra

PDFBox: Remove a single field from PDF

拈花ヽ惹草 提交于 2020-01-26 04:35:12
问题 The simplest way I can describe the problem is that we to use PDFbox to remove only one field from a PDF that is sent to us from HelloSign. (e.g. Credit Card Number) The data in question will always be on the last page, and it will always be at the same coordinates in the page. The data needs to be completely removed from the PDF. We can't simply change the font to white or draw a box on top as it will still be selectable, and thus, can be copied. Only that one field can be removed. We still

PDFBox: put two A4 pages on one A3

旧巷老猫 提交于 2020-01-25 20:41:10
问题 I have a pdf document with one or more pages A4 paper. The resulting pdf document should be A3 paper where each page contains two from the first one (odd on the left, even on the right side). I already got it to render the A4 pages into images and the odd pages are successfully placed on the first parts of a new A3 pages but I cannot get the even pages to be placed. public class CreateLandscapePDF { public void renderPDF(File inputFile, String output) { PDDocument docIn = null; PDDocument