pdf-toolbox-core-0.1.1: A collection of tools for processing PDF files.
Safe HaskellNone
LanguageHaskell2010

Pdf.Core

Description

Low level API for parsing PDF file.

See Pdf.Core.Writer for basic API for writing new PDF file or incrementally updating existing one.

Synopsis

Documentation

data File Source #

Pdf file is a collection of Objects

withPdfFile :: FilePath -> (File -> IO a) -> IO a Source #

Open Pdf file

You may want to check encryptionStatus and setUserPassword if file is encrypted.

lastTrailer :: File -> IO Dict Source #

The last trailer is an entry point to PDF file. All other objects usually are referensed from it, directly or indirectly.

findObject :: File -> Ref -> IO Object Source #

Get an object with the specified ref.

data Object Source #

Any pdf object

Instances

Instances details
Eq Object Source # 
Instance details

Defined in Pdf.Core.Object

Methods

(==) :: Object -> Object -> Bool #

(/=) :: Object -> Object -> Bool #

Show Object Source # 
Instance details

Defined in Pdf.Core.Object

data Name Source #

Names usually are used as keys in dictionaries

Byte 0 is not allowed inside names

Instances

Instances details
Eq Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Ord Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Show Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

IsString Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

fromString :: String -> Name #

Semigroup Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

(<>) :: Name -> Name -> Name #

sconcat :: NonEmpty Name -> Name #

stimes :: Integral b => b -> Name -> Name #

Monoid Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

mempty :: Name #

mappend :: Name -> Name -> Name #

mconcat :: [Name] -> Name #

Hashable Name Source # 
Instance details

Defined in Pdf.Core.Name

Methods

hashWithSalt :: Int -> Name -> Int #

hash :: Name -> Int #

type Dict = HashMap Name Object Source #

Dictionary

type Array = Vector Object Source #

An array

data Ref Source #

Object reference, contains object index and generation

Constructors

R Int Int 

Instances

Instances details
Eq Ref Source # 
Instance details

Defined in Pdf.Core.Object

Methods

(==) :: Ref -> Ref -> Bool #

(/=) :: Ref -> Ref -> Bool #

Ord Ref Source # 
Instance details

Defined in Pdf.Core.Object

Methods

compare :: Ref -> Ref -> Ordering #

(<) :: Ref -> Ref -> Bool #

(<=) :: Ref -> Ref -> Bool #

(>) :: Ref -> Ref -> Bool #

(>=) :: Ref -> Ref -> Bool #

max :: Ref -> Ref -> Ref #

min :: Ref -> Ref -> Ref #

Show Ref Source # 
Instance details

Defined in Pdf.Core.Object

Methods

showsPrec :: Int -> Ref -> ShowS #

show :: Ref -> String #

showList :: [Ref] -> ShowS #

Hashable Ref Source # 
Instance details

Defined in Pdf.Core.Object

Methods

hashWithSalt :: Int -> Ref -> Int #

hash :: Ref -> Int #

data Stream Source #

Contains stream dictionary and an offset in file

Constructors

S Dict Int64 

Instances

Instances details
Eq Stream Source # 
Instance details

Defined in Pdf.Core.Object

Methods

(==) :: Stream -> Stream -> Bool #

(/=) :: Stream -> Stream -> Bool #

Show Stream Source # 
Instance details

Defined in Pdf.Core.Object

streamContent :: File -> Ref -> Stream -> IO (InputStream ByteString) Source #

Get content of the stream

It's decrypted and decoded using registered StreamFilters if necessary.

encryptionStatus :: File -> IO EncryptionStatus Source #

Get encryption status.

If it's Encrypted, you may want to setUserPassword to decrypt it.

setUserPassword :: File -> ByteString -> IO Bool Source #

Set user password to decrypt PDF file.

Use empty bytestring to set the default password. Returns True on success. See also setDecryptor.

defaultUserPassword :: ByteString Source #

The default user password