pdfinfo-1.5.4: Wrapper around the pdfinfo command.

Safe HaskellNone
LanguageHaskell98

Text.PDF.Info

Contents

Synopsis

Reading PDF info

pdfInfo :: MonadIO m => FilePath -> m (Either PDFInfoError PDFInfo) #

Run pdfinfo on the given file. Handles IO exceptions to do with running the process.

data PDFInfo #

A type representing the output from the pdfinfo command.

Constructors

PDFInfo 

Fields

Instances

data PDFSize #

Size of the PDF in pts.

Constructors

PDFSize 

Fields

Instances

data PDFEncryptionInfo #

Encryption and restricted permissions

Constructors

PDFNoEncryption

Not encrypted

PDFEncryption

Encrypted with possible permission restrictions

Fields

data PDFInfoError #

Possible things that can go wrong while reading the info.

Constructors

ParseError !String

Couldn't parse a property value.

ProcessFailure !Text

Process exited with this stderr.

ProcessError !IOException

Error to do with the pdfinfo process.

NoMessage

No message given.

SomeError String

Some nonspecific error.

Internals

parse :: Text -> Either PDFInfoError PDFInfo #

Parse PDFInfo's output.

parseSize :: Text -> ParsePDFInfo PDFSize #

Parse a page size. This is loosely defined.

parseDate :: Text -> ParsePDFInfo UTCTime #

Parse a date according to pdfinfo's format.

parseEncrypted :: Text -> ParsePDFInfo PDFEncryptionInfo #

Parse encryption information according to pdfinfo's format.

readRight :: (MonadError PDFInfoError m, Read a) => Text -> m a #

Read a value, maybe, allow misc trailing data.