{"id":22782192,"url":"https://github.com/randomstate/camelot-php","last_synced_at":"2025-04-15T16:29:49.762Z","repository":{"id":62533212,"uuid":"227616044","full_name":"randomstate/camelot-php","owner":"randomstate","description":"Camelot PDF table extraction library wrapper for PHP","archived":false,"fork":false,"pushed_at":"2024-11-06T18:10:19.000Z","size":865,"stargazers_count":11,"open_issues_count":6,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T22:22:08.971Z","etag":null,"topics":["pdf","table-extraction"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/randomstate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-12T13:41:09.000Z","updated_at":"2024-12-13T04:18:56.000Z","dependencies_parsed_at":"2023-01-22T06:45:22.918Z","dependency_job_id":null,"html_url":"https://github.com/randomstate/camelot-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomstate%2Fcamelot-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomstate%2Fcamelot-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomstate%2Fcamelot-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randomstate%2Fcamelot-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randomstate","download_url":"https://codeload.github.com/randomstate/camelot-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248630720,"owners_count":21136493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pdf","table-extraction"],"created_at":"2024-12-11T21:09:45.635Z","updated_at":"2025-04-15T16:29:49.740Z","avatar_url":"https://github.com/randomstate.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# randomstate/camelot-php\n\nA PHP wrapper for Camelot, the python PDF table extraction library\n\n## Installation\n\n`composer require randomstate/camelot-php`\n\n## Usage\n\nThe package adheres closely with the camelot CLI API Usage.\nDefault output is in CSV format as a simple string. If you need to parse CSV strings we recommend the `league/csv` package (https://csv.thephpleague.com/)\n\n```php\n\u003c?php\n\nuse RandomState\\Camelot\\Camelot;\nuse League\\Csv\\Reader;\n\n$tables = Camelot::lattice('/path/to/my/file.pdf')\n       -\u003eextract();\n\n$csv = Reader::createFromString($tables[0]);\n$allRecords = $csv-\u003egetRecords();\n```\n\n### Advanced Processing\n\n##### Saving / Extracting\n**Note: No Camelot operations are run until one of these methods is run**\n```php\n$camelot-\u003eextract(); // uses temporary files and automatically grabs the table contents for you from each\n$camelot-\u003esave('/path/to/my-file.csv'); // mirrors the behaviour of Camelot and saves files in the format /path/to/my-file-page-*-table-*.csv\n$camelot-\u003eplot(); // useful for debugging, it will plot it in a separate window (see Visual Debugging below)   \n```\n\n##### [Set Format](https://camelot-py.readthedocs.io/en/master/user/quickstart.html#read-the-pdf)\n```\n$camelot-\u003ejson();\n$camelot-\u003ecsv();\n$camelot-\u003ehtml();\n$camelot-\u003eexcel();\n$camelot-\u003esqlite();\n```\n##### [Specify Page Numbers](https://camelot-py.readthedocs.io/en/master/user/quickstart.html#specify-page-numbers)\n\n`$camelot-\u003epages('1,2,3-4,8-end')`\n\n##### [Reading encrypted PDFs](https://camelot-py.readthedocs.io/en/master/user/quickstart.html#reading-encrypted-pdfs)\n\n`$camelot-\u003epassword('my-pass')`\n\n##### [Processing background lines](https://camelot-py.readthedocs.io/en/master/user/advanced.html#process-background-lines)\n`$camelot-\u003estream()-\u003eprocessBackgroundLines()`\n\n##### [Visual debugging](https://camelot-py.readthedocs.io/en/master/user/advanced.html#visual-debugging)\n\n`$camelot-\u003eplot()`\n\n##### [Specify table areas](https://camelot-py.readthedocs.io/en/master/user/advanced.html#specify-table-areas)\n\n```php\n\u003c?php\n\nuse RandomState\\Camelot\\Camelot;\nuse RandomState\\Camelot\\Areas;\n\nCamelot::stream('my-file.pdf')\n    -\u003einAreas(\n        Areas::from($xTopLeft, $yTopLeft, $xBottomRight, $yBottomRight)\n            // -\u003eadd($xTopLeft2, $yTopLeft2, $xBottomRight2, $yBottomRight2)\n            // -\u003eadd($xTopLeft3, $yTopLeft3, $xBottomRight3, $yBottomRight3)\n    );\n```\n\n##### [Specify table regions](https://camelot-py.readthedocs.io/en/master/user/advanced.html#specify-table-regions)\n\n```php\n\u003c?php\n\nuse RandomState\\Camelot\\Camelot;\nuse RandomState\\Camelot\\Areas;\n\nCamelot::stream('my-file.pdf')\n    -\u003einRegions(\n        Areas::from($xTopLeft, $yTopLeft, $xBottomRight, $yBottomRight)\n            // -\u003eadd($xTopLeft2, $yTopLeft2, $xBottomRight2, $yBottomRight2)\n            // -\u003eadd($xTopLeft3, $yTopLeft3, $xBottomRight3, $yBottomRight3)\n    );\n```\n \n##### [Specify column separators](https://camelot-py.readthedocs.io/en/master/user/advanced.html#specify-column-separators)\n\n`$camelot-\u003estream()-\u003esetColumnSeparators($x1,$x2...)`\n\n##### [Split text along separators](https://camelot-py.readthedocs.io/en/master/user/advanced.html#split-text-along-separators)\n\n`$camelot-\u003esplit()`\n\n##### [Flag superscripts and subscripts](https://camelot-py.readthedocs.io/en/master/user/advanced.html#flag-superscripts-and-subscripts)\n\n`$camelot-\u003eflagSize()`\n\n##### [Strip characters from text](https://camelot-py.readthedocs.io/en/master/user/advanced.html#strip-characters-from-text)\n\n`$camelot-\u003estrip(\"\\n\")`\n\n##### [Improve guessed table areas](https://camelot-py.readthedocs.io/en/master/user/advanced.html#improve-guessed-table-areas)\n\n`$camelot-\u003esetEdgeTolerance(500)`\n\n##### [Improve guessed table rows](https://camelot-py.readthedocs.io/en/master/user/advanced.html#improve-guessed-table-rows)\n\n`$camelot-\u003esetRowTolerance(15)`\n\n##### [Detect short lines](https://camelot-py.readthedocs.io/en/master/user/advanced.html#detect-short-lines)\n\n`$camelot-\u003elineScale(20)`\n\n\n##### [Shift text in spanning cells](https://camelot-py.readthedocs.io/en/master/user/advanced.html#shift-text-in-spanning-cells)\n\n`$camelot-\u003eshiftText('r', 'b')`\n\n##### [Copy text in spanning cells](https://camelot-py.readthedocs.io/en/master/user/advanced.html#copy-text-in-spanning-cells)\n\n`$camelot-\u003ecopyTextSpanningCells('r', 'b')`\n\n\n## License\n\nMIT. Use at your own risk, we accept no liability for how this code is used.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomstate%2Fcamelot-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandomstate%2Fcamelot-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomstate%2Fcamelot-php/lists"}