Ruby での PDF ページの画像への変換
Contents
[
Hide
]
Aspose.PDF - PDF ページを画像に変換
PDF ドキュメントのすべてのページを画像に変換するには、Aspose.PDF Java for Ruby を使用して、単に ConvertPagesToImages モジュールを呼び出すだけです。
Ruby コード
# The path to the documents directory.
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
converter = Rjb::import('com.aspose.pdf.facades.PdfConverter').new
converter.bindPdf(data_dir + 'input1.pdf')
converter.doConvert()
suffix = ".jpg"
image_count = 1
image_format_internal = Rjb::import('com.aspose.pdf.ImageFormatInternal')
while converter.hasNextImage()
В В В converter.getNextImage(data_dir + "image#{image_count}#{suffix}", image_format_internal.getJpeg())
В В В image_count +=1
end
puts "PDF pages are converted to individual images successfully!"
実行中のコードのダウンロード
以下から Convert PDF pages to Images (Aspose.PDF) をダウンロードしてください: