Swift framework to extract tables from PDFs, wrapping Java tabula
.
TabulaKit
requires Swift 5 and Java. It has been tested on macOS, Linux and Windows.
You can extract tables from a PDF document using a TabulaPDF
instance:
import Foundation
import TabulaKit
let inputURL = URL(fileURLWithPath: "Invoice.pdf")
let inputPDF = try TabulaPDF(contentsOf: inputURL)
let extractedTables = try inputPDF.extractTables()
print(extractedTables.count)
// 1
print(extractedTables[0])
// [
// ["Service", "Cost"],
// ["mobilR", "13.95€"],
// ["comboR", "46.90€"],
// ["Other", "17.70€"]
// ]
Add the following dependency to your Package.swift
manifest:
.package(url: "https://github.com/pvieito/TabulaKit.git", .branch("master")),
TabulaKit
is heavily inspired by tabula-py
, a Python wrapper of tabula-java
.