pdf-toolbox-core-0.0.2.0: A collection of tools for processing PDF files.

Safe HaskellNone

Pdf.Toolbox.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 writePdfHeader, then a number of writeObject and finally writeXRefTable

To incrementally update PDF file just ommit the writePdfHeader and append the result to the existent file

Synopsis

Documentation

data PdfWriter m a Source

The monad

Instances

MonadTrans PdfWriter 
Monad m => Monad (PdfWriter m) 
MonadIO m => MonadIO (PdfWriter m) 

runPdfWriterSource

Arguments

:: MonadIO m 
=> OutputStream ByteString

streams to write to

-> PdfWriter m a

action to run

-> m a 

Execute writer action

writePdfHeader :: MonadIO m => PdfWriter m ()Source

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

writeObject :: MonadIO m => Ref -> Object ByteString -> PdfWriter m ()Source

Write object

deleteObject :: MonadIO m => Ref -> Int64 -> PdfWriter m ()Source

Delete object

writeXRefTableSource

Arguments

:: MonadIO m 
=> Int64

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

-> Dict

trailer

-> PdfWriter m () 

Write xref table. Should be the last call. Used for generating and incremental updates.