Skip to content
pdf-rsPublic

About

Rust library to read, manipulate and write PDF files.

Topics

Resources

Stars

1.7k stars

Watchers

26 watching

Forks

Latest commit

 

History

916 Commits

Folders and files

Repository files navigation

PR policy.

You may use AI tools to identify bugs and find solutions, but fully automated PRs will be rejected. Write the description yourself. It is better to create an issue than creating a PR with code bloat that will be rejected because it looks synthetic.

Please create only one PR containing multiple commits. Merging multiple PRs can cause merge conflicts and usually friction that could be avoided. You may use AI in your own work, but code submitted to this repository needs to be writen by a human.

pdf-rs test

Read, alter and write PDF files.

Modifying and writing PDFs is still experimental.

One easy way you can contribute is to add different PDF files to tests/files and see if they pass the tests (cargo test).

Feel free to contribute with ideas, issues or code! Please join us on Zulip if you have any questions or problems.

Workspace

This repository uses a Cargo Workspace and default members. This means by default only the pdf library is build. To build additional parts, pass --package=read to build the subcrate you are interested in (here the read example).

Examples

Examples are located in pdf/examples/ and can be executed using:

cargo run --example {content,metadata,names,read} -- <files/{choose a pdf}>

read prints what it found in a file and writes out the images it contains (JPEG as is, CCITT as TIFF, everything else as PNG) and the embedded fonts.

Text extraction is not an example here any more: it lives in pdf_render (render/examples/trace.rs) and in pdf_text, which also puts the glyphs back together into words and lines.

Renderer and Viewer

A library for rendering PDFs via Pathfinder and minimal viewer can be found here.

Inspect

There is a tool for visualizing a PDF file as an interactive hierarchy of primitives at inspect-prim. Just clone and cargo run.

About

Rust library to read, manipulate and write PDF files.

Topics

Resources

Stars

1.7k stars

Watchers

26 watching

Forks

Used by

Contributors

Languages