mupdf
mupdf
Crystal bindings for MuPDF, a library for managing PDFs and converting them to and from other formats.
Installation
-
Add the dependency to your
shard.yml:dependencies: mupdf: github: jgaskins/mupdf -
Run
shards install
Usage
Convert PDFs to PNGs
require "mupdf"
# You need to instantiate it with the version of MuPDF you have installed.
converter = MuPDF::ImageConverter.new("1.27.1")
# Save a specific page as a PNG file
converter.convert_to_png("input.pdf", "page0.png", page_num: 0, dpi: 150)
# Get the total number of pages
puts converter.page_count("input.pdf")
# Get raw RGB pixel data for a page
pixels = converter.get_image_data("input.pdf", page_num: 0, dpi: 300)
Contributing
- Fork it (https://github.com/jgaskins/mupdf/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Jamie Gaskins - creator and maintainer
Repository
mupdf
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- 3 days ago
- February 14, 2026
License
MIT License
Links
Synced at
Sat, 14 Feb 2026 05:27:27 GMT
Languages