Sha256: 32aa511394f1f627f1713ead896632d209ca0ece5743c7e40b1cca79f9630b41
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
module Asposepdfjava module Optimize def initialize() # Optimize document for the web #optimize_web() # Optimize document for the web optimize_filesize() end def optimize_web() # The path to the documents directory. data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Open a pdf document. doc = Rjb::import('com.aspose.pdf.Document').new(data_dir + "input1.pdf") # Optimize for web doc.optimize() #Save output document doc.save(data_dir + "Optimized_Web.pdf") puts "Optimized PDF for the Web, please check output file." end def optimize_filesize() # The path to the documents directory. data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/' # Open a pdf document. doc = Rjb::import('com.aspose.pdf.Document').new(data_dir + "input1.pdf") # Optimize the file size by removing unused objects opt = Rjb::import('aspose.document.OptimizationOptions').new opt.setRemoveUnusedObjects(true) opt.setRemoveUnusedStreams(true) opt.setLinkDuplcateStreams(true) doc.optimizeResources(opt) # Save output document doc.save(data_dir + "Optimized_Filesize.pdf") puts "Optimized PDF Filesize, please check output file." end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
asposepdfjava-0.0.2 | lib/asposepdfjava/Document/optimize.rb |
asposepdfjava-0.0.1 | lib/asposepdfjava/Document/optimize.rb |