Sha256: a600601e5a676ca9500f45ca041d3eae6d953b384cbb7feb56bbb2250d4d231d

Contents?: true

Size: 818 Bytes

Versions: 2

Compression:

Stored size: 818 Bytes

Contents

module Asposepdfjava
  module ConvertPagesToImages
    def initialize()
    	# 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!"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asposepdfjava-0.0.2 lib/asposepdfjava/Converter/convertpagestoimages.rb
asposepdfjava-0.0.1 lib/asposepdfjava/Converter/convertpagestoimages.rb