如何将不可见的文本插入PDF? [英] How to insert invisible text into a PDF?

查看:176
本文介绍了如何将不可见的文本插入PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在现有的PDF文件中插入不可见的文字,以便进行搜索。

I want to insert invisible text into an existing PDF file, to make it searchable.

我应该使用哪个库

我希望能够使用特定 API方法的链接。

免费,理想的开源。

非常感谢!

Free, ideally open source.
Thanks a lot!

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

推荐答案

3个选项。


  1. 文字渲染模式3:没有笔画,没有填充。 myPdfContentByte.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE);

  2. 在背后绘制文字。你可能已经扫描了页面的图像。 iText的 myPdfStamper.getUnderContent(pageNum)将允许您在扫描下绘制文本。

  3. 在页面的媒体或裁剪之外绘制文本框。如果您只是想要一些随机的PDF搜索引擎来打开您的页面,这将有效,但如果您希望人们查看PDF以查看相应的文本选择框...不是那么多。

  1. Text render mode 3: "No stroke, no fill". myPdfContentByte.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE);
  2. Draw the text behind something. You've presumably got scanned images of the pages. iText's myPdfStamper.getUnderContent(pageNum) will let you draw the text under the scan.
  3. Draw the text outside the page's media or crop box. If you just want some random PDF-savvy search engine to turn up your page this will work, but if you want people looking at the PDF to see the appropriate text selection box... not so much.

这篇关于如何将不可见的文本插入PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆