如何在Laravel中将Amazon Textract与图像,pdf和aws-sdk-php等文档一起使用

时间:2020-02-12 13:29:32

标签: php laravel

我正在研究AWS textract,以从诸如PDF和Image之类的文档中提取文本,表格和表格。如果有人对AWS sdk php有解决方案,请与我分享您的答案。

$image = $request->file('bill_file');
$imagePath = $image->getPathName();
$fp_image = fopen($imagePath, 'rb');
$image = fread($fp_image, filesize($imagePath));
fclose($fp_image);
$client = new TextractClient([
'version'     => '2018-06-27',
'region'      => 'XXXXXXXXX',
'credentials' => [
'key'    => 'XXXXXXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
]

]);
$options = [
'Document' => [
'Bytes' => $image
],
'FeatureTypes' => ['FORMS','TABLES'], 
];
$result = $client->analyzeDocument($options);
$blocks = $result['Blocks'];

这段代码给了我文本,行,表格,表格单元格和表格

如何使用带有文本和行的单元格打印表,我正在使用laravel 5.7

0 个答案:

没有答案