Skip to content

Commit

Permalink
added function to parse base64 encoded PDFs (#493)
Browse files Browse the repository at this point in the history
* added function to parse base64 encoded PDFs

* added information about Base64 PDFs

* Removed Parser::parseB64

Removed because we decided to focus on improving documentation.

* Reverted many changes, kept only the doc part about base64 encoding

Co-authored-by: juan miguel <[email protected]>
Co-authored-by: Konrad Abicht <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2022
1 parent e056671 commit 1991526
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,20 @@ To check coding styles run:
To run a static code analysis use:

> make run-phpstan
## Base64 encoded PDFs

If working with [Base64](https://en.wikipedia.org/wiki/Base64) encoded PDFs you might want to parse the PDF without saving the file on disk. This sample will parse the Base64 encoded PDF and extract text from each page.

```php
<?php
// Include Composer autoloader if not already done.
include "vendor/autoload.php";

// Parse Base64 encoded PDF string and build necessary objects.
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseContent(base64_decode($base64PDF));

$text = $pdf->getText();
echo $text;
```
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ There is no active development by the author of this library (at the moment), bu

Original PDF References files can be downloaded from this url: http://www.adobe.com/devnet/pdf/pdf_reference_archive.html

**For developers**: Please read [DEVELOPER.md](DEVELOPER.md) for more information about local development of the PDFParser library.
### For developers

Please read [DEVELOPER.md](DEVELOPER.md) for more information about local development of the PDFParser library. Here you will also find information about how to handle Base63 encoded PDFs.

## Installation

Expand Down

0 comments on commit 1991526

Please sign in to comment.