json_decode(file_get_contents(‘path/to/your/google-cloud-key.json’), true)
]);
// تحويل الملف إلى نص باستخدام Google Cloud Vision API
$response = $client->documentTextDetection($fileContent);
// استخراج النص من الاستجابة
$text = “”;
foreach ($response->getTextAnnotations() as $annotation) {
$text .= $annotation->getDescription();
}
}
}
?>
تحويل ملف PDF إلى نص
<?php
// عرض النص إذا تم تحويله
if (isset($text) && !empty($text)) {
echo '<h2>النص المحول:</h2>';
echo '<pre>' . htmlspecialchars($text) . '</pre>';
}
?>