class

MuPDF::ImageConverter

Inherits Reference < Object

Constructors

new(version : String = self.class.version)
Source

Class methods

version
Source

Instance methods

convert_to_png(pdf_path : String, output_path : String, page page_num : Int32 = 0, dpi : Float32 = 150.0)
Source
convert_to_pngs(pdf_path : String | Path, output_path : String | Path, pages : Range(Int32 | Nil, Int32 | Nil) = .., dpi : Float32 = 150.0) : Array(String)

Convert all pages in the PDF document at pdf_path to images in the directory at output_path.

FileUtils.mkdir_p "pdf_images"

# Convert all pages
MuPDF.convert_pages "doc.pdf", "pdf_images"

# Convert the first 10 pages
MuPDF.convert_pages "doc.pdf", "pdf_images", pages: 0...10
Source
finalize
Source
get_image_data(pdf_path : String, page_num : Int32 = 0, dpi : Float32 = 150.0) : Bytes
Source
page_count(pdf_path : String) : Int32
Source