Code Monkey home page Code Monkey logo

pdfinfo's Introduction

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

What is pdfinfo

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.

Installation

1. Install pdfinfo

First you need to have pdfinfo in your system.

For ubuntu, there's an easy way for doing this:

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.*"

Usage

Just pass the path to the pdf file to the constructor, and you can get metadata from its properties immediately:

$pdf = new PDFInfo('path/to/the/pdf');
echo $pdf->title; // Get the title
echo $pdf->pages; // Get the number of pages

Exceptions

This library throws 4 kind of exceptions to represent the official exit codes.

  • OpenPDFException
  • OpenOutputException
  • PDFPermissionException
  • OtherException

Check the official documentation for more information.

Reference

Currently this library supports the following metadata:

  • title
  • author
  • creator
  • producer
  • creationDate
  • modDate
  • tagged
  • form
  • pages
  • encrypted
  • pageSize
  • fileSize
  • optimized
  • PDFVersion
  • pageRot

pdfinfo's People

Contributors

howtomakeaturn avatar vluzrmos avatar mhor avatar matthieumota avatar nenillo avatar sidroberts avatar yediel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.