Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Pdf file as a set of objects
Synopsis
- data File = File {
- fileLastXRef :: XRef
- fileBuffer :: Buffer
- fileFilters :: [StreamFilter]
- fileDecryptor :: IORef (Maybe Decryptor)
- withPdfFile :: FilePath -> (File -> IO a) -> IO a
- fromHandle :: [StreamFilter] -> Handle -> IO File
- fromBytes :: [StreamFilter] -> ByteString -> IO File
- fromBuffer :: [StreamFilter] -> Buffer -> IO File
- lastTrailer :: File -> IO Dict
- findObject :: File -> Ref -> IO Object
- streamContent :: File -> Ref -> Stream -> IO (InputStream ByteString)
- rawStreamContent :: File -> Ref -> Stream -> IO (InputStream ByteString)
- data EncryptionStatus
- encryptionStatus :: File -> IO EncryptionStatus
- setUserPassword :: File -> ByteString -> IO Bool
- setDecryptor :: File -> Decryptor -> IO ()
- data NotFound = NotFound String
Documentation
Pdf file is a collection of Object
s
File | |
|
withPdfFile :: FilePath -> (File -> IO a) -> IO a Source #
Open Pdf file
You may want to check encryptionStatus
and setUserPassword
if
file is encrypted.
fromHandle :: [StreamFilter] -> Handle -> IO File Source #
Create file from a binary handle.
You may use knownFilters
as the first argument.
fromBytes :: [StreamFilter] -> ByteString -> IO File Source #
Create file from a ByteString.
You may use knownFilters
as the first argument.
fromBuffer :: [StreamFilter] -> Buffer -> IO File Source #
Create file from a buffer.
You may use knownFilters
as the first argument.
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.
streamContent :: File -> Ref -> Stream -> IO (InputStream ByteString) Source #
Get content of the stream
It's decrypted and decoded using registered StreamFilter
s if necessary.
rawStreamContent :: File -> Ref -> Stream -> IO (InputStream ByteString) Source #
Get content of the stream
Content would be decrypted 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] # | |
Show EncryptionStatus Source # | |
Defined in Pdf.Core.File showsPrec :: Int -> EncryptionStatus -> ShowS # show :: EncryptionStatus -> String # showList :: [EncryptionStatus] -> ShowS # | |
Eq EncryptionStatus Source # | |
Defined in Pdf.Core.File (==) :: EncryptionStatus -> EncryptionStatus -> Bool # (/=) :: EncryptionStatus -> EncryptionStatus -> Bool # |
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
.
setDecryptor :: File -> Decryptor -> IO () Source #
Decrypt file using the specified decryptor.
Use it if setUserPassword
doesn't work for you.
Instances
Exception NotFound Source # | |
Defined in Pdf.Core.File toException :: NotFound -> SomeException # fromException :: SomeException -> Maybe NotFound # displayException :: NotFound -> String # | |
Show NotFound Source # | |