Sha256: a2acfb712b822b7d4d9ef91b3da629838f20e969991cdd85f3505a044be89972

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

module Asposepdfjava
  module GetPage
    def initialize()
    	# The path to the documents directory.
        data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
                
        # Open the target document
        pdf = Rjb::import('com.aspose.pdf.Document').new(data_dir + 'input1.pdf')

        # get the page at particular index of Page Collection
        pdf_page = pdf.getPages().get_Item(1)

        # create a new Document object
        new_document = Rjb::import('com.aspose.pdf.Document').new

        # add page to pages collection of new document object
        new_document.getPages().add(pdf_page)

        # save the newly generated PDF file
        new_document.save(data_dir + "output.pdf")

        puts "Process completed successfully!"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asposepdfjava-0.0.2 lib/asposepdfjava/Pages/getpage.rb
asposepdfjava-0.0.1 lib/asposepdfjava/Pages/getpage.rb