GithubHelp home page GithubHelp logo

micahhahn / pdf-toolbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuras/pdf-toolbox

0.0 1.0 0.0 568 KB

A collection of tools for processing PDF files in Haskell

Makefile 0.10% Haskell 99.90%

pdf-toolbox's Introduction

pdf-toolbox

Haskell CI

A collection of tools for processing PDF files

Features

  • Written in Haskell
  • Parsing on demand. You don't need to parse or load into memory the entire PDF file just to extract one image
  • Different levels of abstraction. You can inspect high level (catalog, page tree, pages) or low level (xref, trailer, object) structure of PDF file. You can even switch between levels of details on the fly.
  • Extremely fast and memory efficient when you need to inspect only part of the document
  • Resonably fast and memory efficient in general case
  • Text extraction with exact glyph positions It can be used e.g. to implement text selection and copying in pdf viewer
  • Full support of xref streams and object streams
  • Supports editing of PDF files (incremental updates)
  • Basic support for PDF file generating
  • Encrypted PDF documents are partially supported

Still in TODO list

  • Linearized PDF files
  • Higher level API for incremental updates and PDF generating

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

pdf-toolbox's People

Contributors

asr avatar dminuoso avatar hsenag avatar ludat avatar lueck avatar ryantrinkle avatar sid-kap avatar yuras avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.