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

Pdf.Core.Writer

Description

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

Documentation

writeHeader :: Writer -> IO () Source #

Write PDF header. Used for generating new PDF files. Should be the first call. Not used fo incremental updates

writeObject :: Writer -> Ref -> Object -> IO () Source #

Write object

writeStream :: Writer -> Ref -> Dict -> ByteString -> IO () Source #

Write stream

deleteObject :: Writer -> Ref -> Int64 -> IO () Source #

Delete object

writeXRefTable Source #

Arguments

:: Writer 
-> Int64

size of the original PDF file. Should be 0 for new file

-> Dict

trailer

-> IO () 

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.

writeXRefStream Source #

Arguments

:: 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.