fjffk简单的咖啡店科开发2方法2
环滁皆山也。其西南诸峰,林壑尤美,望之蔚然而深秀者,琅琊也。山行六七里,渐闻水声潺潺,而泻出于两峰之间者,酿泉也
???????????????????????????????
??????????????/?????????????????
............/...................
.........................../...
???????????????????????????????
>>>>>>>>>>>>>/>>>>>>>>>>>>>>>>>
ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>/>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
dsdfPK FsW]ÒØVÍQ Q README.mdnu „[µü¤ # Extract text from a pdf
[](https://packagist.org/packages/spatie/pdf-to-text)

[](LICENSE.md)
[](https://scrutinizer-ci.com/g/spatie/pdf-to-text)
[](https://packagist.org/packages/spatie/pdf-to-text)
This package provides a class to extract text from a pdf.
```php
use Spatie\PdfToText\Pdf;
echo Pdf::getText('book.pdf'); //returns the text from the pdf
```
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).
## Support us
[
](https://spatie.be/github-ad-click/pdf-to-text)
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
## Requirements
Behind the scenes this package leverages [pdftotext](https://en.wikipedia.org/wiki/Pdftotext). You can verify if the binary installed on your system by issueing this command:
```bash
which pdftotext
```
If it is installed it will return the path to the binary.
To install the binary you can use this command on Ubuntu or Debian:
```bash
apt-get install poppler-utils
```
On a mac you can install the binary using brew
```bash
brew install poppler
```
If you're on RedHat, CentOS, Rocky Linux or Fedora use this:
```bash
yum install poppler-utils
```
If you're on Windows you can download the [Xpdf command line tools](https://www.xpdfreader.com/download.html) and store its content at `C:\Program Files\xpdf-tools-win`.
The path to the `php2text.exe` executable should be `C:\Program Files\xpdf-tools-win\bin64\pdftotext.exe`.
## Installation
You can install the package via composer:
```bash
composer require spatie/pdf-to-text
```
## Usage
Extracting text from a pdf is easy.
```php
$text = (new Pdf())
->setPdf('book.pdf')
->text();
```
Or easier:
```php
echo Pdf::getText('book.pdf');
```
By default the package will assume that the `pdftotext` command is located at `/usr/bin/pdftotext`.
If it is located elsewhere pass its binary path to constructor
```php
$text = (new Pdf('/custom/path/to/pdftotext'))
->setPdf('book.pdf')
->text();
```
or as the second parameter to the `getText` static method:
```php
echo Pdf::getText('book.pdf', '/custom/path/to/pdftotext');
```
Sometimes you may want to use [pdftotext options](https://linux.die.net/man/1/pdftotext). To do so you can set them up using the `setOptions` method.
```php
$text = (new Pdf())
->setPdf('table.pdf')
->setOptions(['layout', 'r 96'])
->text()
;
```
or as the third parameter to the `getText` static method:
```php
echo Pdf::getText('book.pdf', null, ['layout', 'opw myP1$$Word']);
```
Please note that successive calls to `setOptions()` will overwrite options passed in during previous calls.
If you need to make multiple calls to add options (for example if you need to pass in default options when creating
the `Pdf` object from a container, and then add context-specific options elsewhere), you can use the `addOptions()` method:
```php
$text = (new Pdf())
->setPdf('table.pdf')
->setOptions(['layout', 'r 96'])
->addOptions(['f 1'])
->text()
;
```
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information about what has changed recently.
## Testing
```bash
composer test
```
## Contributing
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
## Security
If you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.
## Credits
- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)
## About Spatie
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
PK FsW]`Ìvg g src/Exceptions/PdfNotFound.phpnu „[µü¤ binPath = $binPath ?? $this->findPdfToText();
}
protected function findPdfToText(): string
{
$commonPaths = [
'/usr/bin/pdftotext', // Common on Linux
'/usr/local/bin/pdftotext', // Common on Linux
'/opt/homebrew/bin/pdftotext', // Homebrew on macOS (Apple Silicon)
'/opt/local/bin/pdftotext', // MacPorts on macOS
'/usr/local/bin/pdftotext', // Homebrew on macOS (Intel)
'C:\\Program Files\\xpdf-tools-win\\bin64\\pdftotext.exe', // Xpdf on Windows (x64)
];
foreach ($commonPaths as $path) {
if (is_executable($path)) {
return $path;
}
}
throw new BinaryNotFoundException("The required binary was not found or is not executable.");
}
public function setPdf(string $pdf): self
{
if (!is_readable($pdf)) {
throw new PdfNotFound("Could not read `{$pdf}`");
}
$this->pdf = $pdf;
return $this;
}
public function setOptions(array $options): self
{
$this->options = $this->parseOptions($options);
return $this;
}
public function addOptions(array $options): self
{
$this->options = array_merge(
$this->options,
$this->parseOptions($options)
);
return $this;
}
protected function parseOptions(array $options): array
{
$mapper = function (string $content): array {
$content = trim($content);
if ('-' !== ($content[0] ?? '')) {
$content = '-'.$content;
}
return explode(' ', $content, 2);
};
$reducer = fn (array $carry, array $option): array => array_merge($carry, $option);
return array_reduce(array_map($mapper, $options), $reducer, []);
}
public function setTimeout($timeout)
{
$this->timeout = $timeout;
return $this;
}
public function text(?Closure $callback = null): string
{
$process = new Process(array_merge([$this->binPath], $this->options, [$this->pdf, '-']));
$process->setTimeout($this->timeout);
$process = $callback ? $callback($process) : $process;
$process->run();
if (!$process->isSuccessful()) {
throw new CouldNotExtractText($process);
}
return trim($process->getOutput(), " \t\n\r\0\x0B\x0C");
}
public static function getText(string $pdf, ?string $binPath = null, array $options = [], $timeout = 60, ?Closure $callback = null): string
{
return (new static($binPath))
->setOptions($options)
->setTimeout($timeout)
->setPdf($pdf)
->text($callback)
;
}
}
PK FsW]eɢúß ß
composer.jsonnu „[µü¤ {
"name": "spatie/pdf-to-text",
"description": "Extract text from a pdf",
"keywords": [
"spatie",
"pdf-to-text"
],
"homepage": "https://github.com/spatie/pdf-to-text",
"license": "MIT",
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"require": {
"php": "^7.4|^8.0",
"symfony/process": "^4.0|^5.0|^6.0|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"pestphp/pest-plugin-laravel": "^1.3"
},
"autoload": {
"psr-4": {
"Spatie\\PdfToText\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Spatie\\PdfToText\\Test\\": "tests"
}
},
"scripts": {
"test": "pest"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
PK FsW]G°^¬d d
LICENSE.mdnu „[µü¤ # The MIT License (MIT)
Copyright (c) Spatie bvba
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
PK FsW]ÒØVÍQ Q README.mdnu „[µü¤ PK FsW]`Ìvg g Š src/Exceptions/PdfNotFound.phpnu „[µü¤ PK FsW]+t¢s s * ? src/Exceptions/BinaryNotFoundException.phpnu „[µü¤ PK FsW]Gۋ &