Home

Awesome

pdf-toolbox

Haskell CI

A collection of tools for processing PDF files

Features

Still in TODO list

Examples

(Also see examples and viewer directories)

Inspect high level structure:

import Control.Monad
import Pdf.Document

main =
  withPdfFile "input.pdf" $ \pdf -> do
    encrypted <- isEncrypted pdf
    when encrypted $ do
      ok <- setUserPassword pdf defaultUserPassword
      unless ok $
        fail "need password"
    doc <- document pdf
    catalog <- documentCatalog doc
    rootNode <- catalogPageNode catalog
    count <- pageNodeNKids rootNode
    print count
    -- the first page of the document
    page <- pageNodePageByNum rootNode 0
    -- extract text
    txt <- pageExtractText page
    print txt
    ...