```php title="PHP" getContent(); } $bytes = file_get_contents('document.pdf') ?: ''; try { $text = extract_text($bytes, 'application/pdf'); echo "Extracted " . strlen($text) . " chars\n"; } catch (KreuzbergException $e) { // All Kreuzberg errors are KreuzbergException // Check the message for error type details $message = $e->getMessage(); if (strpos($message, 'not supported') !== false) { echo "Format not supported\n"; } elseif (strpos($message, 'OCR') !== false) { echo "OCR failed: " . $message . "\n"; } else { echo "Error: " . $message . "\n"; } } ```