首页 \ 问答 \ 如何使用Apache Tika获取PDF格式的元素样式信息?(How to get style information of elements in PDF using Apache Tika?)

如何使用Apache Tika获取PDF格式的元素样式信息?(How to get style information of elements in PDF using Apache Tika?)

我正在玩Apache Tika从PDF文件中提取文本。 我想知道如何使用Apache Tika获取字体大小,文本颜色,特定文本(几个单词)是否为斜体,粗体等样式信息?

是否有可能获得此类信息?

另外我想如果有可能使用Apache Tika获取表信息? 表格的开头,第一行的开头,第一个单元格等信息。


I am playing around with Apache Tika to extract text from PDF files. I would like to know how to get style information like font size, text color, whether specific piece of text (few words) are in Italics, Bold, etc. using Apache Tika?

Is it even possible to get this type of information?

Also I would like to if it is possible to get table information using Apache Tika? Information like start of table, start of first row, first cell, etc.


原文:
更新时间:2022-09-06 14:09

最满意答案

不要将文本区域添加到框架中。

this.add(input); 

相反,您需要将包含文本区域的JScrollPane添加到框架中:

this.add(new JScrollPane(input)); 

Don't add the text area to the frame.

this.add(input); 

Instead you need to add a JScrollPane containing the text area to the frame:

this.add(new JScrollPane(input)); 

相关问答

更多
  • 好的,所以问题是JPanel不喜欢嵌入到JScrollPane中。 为了使组件能够“与JScrollPane一起玩”,它需要实现Scrollable。 如果您只是将JTextArea添加到JScrollPane中,它将按您的需要完全工作。 您不需要使用JPanel来保存所有的JTextAreas,您需要创建一个扩展JPanel并实现Scrollable的小型自定义类。 我已经重新编写了你的例子并粘贴到这里: http : //pastebin.com/q9x4fv3H,这样你就可以看到所有的代码。 Scro ...
  • 最有可能的问题是由于右侧面板上使用的BoxLayout 。 从类javadoc复制粘贴: BoxLayout尝试以其首选宽度(水平布局)或高度(垂直布局)排列组件。 对于水平布局,如果不是所有组件都具有相同的高度,BoxLayout会尝试使所有组件与最高组件一样高。 如果对于特定组件不可能,则BoxLayout根据组件的Y对齐垂直对齐该组件。 默认情况下,组件的Y对齐为0.5,这意味着组件的垂直中心应与具有0.5 Y对齐的其他组件的垂直中心具有相同的Y坐标。 类似地,对于垂直布局,BoxLayout尝试使列 ...
  • public class Note扩展JFrame { private static final long serialVersionUID = 1L; public Note() { createContent(); // add this line into your code. int x = 400; int y = 300; this.setSize(new Dimension(x, y)); this.setTitle("Post-It Note"); ...
  • 我相信这是因为你将你的权重设置为0(GridBagConstraints构造函数的第6个参数)。 如果您希望组件垂直增长,则需要增加此值。 If I use a BorderLayout around my elements, it works. Pete, MrWiggles, Thank you for your help!!
  • 但我只能接受一行输入 单行文本区域显示了如何执行此操作。 相关代码是 textArea.getDocument().putProperty("filterNewlines", Boolean.TRUE); but I can only accept one line of input Single Line Text Area shows how you can do this. The relevant code is textArea.getDocument().putProperty("filter ...
  • 实际上, JTextArea总是具有正确的大小,因此所有文本行都可见。 您遇到的情况可能是您将文本区域包装在JScrollPane 。 只需省略滚动窗格并将文本区域作为容器的直接子元素。 另一种解决方案是侦听文本区域的事件大小并相应地调整滚动窗格大小。 这样,您可以增长到一定的大小,然后开始显示滚动条(例如,当有人将500KB的文本粘贴到文本区域时)。 Actually, the JTextArea always has the correct size so all lines of text are v ...
  • 在JTextArea的父容器中(在图形中表示为Panel 1),调用函数: panel1.setLayout(new BorderLayout()); 供参考,请参阅此文档页面: https://docs.oracle.com/javase/7/docs/api/java/awt/BorderLayout.html 由于panel1中只有一个子节点,因此panel1的BorderLayout布局管理器将默认拉伸文本区域以使用父容器中的所有可用空间。 您可能想要删除指定TextArea大小的构造函数参数。 ...
  • JTextArea应该直接放置到JScrollPane ,只要这是你试图滚动的组件。 如果还有其他项需要滚动(因此也是中间JPanel ),那么您可能需要考虑让JPanel实现Scrollable以便JScrollPane知道如何处理它。 JTextArea实现了Scrollable ,这就是为什么它可以与JScrollPane一起使用。 JTextArea should be placed directly into the JScrollPane, as long as that is the comp ...
  • 您正在目睹的问题是GridBagLayout试图处理它无法遵守组件的preferredSize的情况,它将恢复使用组件minimumSize而不是...... 您可以使用GridBagConstraints#weightx属性强制组件始终填充其列宽... c = new GridBagConstraints(); c.gridx = 1; c.gridy = 0; c.fill = GridBagConstraints.BOTH; c.weighty = 1.0; c.weightx = 1.0; cont ...
  • 不要将文本区域添加到框架中。 this.add(input); 相反,您需要将包含文本区域的JScrollPane添加到框架中: this.add(new JScrollPane(input)); Don't add the text area to the frame. this.add(input); Instead you need to add a JScrollPane containing the text area to the frame: this.add(new JScrol ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)