简体   繁体   English

Word / Doc / Pdf文件到CSV文件格式

[英]Word/Doc/Pdf file to csv file format

I'm developing a PHP project i just want to know that is it possible to convert a doc/pdf file into csv file format then i would be able to import it to database (mysql). 我正在开发一个PHP项目,我只是想知道可以将doc / pdf文件转换为csv文件格式,然后将其导入数据库(mysql)。

I've tried every tutorial but failed to get an answer 我已经尝试了所有教程,但没有得到答案

You may use the source code samples below to extract data from PDF to CSV in PHP using Cloud API (low level). 您可以使用下面的源代码示例,使用Cloud API(低级)将数据从PDF提取到PHP中的CSV。

Code Sample (PDF to CSV): 代码示例(PDF到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;
            }
            ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM