【问题标题】:PDF Table Text ExtractionPDF表格文本提取
【发布时间】:2015-09-07 18:17:21
【问题描述】:

我知道表格文本提取并不是每个人都喜欢的。但是在阅读有关表格的 PDF 流数据时,有些事情我不明白。

表格的PDF码流为:

q                                    % Graphic State Starting Point

0 292.5 595.3 442.8 re               % Rectangle x y Width Height
W*                                   % Clipping Even Odd Rule
n                                    % End without Filling

0 0 0 rg                             % Color of Stroke
161 735 m                            % Move to New Path
160.8 734.7 l  89.3 734.7 l 89 735 l  88.8 735.3 l 161.3 735.3 l
161 735 l                            % straight line
h                                    % Close the Current Path
f*                                   % Fill Path with Even Odd Rule
Q

下划线是:

q                                 % Graphic State Starting Point
1 0 0 1 451.5 759.5 cm            % Current matrix
0.5 w                             % Width of Stroke
0 0 0 RG                          % color
0 -0.8 m                          % Move to New Path
72 -0.8 l                         % Straight Line
S                                 % Stroke Line
Q                                 % End of Graphic State

在下划线中,m 修改 cm 并将其设置为 451.5 759.5,并从当前点(即 451.5)到 72 点(即 493.5)绘制直线,小于 0.8 到cm,即 759.5

我现在不明白,表格线如何从哪一点画到哪一点。

【问题讨论】:

  • 你为什么在你的问题中混合水平和垂直运动?基本上你是说一些 x 运动不等于其他一些 y 运动。
  • @Jongware 我不明白你想说什么?
  • 那是一系列重叠的长扁平矩形。 Y 仅从 734.7 变化到 735.3。将在视觉上显示为一条线
  • @dwarring 但是你是怎么得出这个结论的

标签: pdf text-extraction coordinate-transformation


【解决方案1】:

考虑画线部分,其中m 是移动到运算符,l 是 line-to:

               % command   coordinates
               % =====================              
161 735 m      % Move-to   a(161, 735)
160.8 734.7 l  % line-to   b(161, 735 -.3)
89.3  734.7 l  % line-to   c(90,  735 -.3)
89    735   l  % line-to   d(90,  735)
88.8  735.3 l  % line-to   e(90,  735 +.3)
161.3 735.3 l  % line to   f(161, 735 +.3)
161   735   l  % line to   g(161, 735)
h              % close-path
f              % fill

x 在 160 和 89 附近有一些奇怪的微小变化,太小而无法在视觉上注册 - 渲染怪癖?)。

[在非常高分辨率的线下会有箭头

<============ ...   =======>

]

除此之外,它还绘制了一个非常细的带有角的长框(89, 734,7)(161, 734.7)(161, 735.3)(89, 735.3)。 y 轴上 +/- ).3 点的影响最有可能产生稍微加粗的线而不是矩形的效果。

【讨论】:

    猜你喜欢
    • 2012-05-05
    • 2021-11-14
    • 2018-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多