File: quickstart.table.rst

package info (click to toggle)
pdf2docx 0.5.9-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 9,480 kB
  • sloc: python: 6,811; makefile: 82; sh: 9
file content (31 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.. include:: header.rst

Extract table
======================

::

    from pdf2docx import Converter

    pdf_file = '/path/to/sample.pdf'

    cv = Converter(pdf_file)
    tables = cv.extract_tables(start=0, end=1)
    cv.close()

    for table in tables:
        print(table)

The output may look like::

    ...
    [['Input ', None, None, None, None, None], 
    ['Description A ', 'mm ', '30.34 ', '35.30 ', '19.30 ', '80.21 '],
    ['Description B ', '1.00 ', '5.95 ', '6.16 ', '16.48 ', '48.81 '],
    ['Description C ', '1.00 ', '0.98 ', '0.94 ', '1.03 ', '0.32 '],
    ['Description D ', 'kg ', '0.84 ', '0.53 ', '0.52 ', '0.33 '],
    ['Description E ', '1.00 ', '0.15 ', None, None, None],
    ['Description F ', '1.00 ', '0.86 ', '0.37 ', '0.78 ', '0.01 ']]


.. include:: footer.rst