MuPDF::ImageConverter
Constructors
Class methods
version
SourceInstance methods
convert_to_png(pdf_path : String, output_path : String, page page_num : Int32 = 0, dpi : Float32 = 150.0)
Sourceconvert_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
finalize
Source