Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- data File
- withPdfFile :: FilePath -> (File -> IO a) -> IO a
- lastTrailer :: File -> IO Dict
- findObject :: File -> Ref -> IO Object
- data Object
- data Name
- type Dict = HashMap Name Object
- type Array = Vector Object
- data Ref = R Int Int
- data Stream = S Dict Int64
- streamContent :: File -> Ref -> Stream -> IO (InputStream ByteString)
- data EncryptionStatus
- encryptionStatus :: File -> IO EncryptionStatus
- setUserPassword :: File -> ByteString -> IO Bool
- defaultUserPassword :: ByteString
Documentation
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.
Any pdf object
Names usually are used as keys in dictionaries
Byte 0 is not allowed inside names
Object reference, contains object index and generation
Contains stream dictionary and an offset in file
streamContent :: File -> Ref -> Stream -> IO (InputStream ByteString) Source #
Get content of the stream
It's decrypted and decoded using registered StreamFilter
s if necessary.
data EncryptionStatus Source #
Describes wether PDF file is encrypted, plain or already decrypted
Instances
Enum EncryptionStatus Source # | |
Defined in Pdf.Core.File succ :: EncryptionStatus -> EncryptionStatus # pred :: EncryptionStatus -> EncryptionStatus # toEnum :: Int -> EncryptionStatus # fromEnum :: EncryptionStatus -> Int # enumFrom :: EncryptionStatus -> [EncryptionStatus] # enumFromThen :: EncryptionStatus -> EncryptionStatus -> [EncryptionStatus] # enumFromTo :: EncryptionStatus -> EncryptionStatus -> [EncryptionStatus] # enumFromThenTo :: EncryptionStatus -> EncryptionStatus -> EncryptionStatus -> [EncryptionStatus] # | |
Eq EncryptionStatus Source # | |
Defined in Pdf.Core.File (==) :: EncryptionStatus -> EncryptionStatus -> Bool # (/=) :: EncryptionStatus -> EncryptionStatus -> Bool # | |
Show EncryptionStatus Source # | |
Defined in Pdf.Core.File showsPrec :: Int -> EncryptionStatus -> ShowS # show :: EncryptionStatus -> String # showList :: [EncryptionStatus] -> ShowS # |
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