作者:小小明,「快学Pthon」专栏作者
先说需求:PDF文件结构都一致,对于下图红框区域截图并提取文本
测试pdfplumber库
先试用一下pdfplumber看看能否提取出文本
import pdfplumber
with pdfplumber.open("测试文档.pdf") as p:
page = p.pages[0]
print(page.extract_text())
运行结果:
Date of Test : 2020-11-05 R
Test Engineer : ? e
s
KAYSER-THREDE Contact Name : WX u
l
00 EVAluation Version: 2.1.7 sample.def ta
1 n
t
0
8
Z0
Y, 6
X,
g] 40 1
n [ . P
o
ati20 ag
r
e e
cel o
ac0 f J
071H 7
-20 .0; Vo = 15 / 2020-11HEAD00ead Acce 822-75
0-40 3.889 m1-0500E2ACleration -HFC
1080 /s; M = 11 RA / CFC SP 1 Res A_202
g]60 60 kg 1000ultant 0_11_
t [ 0
n 5
ulta40 13
s
e _
r0 2
2 5
00
0 F
-200 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 rid
a
time [ms] y
, 6
.1
A1
Analysis Interval: 0 - 1000 [ms] naly.202
Max(61 ms) = 72 g; Min(4.3 ms) = 0.04043 g s0
cHoICn t=. A330m7 (s5(55.64. 6-1 6 -6 .539 m.61s )m; Hs)IC =3 665 =.7 340 g7; ( c5u5.m4 .- A 636m.3s m =s 7);0 H.1I8C g15 = 307