Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
* Re-arrange structure
* Compatibility with version 4.0 (mac OS)
* Readme update
  • Loading branch information
rcknr authored May 27, 2019
1 parent beb9544 commit 5196aa0
Show file tree
Hide file tree
Showing 14 changed files with 187 additions and 306 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.*
!.gitignore
vendor/*
composer.phar
composer.lock
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
- Adapted version for EV Conversion Worker

Simple PHP wrapper to the pdfinfo unix tool.

Inspired by http://stackoverflow.com/questions/14644353/get-the-number-of-pages-in-a-pdf-document/14644354
Expand All @@ -10,7 +8,7 @@ pdfinfo is an unix tool helping extract information from pdf files.

http://linuxcommand.org/man_pages/pdfinfo1.html

You can get page count, title, author..etc via the tool.
You can get metadata, page count and rotation for every page, etc.

# Installation

Expand All @@ -26,7 +24,7 @@ sudo apt-get install poppler-utils
## 2. Install the library
You can just download the file to your project, or install it via composer:
```
composer require "howtomakeaturn/pdfinfo:1.*"
composer require apilayer/pdfinfo
```

# Usage
Expand All @@ -45,7 +43,7 @@ This library throws 4 kind of exceptions to represent the official exit codes.
* PDFPermissionException
* OtherException

Check the [official documentation](http://linuxcommand.org/man_pages/pdfinfo1.html) for more information.
Check the [official documentation](https://www.xpdfreader.com/pdfinfo-man.html) for more information.



Expand All @@ -64,7 +62,14 @@ Currently this library supports the following metadata:
* pages
* encrypted
* pageSize
* pageSizes
* fileSize
* optimized
* PDFVersion
* pageRot
* pageRots

Environment variables configuration:

* `PDFINFO_BIN` - location of PDFInfo executable
* `PDFINFO_PAGE_LIMIT` - last page to process, defaults to 999
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"name": "howtomakeaturn/pdfinfo",
"name": "apilayer/pdfinfo",
"type": "library",
"description": "simple php wrapper for pdfinfo",
"description": "pdfinfo PHP wrapper",
"keywords": ["pdf", "pdfinfo"],
"license": "MIT",
"require-dev": {
"filp/whoops": "1.1.4"
},
"autoload": {
"psr-0": {
"Howtomakeaturn\\PDFInfo": "src/"
"psr-4": {
"apilayer\\PDFInfo\\": "src/"
}
}
}
22 changes: 22 additions & 0 deletions examples/example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
require_once('../vendor/autoload.php');

use apilayer\PDFInfo\PDFInfo;

$pdf = new PDFInfo('files/Sample.pdf');

echo 'Title: ', $pdf->title, '<hr />', PHP_EOL;
echo 'Author: ', $pdf->author, '<hr />', PHP_EOL;
echo 'Creator: ', $pdf->creator, '<hr />', PHP_EOL;
echo 'Producer: ', $pdf->producer, '<hr />', PHP_EOL;
echo 'Creation date: ', $pdf->creationDate, '<hr />', PHP_EOL;
echo 'Last modified date: ', $pdf->modDate, '<hr />', PHP_EOL;
echo 'Tagged: ', $pdf->tagged, '<hr />', PHP_EOL;
echo 'Form: ', $pdf->form, '<hr />', PHP_EOL;
echo 'Pages: ', $pdf->pages, '<hr />', PHP_EOL;
echo 'Encrypted: ', $pdf->encrypted, '<hr />', PHP_EOL;
echo 'Page size: ', $pdf->pageSize, '<hr />', PHP_EOL;
echo 'Page rotation: ', $pdf->pageRot, '<hr />', PHP_EOL;
echo 'File size: ', $pdf->fileSize, '<hr />', PHP_EOL;
echo 'Optimized: ', $pdf->optimized, '<hr />', PHP_EOL;
echo 'PDF Version: ', $pdf->PDFVersion, '<hr />', PHP_EOL;
39 changes: 0 additions & 39 deletions examples/example1.php

This file was deleted.

39 changes: 0 additions & 39 deletions examples/example2.php

This file was deleted.

39 changes: 0 additions & 39 deletions examples/example3.php

This file was deleted.

41 changes: 0 additions & 41 deletions examples/example4.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Howtomakeaturn\PDFInfo\Exceptions;
namespace apilayer\PDFInfo\Exceptions;

use \Exception;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Howtomakeaturn\PDFInfo\Exceptions;
namespace apilayer\PDFInfo\Exceptions;

use \Exception;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Howtomakeaturn\PDFInfo\Exceptions;
namespace apilayer\PDFInfo\Exceptions;

use \Exception;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Howtomakeaturn\PDFInfo\Exceptions;
namespace apilayer\PDFInfo\Exceptions;

use \Exception;

Expand Down
Loading

0 comments on commit 5196aa0

Please sign in to comment.