Safe Haskell | None |
---|---|
Language | Haskell2010 |
Write PDF files
It could be used to generate new PDF file or to incrementally update the existent one
To generate new file, first call writeHeader
,
then a number of writeObject
and finally writeXRefTable
or writeXRefStream
.
To incrementally update PDF file just omit the
writeHeader
and append the result to the existent file.
Make sure to use writeXRefTable
if the original file uses xref table,
or use writeXRefStream
if it uses xref stream.
Synopsis
- data Writer
- makeWriter :: OutputStream ByteString -> IO Writer
- writeHeader :: Writer -> IO ()
- writeObject :: Writer -> Ref -> Object -> IO ()
- writeStream :: Writer -> Ref -> Dict -> ByteString -> IO ()
- deleteObject :: Writer -> Ref -> Int64 -> IO ()
- writeXRefTable :: Writer -> Int64 -> Dict -> IO ()
- writeXRefStream :: Writer -> Int64 -> Ref -> Dict -> IO ()
Documentation
makeWriter :: OutputStream ByteString -> IO Writer Source #
writeHeader :: Writer -> IO () Source #
Write PDF header. Used for generating new PDF files. Should be the first call. Not used fo incremental updates
writeStream :: Writer -> Ref -> Dict -> ByteString -> IO () Source #
Write stream
Write xref table. Should be the last call. Used for generating and incremental updates.
Note that when doing incremental update you should use this function
only if the original PDF file has xref table. If it has xref stream,
then use writeXRefStream
.
:: Writer | |
-> Int64 | size of the original PDF file. Should be 0 for new file |
-> Ref | |
-> Dict | trailer |
-> IO () |
Write xref stream. Should be the last call. Used for generating and incremental updates.
Note that when doing incremental update you should use this function
only if the original PDF file has xref stream. If it has xref table,
then use writeXRefTable
.
This function will update/delete the following keys in the trailer: Type, W, Index, Filter, Length.