问题标签 [pdfbox]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
859 浏览

pdfbox - Lucene - 有效的文本搜索

我有一个由 pdfbox api 类生成的索引LucenePDFDocument。由于索引仅包含文本内容,我希望有效地搜索此索引。

我将使用搜索字符串搜索“内容”字段,结果顺序必须从最相关到​​最不相关。下面给出的代码确实显示了包含搜索文本单词的文件,例如“您的国籍是什么”,但结果不包含包含完整句子的文件。

在上述场景中,我应该使用什么查询解析器和查询进行搜索。

0 投票
1 回答
3330 浏览

java - PDFBox - 坐标系

我想完成以下事情。我有一组 PDF 文件,首先我想检查坐标系的原点。如果 pdf 坐标系的原点不是左上角 [通常原点在左下角],我想创建一个坐标在左上角的结果 PDF。我正在尝试使用 PDFBox [代码片段如下] 执行此操作,但是生成的 PDF 是空白的,我做错了什么。我是 PDFBox 的新手,因此非常感谢这方面的任何帮助。

0 投票
1 回答
1747 浏览

java - Linux 上的 Java + PDFBox

我需要为将使用 PDFBox 的服务器编写一个小程序。我正在使用 NetBeans 在 Windows 下编写代码。将 PDFBox jar 导出到服务器后,如何将其添加到我的程序 jar 中?

0 投票
3 回答
16955 浏览

java - Java关闭PDF错误

我有这个java代码:

并抛出这个:

我不知道为什么,但抛出这个 1、2、3 或更多。

我发现 COSDocument 是一个类并且有 close() 方法,但我没有在任何地方使用这个类。

我有这个进口:

谢谢 :)

0 投票
1 回答
1913 浏览

pdf-generation - 使用 PDFBox 在 PDF 中插入带有链接的图像

我有多个 PDF,我想在链接到http://xyz.com的每个页面上插入一个徽标(也就是说,单击该徽标会在浏览器中打开 xyz.com)。另外,我想在徽标旁边插入一些文本“单击此处在 xyz.com 上查看此页面”,其中“单击此处”是一个链接(每个页面上的链接不同,例如http://xyz.com/show。 php?id=76&page=3 )

我已经能够添加徽标和文本,但无法弄清楚如何使文本成为链接。

0 投票
3 回答
6053 浏览

pdf - 如何在 PDF 中插入不可见的文本?

更新:请参阅https://softwarerecs.stackexchange.com/questions/71464/java-library-to-insert-invisible-text-into-a-pdf

我想在现有的 PDF 文件中插入不可见的文本,使其可搜索。

我应该使用什么库
我会很感激链接到特定的API 方法来使用。

免费,最好是开源的。
非常感谢!

(对于好奇的:我想在 Alfresco 存储库中自动 OCR 传入的扫描文件并使其可搜索)

0 投票
1 回答
2602 浏览

java - Java PDF 操作,基于模式匹配替换文本,带有超链接

有谁知道获取pdf文档的最佳方法,并替换所有匹配模式的子字符串( [AZ][AZ][AZ] ' ' [0-9][0-9][0-9][ 0-9]|[AZ] ),并将其替换为指向相同字符串的相同字符串的超链接。

我计划允许用户查看 pdf 文档(这是他们可以攻读学位的课程列表),并允许用户单击课程,以便将其添加到列表中。

我知道我可以将超链接侦听器添加到 JEditorPane,并且我假设它可以处理 pdf 中的超链接(我希望)

我正在研究 pdfbox 和 iText,但到目前为止,我一直坚持如何替换文本。

*我计划从 URL 中提取 pdf,并即时格式化超链接(也无需导出到文件)。

期待反馈。

0 投票
0 回答
3209 浏览

java - PDFBox - options to increase the performance

I have 2 questions regarding PDFBox library (JAVA):

  1. I have just started using PDFBox library and though it's working well, I couldn't help noticing that it runs slower than ITEXT (the other pdf library I used) when using ut.mergeDocuments() method (against concat_pdf.main(..) of ITEXT). Does any one know if/how I can increase the performance of this tool?

  2. I see that PDFBox is more sensitive to encrypted files. The ITEXT is allowing me to do merge on encrypted PDF's but PDFBox is throwing an exception stating:

    "PDFBoxConcat failedjava.io.IOException: Error: destination PDF is encrypted, can't append encrypted PDF documents."

Does any one know how come it works on ITEXT but not on PDFBox?
My guess is that the ITEXT is more sophisticated to know exactly what is encrypted and allowing actions by that, while the PDFBox is just checking if it's encrypted or not.

Can anyone confirm this for me?

I have this code (open source) of pfdBox for the mergeDocuments() method where you can see the check for encryption:

I tried to put this on remark but the merged document came out as gibberish.


Just adding some code examples of my attempts to improve performance.

These are the 3 different ways I tried to do this:

0 投票
1 回答
1070 浏览

pdf - 除了itext,PDFbox之外,还有其他方法可以使用Java应用程序读/写PDF文件吗?

我试过 iText 和 PDFBox 。这并不简单,我们需要了解很多代码。任何人都可以提供一种使用 Java Application 读写 PDF 的简单方法吗?确保应用程序是独立的,并且不需要任何 Web/应用程序服务器。

0 投票
1 回答
1465 浏览

java - apache PDFBox 1.3.1的PDF提取问题

我在使用 apache PDFBox 从 PDF 中提取数据时遇到了一些问题。使用 PDFBox 1.1 版,我能够正确提取数据。但是相同的代码在 1.3.1 版本中给出了不同的输出。只有少数PDF,我面临这个问题。

代码示例

这是示例输出:

使用 1.1 版:帐号 xxxxx xxxxxx-xx-x .....

With version 1.3.1: SCHDoe SISInrPnnvuttccraareillreuucfczeX dde,Pt reeF Hr rusdeDiIBc N dsDVeOe I:PiiTgdtlaYieutais Bll sXPuwF rn ew df ew l er .rdceo dS mwecritvhaiscte.cso 0 m 2 / 1 2 - 0431/01-1649-9105040.99 MURTgs Ac Bw TAoiucllttciaonol g PuA Danmyta otNeuunmt Dbueer 00$0T P9122a5/0/g3117e198。/4/211 17 11o6f0 3498-01-6 THITTTPTNoFHHoDC ttEE HDaaDE lliiAAP ggVXAM-hiTRtTFda A Tueo .....

有人知道可能是什么问题吗?