Link Search Menu Expand Document

PDF To CSV

Convert PDF and scanned images into CSV representation with layout, columns, rows, tables.

Available Methods

Go To Samples

[POST] /pdf/convert/to/csv

Auto classification Of Incoming Documents

Use /pdf/classifier (Document Classifier) endpoint to automatically sort / detect the class of the document based on keywords-based rules. For example, you can define rules to find which vendor provided the document to find which template to apply accordingly.

Parameters

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching.
  • httpusername (optinal) - http auth user name if required to access source url.
  • httppassword (optinal) - http auth password if required to access source url.
  • pages optional. Comma-separated list of page indices (or ranges) to process. IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the of the document). For ALL pages just leave this param empty. Example: 0,2-5,7- means first page, then 3rd page to 6th page, and then the range from 8th (index = 7) page till the end of the document. Must be a String.
  • unwrap optional. Unwrap lines into a single line within table cells when lineGrouping is enabled. Must be one of: true, false.
  • rect optional. Defines coordinates for extraction, e.g. 51.8, 114.8, 235.5, 204.0. You can use PDF.co PDF Viewer with coordinates to easily select and copy coordinates. Must be a String.
  • lang optional. Sets language for OCR (text from image) to use for scanned PDF, PNG, JPG documents input when extracting text. Default is “eng”. Other languages are also supported: deu, spa, chi_sim, jpn and many others (full list of supported OCR languages is here. You can also use 2 languages simultaneously like this: eng+deu or jpn+kor (any combination).
  • inline optional. Must be one of: true to return data as inline or false to return link to output file (default).
  • lineGrouping optional. optional. Line grouping within table cells. Set to 1 to enable the grouping. Must be a String.

  • encrypt optional. Enable encryption for output file. Must be one of: true, false.
  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false.
  • name optional. File name for generated output. Must be a String.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples. For example, to change CSV separator: { 'CSVSeparatorSymbol': ';' }

Description

  • Method: POST
  • URL: /v1/pdf/convert/to/csv

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-to-csv/sample.pdf",
    "lang": "eng",
    "inline": "true",
    "unwrap": "",
    "pages": "0-",
    "rect": "",
    "async": "false",
    "encrypt": "false",    
    "name": "result.csv",
    "password": "",
    "lineGrouping": "",
    "profiles": ""
}

Example responses

/pdf/convert/to/csv
{
    "body": "\"Your Company Name\",\"\",\"\",\"\",\r\n\"Your Address\",\"\",\"\",\"\",\r\n\"City, State Zip\",\"\",\"\",\"\",\r\n\"\",\"\",\"\",\"Invoice No. 123456\",\r\n\"\",\"\",\"\",\"Invoice Date 01/01/2016\",\r\n\"Client Name\",\"\",\"\",\"\",\r\n\"Address\",\"\",\"\",\"\",\r\n\"City, State Zip\",\"\",\"\",\"\",\r\n\"Notes\",\"\",\"\",\"\",\r\n\"Item\",\"Quantity\",\"Price\",\"Total\",\r\n\"Item 1\",\"1\",\"40.00\",\"40.00\",\r\n\"Item 2\",\"2\",\"30.00\",\"60.00\",\r\n\"Item 3\",\"3\",\"20.00\",\"60.00\",\r\n\"Item 4\",\"4\",\"10.00\",\"40.00\",\r\n\"\",\"\",\"TOTAL\",\"200.00\",\r\n",
    "pageCount": 2,
    "error": false,
    "status": 200,
    "name": "result.csv",
    "remainingCredits": 616411,
    "credits": 56
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/to/csv' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-to-csv/sample.pdf",
    "lang": "eng",
    "inline": "true",
    "unwrap": "",
    "pages": "0-",
    "rect": "",
    "async": "false",
    "encrypt": "false",    
    "name": "result.csv",
    "password": "",
    "lineGrouping": "",
    "profiles": ""
}'

Samples