mupdf

Crystal bindings to MuPDF

mupdf

Crystal bindings for MuPDF, a library for managing PDFs and converting them to and from other formats.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      mupdf:
        github: jgaskins/mupdf
    
  2. 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

  1. Fork it (https://github.com/jgaskins/mupdf/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

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