You may use the source code samples below to extract data from PDF to Text or CSV in PHP using Cloud API (low level).

Also, check these code samples showing how to extract and convert spreadsheets between various file formats in PHP using Cloud API.

PDF to Plain Text

POST/GET endpoint:

https://bytescout.io/v1/pdf/convert/to/text

Code Sample (PDF to Text):

<?php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: api_key
Bytescout\Client\API\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Bytescout\Client\API\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');

$api_instance = new Swagger\Client\Api\DefaultApi();
$pages = pages_example; // String | Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'.
$name = name_example; // String | File name for generated result.
$url = url_example; // String | URL of the source PDF file.

try {
    $result = $api_instance->pdfConvertToTextPost($pages, $name, $url);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->pdfConvertToTextPost: ', $e->getMessage(), PHP_EOL;
}
?>

PDF to CSV

POST/GET endpoint:

https://bytescout.io/v1/pdf/convert/to/csv

Code Sample (PDF to CSV):

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: api_key
Bytescout\Client\API\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Bytescout\Client\API\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');

$api_instance = new Swagger\Client\Api\DefaultApi();
$pages = pages_example; // String | Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'.
$name = name_example; // String | File name for generated result.
$url = url_example; // String | URL of the source PDF file.

try {
    $result = $api_instance->pdfConvertToCsvPost($pages, $name, $url);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->pdfConvertToCsvPost: ', $e->getMessage(), PHP_EOL;
}
?>