Sha256: 2c7e2b21330e405833913a5251c4bf04be21fac9f81eb955c976639e7740a33b

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

# ## Optimizing a PDF File
#
# This example shows how to read a PDF file, optimize it and write it
# out again.
#
# The heavy work is done by the `:optimize` task which allows control
# over which aspects should be optimized. See [HexaPDF::Task::Optimize]
# for detailed information.
#
# Usage:
# : `ruby optimizing.rb INPUT.PDF`
#

require 'hexapdf'

HexaPDF::Document.open(ARGV.shift) do |doc|
  doc.task(:optimize, compact: true, object_streams: :generate,
           compress_pages: false)
  doc.write('optimizing.pdf')
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hexapdf-0.3.0 examples/optimizing.rb
hexapdf-0.2.0 examples/optimizing.rb
hexapdf-0.1.0 examples/optimizing.rb