Sha256: 10ad0bfdf4dd34e9dbe45169c5ed10a69dd1e48462c60ea3048fb23b013d6cb3
Contents?: true
Size: 866 Bytes
Versions: 2
Compression:
Stored size: 866 Bytes
Contents
module Asposepdfjava module UpdatePageDimensions 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 page collection page_collection = pdf.getPages() # get particular page pdf_page = page_collection.get_Item(1) # set the page size as A4 (11.7 x 8.3 in) and in Aspose.Pdf, 1 inch = 72 points # so A4 dimensions in points will be (842.4, 597.6) pdf_page.setPageSize(597.6,842.4) # save the newly generated PDF file pdf.save(data_dir + "output.pdf") puts "Dimensions updated successfully!" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
asposepdfjava-0.0.2 | lib/asposepdfjava/Pages/updatepagedimensions.rb |
asposepdfjava-0.0.1 | lib/asposepdfjava/Pages/updatepagedimensions.rb |