Sha256: 06f35ccca926a0a887757a19fdbd743aad8d4bbb3a90752c7d631446d6027fb6

Contents?: true

Size: 655 Bytes

Versions: 20

Compression:

Stored size: 655 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.
#
# The hexapdf binary provides an optimization command which does some
# additional operations like optimizing the page tree.
#
# 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

20 entries across 20 versions & 1 rubygems

Version Path
hexapdf-0.11.9 examples/004-optimizing.rb
hexapdf-0.11.8 examples/004-optimizing.rb
hexapdf-0.11.7 examples/004-optimizing.rb
hexapdf-0.11.6 examples/004-optimizing.rb
hexapdf-0.11.5 examples/004-optimizing.rb
hexapdf-0.11.4 examples/004-optimizing.rb
hexapdf-0.11.3 examples/004-optimizing.rb
hexapdf-0.11.2 examples/004-optimizing.rb
hexapdf-0.11.1 examples/004-optimizing.rb
hexapdf-0.11.0 examples/004-optimizing.rb
hexapdf-0.10.0 examples/004-optimizing.rb
hexapdf-0.9.3 examples/004-optimizing.rb
hexapdf-0.9.2 examples/004-optimizing.rb
hexapdf-0.9.1 examples/004-optimizing.rb
hexapdf-0.9.0 examples/004-optimizing.rb
hexapdf-0.8.0 examples/004-optimizing.rb
hexapdf-0.7.0 examples/optimizing.rb
hexapdf-0.6.0 examples/optimizing.rb
hexapdf-0.5.0 examples/optimizing.rb
hexapdf-0.4.0 examples/optimizing.rb