lib/podoff.rb in podoff-1.2.0 vs lib/podoff.rb in podoff-1.2.1

- old
+ new

@@ -1,8 +1,8 @@ #-- -# Copyright (c) 2015-2015, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2015-2017, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -28,11 +28,11 @@ require 'stringio' module Podoff - VERSION = '1.2.0' + VERSION = '1.2.1' def self.load(path, encoding) Podoff::Document.load(path, encoding) end @@ -151,10 +151,15 @@ def pages #@objs.values.select { |o| o.type == '/Page' } ps = @objs.values.find { |o| o.type == '/Pages' } - return nil unless ps + + fail ArgumentError.new( + "no /Pages, the PDF is not usable by Podoff as is, you have to do " + + "`qpdf --object-streams=disable original.pdf unpacked.pdf` " + + "and use unpacked.pdf instead of original.pdf" + ) unless ps extract_refs(ps.attributes[:kids]).collect { |r| @objs[r] } end def page(index)