rusty_pdf_core 0.1.0

Pure-Rust PDF reader core: objects, classic and stream cross-reference tables, object streams, incremental updates, broken-xref repair, RC4 and AES-128/256 decryption, stream filters, page tree, content streams, editing and save. Hostile input errors or stays bounded. No C, no unsafe.
Documentation
# rusty_pdf_core

Pure-Rust PDF reader core: objects, cross-reference tables and streams,
object streams, incremental updates, broken-xref repair, the standard
security handler (RC4 40 to 128 bit, AES-128, AES-256), stream filters,
the page tree, content streams, a text layer, image decoding, editing and
saving. No C, `#![forbid(unsafe_code)]`, builds for `wasm32-unknown-unknown`.

It is the object layer of [rusty_pdf](https://github.com/Remade-With-Rust/rusty_pdf),
which adds a renderer and a writer on top.

```rust
use rusty_pdf_core::{Document, ImageOptions, LoadOptions, Object, SaveMode};

let doc = Document::load_with(&bytes, &LoadOptions::with_password("secret"))?;
for i in 0..doc.page_count() {
    let page = doc.page(i)?;
    let ops = page.operations()?;                    // operators and operands
    let text = page.extract_text(64 << 20)?;         // the text layer, in content order
    let annots = page.annotations()?;                // inline or by reference
    if let Some(xobjects) = page.resources().and_then(|r| doc.lookup_dict(r, b"XObject")) {
        for (_, x) in xobjects.iter() {
            if let Object::Stream(s) = doc.resolve(x)? {
                let image = doc.decode_image(s, &ImageOptions::default())?;
            }
        }
    }
}
let bytes = doc.save(SaveMode::Rewrite)?;
```

## Hostile input

Malformed input returns an error or a bounded result. It does not panic,
loop without progress, or allocate past `Limits`:

- every stream decode takes a byte cap; images are bounded by their own
  declared size before anything is allocated, and decompression stops at the
  bytes those dimensions need;
- object nesting, reference chains, page trees, `/Prev` chains and object
  streams are walked with depth limits or visited sets;
- no allocation is sized from a number in the file without a check first.

## Image filters

`DCTDecode`, `JPXDecode`, `JBIG2Decode` and `CCITTFaxDecode` decode through
the house crates `rusty_jpeg`, `rusty_jpx`, `rusty_jbig2` and
`rusty_tiff::ccitt`, each behind a default feature (`dct`, `jpx`, `jbig2`,
`ccitt`). A build that only reads objects can turn them all off.

## Licence

MIT OR Apache-2.0.