pdfinfo-1.4.0: Wrapper around the pdfinfo command.

Safe HaskellNone

Text.PDF.Info

Contents

Synopsis

Reading PDF info

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

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

data PDFInfo Source

A type representing the output from the pdfinfo command.

Constructors

PDFInfo 

Fields

pdfInfoTitle :: !(Maybe Text)

Title

pdfInfoSubject :: !(Maybe Text)

Subject

pdfInfoAuthor :: !(Maybe Text)

Author: E.g. Chris Done

pdfInfoCreator :: !(Maybe Text)

Creator: E.g. Microsoft Office Word 2007

pdfInfoProducer :: !(Maybe Text)

Producer: E.g. Microsoft Office Word 2007

pdfInfoCreationDate :: !(Maybe UTCTime)

Creation Date

pdfInfoModDate :: !(Maybe UTCTime)

Modification Date

pdfInfoTagged :: !(Maybe Bool)

Tagged?

pdfInfoPages :: !(Maybe Integer)

Pages: E.g. 238

pdfInfoEncrypted :: !(Maybe Bool)

Encrypted?

pdfInfoPageSize :: !(Maybe PDFSize)

Page: E.g. 595.32 x 841.92 pts (A4)

pdfInfoFileSize :: !(Maybe Integer)

File: E.g. 4061737 bytes

pdfInfoOptimized :: !(Maybe Bool)

Optimized?

pdfInfoPDFVersion :: !(Maybe Double)

PDF: E.g. 1.5

Instances

data PDFSize Source

Size of the PDF in pts.

Constructors

PDFSize 

Fields

pdfSizeW :: !Float
 
pdfSizeH :: !Float
 

Instances

data PDFInfoError Source

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 PDFInfoSource

Parse PDFInfo's output.

parseSize :: Text -> ParsePDFInfo PDFSizeSource

Parse a page size. This is loosely defined.

parseDate :: Text -> ParsePDFInfo UTCTimeSource

Parse a date according to pdfinfo's format.

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

Read a value, maybe, allow misc trailing data.