pdfbeads 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/COPYING +0 -0
- data/ChangeLog +20 -0
- data/README +0 -0
- data/bin/pdfbeads +0 -1
- data/doc/pdfbeads.en.html +20 -24
- data/doc/pdfbeads.ru.html +0 -0
- data/lib/imageinspector.rb +21 -18
- data/lib/pdfbeads/pdfbuilder.rb +33 -14
- data/lib/pdfbeads/pdfdoc.rb +0 -0
- data/lib/pdfbeads/pdffont.rb +0 -0
- data/lib/pdfbeads/pdflabels.rb +0 -0
- data/lib/pdfbeads/pdfpage.rb +19 -19
- data/lib/pdfbeads/pdftoc.rb +0 -0
- data/lib/pdfbeads.rb +1 -1
- metadata +29 -30
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 198ab9ffc035604ce4cfb3528dbebfb7746d746de1a429089028102003e35480
         | 
| 4 | 
            +
              data.tar.gz: e32b5a1de30aeb1bb715f0ea6417478f16f9ba9f229268a55ad3fd4ae9bc67ab
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 485725e99d06c9216e238626b35ec73d7ea2c64513f5112c24448191b6a09ccef40ef58a24bac291a975c8881779a6e62450e629ebee4c89ec34be9d976b4ccb
         | 
| 7 | 
            +
              data.tar.gz: f0f53d06628a9433684d77e175cf95446abeebaa54e14e59bb2a637666d06eaa559734a2bac5e43b3d69182d6afb8ef6627d356bcd6c5b3991200a5cd9e8e858
         | 
    
        data/COPYING
    CHANGED
    
    | 
            File without changes
         | 
    
        data/ChangeLog
    CHANGED
    
    | @@ -77,4 +77,24 @@ | |
| 77 77 |  | 
| 78 78 | 
             
                * hpricot is no longer developed, so switch to Nokagiri for hOCR processing.
         | 
| 79 79 |  | 
| 80 | 
            +
                * use String#encode instead of Iconv, when available
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                * Got tired from deps not being automatically resolved, so add them to
         | 
| 83 | 
            +
                  the gemspeck (the preferred method to install on Debian-based distributions
         | 
| 84 | 
            +
                  is now converting pdfbeads*.gem to a deb package with gem2deb).
         | 
| 85 | 
            +
             | 
| 80 86 | 
             
                + English HTML documentation added.
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            2016 Dec 20 (Alexey Kryukov) Version 1.1.2
         | 
| 89 | 
            +
                * Add a missing String#encode call
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            2020 Jan 05 (Alexey Kryukov) Version 1.1.2
         | 
| 92 | 
            +
                * Respect the photometric interpretation of Group4-encoded tiff images
         | 
| 93 | 
            +
                * Some JPEG images were erroneously treated as LZW-encoded
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            2020 Jan 24 (Alexey Kryukov) Version 1.1.2
         | 
| 96 | 
            +
                * Fixed the /BaseState field in the optional content dictionary, which caused files to be rejected by some viewers
         | 
| 97 | 
            +
             | 
| 98 | 
            +
            2021 Nov 24 (Alexey Kryukov) Version 1.1.3
         | 
| 99 | 
            +
                * Fixed some errors/warnings produced by newer rmagick versions
         | 
| 100 | 
            +
                * Bumped the required rmagick version up to 3.2.0
         | 
    
        data/README
    CHANGED
    
    | 
            File without changes
         | 
    
        data/bin/pdfbeads
    CHANGED
    
    
    
        data/doc/pdfbeads.en.html
    CHANGED
    
    | @@ -498,31 +498,27 @@ files (hOCR is a HTML language extension, allowing to store information | |
| 498 498 | 
             
            about exact positioning of characters and markup elements on the page) or
         | 
| 499 499 | 
             
            imported from another PDF file.</p>
         | 
| 500 500 |  | 
| 501 | 
            -
            <p | 
| 502 | 
            -
             | 
| 503 | 
            -
            <a href="https://launchpad.net/cuneiform-linux/">Cuneiform</a>  | 
| 501 | 
            +
            <p>In order to create hOCR files one should use an OCR application which
         | 
| 502 | 
            +
            supports this output format, such as
         | 
| 503 | 
            +
            <a href="https://launchpad.net/cuneiform-linux/">Cuneiform</a> or
         | 
| 504 504 | 
             
            <a href="http://code.google.com/p/tesseract-ocr/">Tesseract</a>.
         | 
| 505 | 
            -
             | 
| 506 | 
            -
             | 
| 507 | 
            -
             | 
| 508 | 
            -
             | 
| 509 | 
            -
             | 
| 510 | 
            -
             | 
| 511 | 
            -
             | 
| 512 | 
            -
             | 
| 513 | 
            -
             | 
| 514 | 
            -
             | 
| 515 | 
            -
             | 
| 516 | 
            -
             | 
| 517 | 
            -
             | 
| 518 | 
            -
             | 
| 519 | 
            -
             | 
| 520 | 
            -
             | 
| 521 | 
            -
             | 
| 522 | 
            -
            настройки «текст под изображением» или «текст поверх
         | 
| 523 | 
            -
            изображения», поскольку при иных настройках размещение символов на
         | 
| 524 | 
            -
            странице может оказаться не вполне соответствующим исходному графическому
         | 
| 525 | 
            -
            файлу.</p>
         | 
| 505 | 
            +
            The recognized text should be placed into the same directory as other project
         | 
| 506 | 
            +
            files by a such way that each hOCR file should have the same base name as its
         | 
| 507 | 
            +
            source image, while the extension should be either HTM(L) or HOCR. hOCR files
         | 
| 508 | 
            +
            are automatically processed by pdfbeads if only the Nokogiri extension is
         | 
| 509 | 
            +
            installed and accessible to the Ruby engine.</p>
         | 
| 510 | 
            +
             | 
| 511 | 
            +
            <p>Another possible solution is to import an OCR layer from another PDF file
         | 
| 512 | 
            +
            (naturally the later should be produced by recognizing the same set
         | 
| 513 | 
            +
            of images which is supposed to be processed with pdfbeads). The path to the
         | 
| 514 | 
            +
            file can be passed to pdfbeads via the <tt>-T</tt> (or <tt>-text-pdf</tt>)
         | 
| 515 | 
            +
            option. This feature is especially important in those cases where one has
         | 
| 516 | 
            +
            to use a commercial OCR application (such as
         | 
| 517 | 
            +
            <a href="http://www.abbyy.ru/finereader/">ABBYY Finereader</a>), which
         | 
| 518 | 
            +
            doesn't support the hOCR format. <strong>Warning:</strong> you may
         | 
| 519 | 
            +
            need to experiment with your OCR application options related with PDF output
         | 
| 520 | 
            +
            to get the best correspondance between the layout of the recognized
         | 
| 521 | 
            +
            text and the source image.</p>
         | 
| 526 522 |  | 
| 527 523 | 
             
            <h3>Processing files with the right-to-left text direction</h3>
         | 
| 528 524 |  | 
    
        data/doc/pdfbeads.ru.html
    CHANGED
    
    | 
            File without changes
         | 
    
        data/lib/imageinspector.rb
    CHANGED
    
    | @@ -49,7 +49,7 @@ module ImageInspector | |
| 49 49 | 
             
            end
         | 
| 50 50 |  | 
| 51 51 | 
             
            # Parse image header and retrieve its basic properties. The code is inspired
         | 
| 52 | 
            -
            # by Sam Stephenson's snippet which demonstrates how to determine a JPEG | 
| 52 | 
            +
            # by Sam Stephenson's snippet which demonstrates how to determine a JPEG
         | 
| 53 53 | 
             
            # image size ( see http://snippets.dzone.com/posts/show/805) and Paul
         | 
| 54 54 | 
             
            # Schreiber's code for TIFF (see
         | 
| 55 55 | 
             
            # http://paulschreiber.com/blog/2010/06/10/tiff-file-dimensions-in-ruby/)
         | 
| @@ -67,12 +67,12 @@ class ImageInspector::Image | |
| 67 67 | 
             
              # Image format and compression method
         | 
| 68 68 | 
             
              attr_reader :format, :compression
         | 
| 69 69 | 
             
              # Return TIFF tags as a hash for TIFF images or JPEG images with EXIF
         | 
| 70 | 
            -
              # data. Otherwise this property is nil. | 
| 70 | 
            +
              # data. Otherwise this property is nil.
         | 
| 71 71 | 
             
              attr_reader :tags
         | 
| 72 72 |  | 
| 73 73 | 
             
              @@gc = (IO.method_defined? :getbyte) ? (:getbyte) : (:getc)
         | 
| 74 74 |  | 
| 75 | 
            -
              # Set all image attributes to nil and open an image if an optional | 
| 75 | 
            +
              # Set all image attributes to nil and open an image if an optional
         | 
| 76 76 | 
             
              # argument is specified.
         | 
| 77 77 | 
             
              def initialize( input=nil )
         | 
| 78 78 | 
             
                clearData()
         | 
| @@ -99,7 +99,7 @@ class ImageInspector::Image | |
| 99 99 | 
             
                end
         | 
| 100 100 | 
             
              end
         | 
| 101 101 |  | 
| 102 | 
            -
              # Return image data (possibly compressed) for a previously initialized | 
| 102 | 
            +
              # Return image data (possibly compressed) for a previously initialized
         | 
| 103 103 | 
             
              # image as a sring. For JPEG and JPEG2000 this would be the whole image
         | 
| 104 104 | 
             
              # as it is stored on the disk, while for TIFF and PNG all headers are
         | 
| 105 105 | 
             
              # stripped and a raw data stream is returned.
         | 
| @@ -169,7 +169,7 @@ class ImageInspector::Image | |
| 169 169 | 
             
                sign = io.read( 2 )
         | 
| 170 170 | 
             
                if sign.eql? "\xFF\xD8".to_binary
         | 
| 171 171 | 
             
                  @format = :JPEG
         | 
| 172 | 
            -
                  @compression = :DCTDecode | 
| 172 | 
            +
                  @compression = :DCTDecode
         | 
| 173 173 | 
             
                  jpgExamine( io )
         | 
| 174 174 | 
             
                  return
         | 
| 175 175 | 
             
                end
         | 
| @@ -191,7 +191,7 @@ class ImageInspector::Image | |
| 191 191 | 
             
                sign << io.read( 4 )
         | 
| 192 192 | 
             
                if sign.eql? "\x00\x00\x00\x0CjP  \x0D\x0A\x87\x0A".to_binary
         | 
| 193 193 | 
             
                  @format = :JPEG2000
         | 
| 194 | 
            -
                  @compression = :JPXDecode | 
| 194 | 
            +
                  @compression = :JPXDecode
         | 
| 195 195 | 
             
                  j2kParseBox( io )
         | 
| 196 196 | 
             
                  return
         | 
| 197 197 | 
             
                end
         | 
| @@ -288,8 +288,8 @@ class ImageInspector::Image | |
| 288 288 |  | 
| 289 289 | 
             
                # We should not expect to find required image properties (such as width
         | 
| 290 290 | 
             
                # or height) in EXIF data of a JPEG image.
         | 
| 291 | 
            -
                raise 'malformed TIFF: a required tag is missing' unless @format.eql? :JPEG or ( | 
| 292 | 
            -
                  @tags.has_key? 0x0100 and @tags.has_key? 0x0101 and | 
| 291 | 
            +
                raise 'malformed TIFF: a required tag is missing' unless @format.eql? :JPEG or (
         | 
| 292 | 
            +
                  @tags.has_key? 0x0100 and @tags.has_key? 0x0101 and
         | 
| 293 293 | 
             
                  @tags.has_key? 0x0106 and @tags.has_key? 0x0111 and @tags.has_key? 0x0117 )
         | 
| 294 294 |  | 
| 295 295 | 
             
                unless @format.eql? :JPEG
         | 
| @@ -325,16 +325,19 @@ class ImageInspector::Image | |
| 325 325 | 
             
                end
         | 
| 326 326 | 
             
                @tags.merge! tiffParseIFD( io,@tags[0x8769][0],intgr ) if @tags.has_key? 0x8769
         | 
| 327 327 |  | 
| 328 | 
            -
                 | 
| 329 | 
            -
             | 
| 330 | 
            -
             | 
| 331 | 
            -
             | 
| 332 | 
            -
             | 
| 333 | 
            -
             | 
| 334 | 
            -
             | 
| 335 | 
            -
             | 
| 336 | 
            -
             | 
| 337 | 
            -
             | 
| 328 | 
            +
                # Strangely, got some JPEG's marked as LZW-decoded
         | 
| 329 | 
            +
                unless @format.eql? :JPEG
         | 
| 330 | 
            +
                  if @tags.has_key? 0x0103
         | 
| 331 | 
            +
                    case @tags[0x0103][0]
         | 
| 332 | 
            +
                      when 1
         | 
| 333 | 
            +
                        @compression = :NoCompression
         | 
| 334 | 
            +
                      when 3, 4
         | 
| 335 | 
            +
                        @compression = :CCITTFaxDecode
         | 
| 336 | 
            +
                      when 5
         | 
| 337 | 
            +
                        @compression = :LZWDecode
         | 
| 338 | 
            +
                      when 8, 32946
         | 
| 339 | 
            +
                        @compression = :FlateDecode
         | 
| 340 | 
            +
                    end
         | 
| 338 341 | 
             
                  end
         | 
| 339 342 | 
             
                end
         | 
| 340 343 |  | 
    
        data/lib/pdfbeads/pdfbuilder.rb
    CHANGED
    
    | @@ -134,7 +134,7 @@ class PDFBeads::PDFBuilder | |
| 134 134 | 
             
                })
         | 
| 135 135 | 
             
                @doc.addObject(ocBack)
         | 
| 136 136 | 
             
                cat.addToDict('OCProperties',
         | 
| 137 | 
            -
                  sprintf("<< /OCGs[%s %s] /D<< /Intent /View /BaseState  | 
| 137 | 
            +
                  sprintf("<< /OCGs[%s %s] /D<< /Intent /View /BaseState /ON /Order[%s %s] >>>>",
         | 
| 138 138 | 
             
                    ref(ocFore.getID), ref(ocBack.getID), ref(ocFore.getID), ref(ocBack.getID)))
         | 
| 139 139 |  | 
| 140 140 | 
             
                page_objs = Array.new()
         | 
| @@ -159,7 +159,11 @@ class PDFBeads::PDFBuilder | |
| 159 159 | 
             
                        nTree << "/P (#{ltitl.to_text}) "
         | 
| 160 160 | 
             
                      # Iconv::InvalidCharacter, Iconv::IllegalSequence, Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
         | 
| 161 161 | 
             
                      rescue
         | 
| 162 | 
            -
                         | 
| 162 | 
            +
                        if rng[:prefix].respond_to? :encode
         | 
| 163 | 
            +
                          ltitl = rng[:prefix].encode( "utf-16be", "utf-8" )
         | 
| 164 | 
            +
                        else
         | 
| 165 | 
            +
                          ltitl = Iconv.iconv( "utf-16be", "utf-8", rng[:prefix] ).first
         | 
| 166 | 
            +
                        end
         | 
| 163 167 | 
             
                        # If there is no number (just prefix) then put a zero character after the prefix:
         | 
| 164 168 | 
             
                        # this makes acroread happy, but prevents displaying the number in evince
         | 
| 165 169 | 
             
                        unless rng.has_key? :style
         | 
| @@ -399,11 +403,17 @@ class PDFBeads::PDFBuilder | |
| 399 403 | 
             
                      key = $1
         | 
| 400 404 | 
             
                      if keys.include? key
         | 
| 401 405 | 
             
                        begin
         | 
| 406 | 
            +
                          tmp_str = ''
         | 
| 402 407 | 
             
                          if $2.respond_to? :encode
         | 
| 403 | 
            -
                             | 
| 408 | 
            +
                            tmp_str = $2.encode( "utf-16be", "utf-8" )
         | 
| 404 409 | 
             
                          else
         | 
| 405 | 
            -
                             | 
| 410 | 
            +
                            tmp_str = Iconv.iconv( "utf-16be", "utf-8", $2 ).first
         | 
| 406 411 | 
             
                          end
         | 
| 412 | 
            +
                          # a parenthesis code in a formally correct utf-16 should nevertheless be escaped
         | 
| 413 | 
            +
                          ret[key] = tmp_str.to_binary
         | 
| 414 | 
            +
                          ret[key].gsub!( /\x5C/,"\x5C\x5C" )
         | 
| 415 | 
            +
                          ret[key].gsub!( /\x28/,"\x5C\x28" )
         | 
| 416 | 
            +
                          ret[key].gsub!( /\x29/,"\x5C\x29" )
         | 
| 407 417 | 
             
                        rescue
         | 
| 408 418 | 
             
                          $stderr.puts("Error: metadata should be specified in utf-8")
         | 
| 409 419 | 
             
                        end
         | 
| @@ -651,7 +661,7 @@ class PDFBeads::PDFBuilder | |
| 651 661 | 
             
              end
         | 
| 652 662 |  | 
| 653 663 | 
             
              def elementText( elem )
         | 
| 654 | 
            -
                # used to put some Iconv stuff here, but nokogiri  | 
| 664 | 
            +
                # used to put some Iconv stuff here, but nokogiri performs this conversion itself
         | 
| 655 665 | 
             
                return elem.inner_text.strip
         | 
| 656 666 | 
             
              end
         | 
| 657 667 |  | 
| @@ -893,15 +903,18 @@ class PDFBeads::PDFBuilder | |
| 893 903 |  | 
| 894 904 | 
             
                unless stencil.compression.eql? :CCITTFaxDecode and rows_per_strip >= height
         | 
| 895 905 | 
             
                  img = ImageList.new( path )
         | 
| 896 | 
            -
                  imgdata = img.to_blob{
         | 
| 897 | 
            -
                     | 
| 898 | 
            -
                     | 
| 899 | 
            -
                     | 
| 906 | 
            +
                  imgdata = img.to_blob { |imd|
         | 
| 907 | 
            +
                    imd.format = 'TIFF'
         | 
| 908 | 
            +
                    imd.define( 'TIFF','rows-per-strip',height )
         | 
| 909 | 
            +
                    imd.compression = Group4Compression
         | 
| 900 910 | 
             
                  }
         | 
| 901 911 | 
             
                  stencil = ImageInspector.new( StringIO.new(imgdata) )
         | 
| 902 912 | 
             
                  img.destroy!
         | 
| 903 913 | 
             
                end
         | 
| 904 914 | 
             
                body = stencil.getRawData
         | 
| 915 | 
            +
                photometric = 0
         | 
| 916 | 
            +
                photometric = stencil.tags[0x106][0] if
         | 
| 917 | 
            +
                  stencil.format.eql? :TIFF and stencil.tags.has_key? 0x106
         | 
| 905 918 |  | 
| 906 919 | 
             
                xobj = XObj.new(Hash[
         | 
| 907 920 | 
             
                  'Type'             => '/XObject',
         | 
| @@ -913,8 +926,14 @@ class PDFBeads::PDFBuilder | |
| 913 926 | 
             
                  'ColorSpace'       => '/DeviceGray',
         | 
| 914 927 | 
             
                  'BitsPerComponent' => '1',
         | 
| 915 928 | 
             
                  'Filter'           => '/CCITTFaxDecode',
         | 
| 916 | 
            -
                  'DecodeParms'      => "<< /Columns #{width} /K -1 >>"
         | 
| 929 | 
            +
                  'DecodeParms'      => "<< /Columns #{width} /K -1 >>",
         | 
| 917 930 | 
             
                ], body)
         | 
| 931 | 
            +
                if photometric == 1 then
         | 
| 932 | 
            +
                  # As ImageMask is always on, BlackIs1 actually doesn't work, while
         | 
| 933 | 
            +
                  # the Decode array does.
         | 
| 934 | 
            +
                  xobj.addToDict( 'BlackIs1', 'true' )
         | 
| 935 | 
            +
                  xobj.addToDict( 'Decode', '[1 0]' )
         | 
| 936 | 
            +
                end
         | 
| 918 937 |  | 
| 919 938 | 
             
                return [ xobj,width,height,xres,yres ]
         | 
| 920 939 | 
             
              end
         | 
| @@ -966,10 +985,10 @@ class PDFBeads::PDFBuilder | |
| 966 985 | 
             
                  ( [ :FlateDecode,:LZWDecode,:CCITTFaxDecode ].include? insp.compression and insp.tags[0x0116][0] >= insp.height )))
         | 
| 967 986 |  | 
| 968 987 | 
             
                  img = ImageList.new( impath )
         | 
| 969 | 
            -
                  imgdata = img.to_blob{
         | 
| 970 | 
            -
                     | 
| 971 | 
            -
                     | 
| 972 | 
            -
                     | 
| 988 | 
            +
                  imgdata = img.to_blob { |imd|
         | 
| 989 | 
            +
                    imd.format = 'PNG'
         | 
| 990 | 
            +
                    imd.quality = 95
         | 
| 991 | 
            +
                    imd.compression = ZipCompression
         | 
| 973 992 | 
             
                  }
         | 
| 974 993 | 
             
                  insp = ImageInspector.new( StringIO.new(imgdata) )
         | 
| 975 994 | 
             
                  img.destroy!
         | 
    
        data/lib/pdfbeads/pdfdoc.rb
    CHANGED
    
    | 
            File without changes
         | 
    
        data/lib/pdfbeads/pdffont.rb
    CHANGED
    
    | 
            File without changes
         | 
    
        data/lib/pdfbeads/pdflabels.rb
    CHANGED
    
    | 
            File without changes
         | 
    
        data/lib/pdfbeads/pdfpage.rb
    CHANGED
    
    | @@ -160,19 +160,19 @@ class PDFBeads::PageDataProvider < Array | |
| 160 160 |  | 
| 161 161 | 
             
                def writeImage( img,path,fmt )
         | 
| 162 162 | 
             
                  begin
         | 
| 163 | 
            -
                    img.write( path ) do
         | 
| 163 | 
            +
                    img.write( path ) do |curimg|
         | 
| 164 164 | 
             
                      case fmt
         | 
| 165 165 | 
             
                      when 'JP2'
         | 
| 166 | 
            -
                         | 
| 167 | 
            -
                         | 
| 168 | 
            -
                         | 
| 166 | 
            +
                        curimg.define( 'JP2','mode','real' )
         | 
| 167 | 
            +
                        curimg.define( 'JP2','numrlvls',4 )
         | 
| 168 | 
            +
                        curimg.define( 'JP2','rate',0.015625 )
         | 
| 169 169 | 
             
                      when 'JPG'
         | 
| 170 | 
            -
                         | 
| 170 | 
            +
                        curimg.quality = 50
         | 
| 171 171 | 
             
                      else
         | 
| 172 | 
            -
                         | 
| 173 | 
            -
                         | 
| 172 | 
            +
                        curimg.compression = ZipCompression
         | 
| 173 | 
            +
                        curimg.quality = 95
         | 
| 174 174 | 
             
                      end
         | 
| 175 | 
            -
                       | 
| 175 | 
            +
                      curimg.format = fmt
         | 
| 176 176 | 
             
                    end
         | 
| 177 177 | 
             
                    return true
         | 
| 178 178 | 
             
                  rescue
         | 
| @@ -205,10 +205,10 @@ class PDFBeads::PageDataProvider < Array | |
| 205 205 | 
             
                            bitonal.colormap( j,crepl )
         | 
| 206 206 | 
             
                          end
         | 
| 207 207 | 
             
                          bitonal.compress_colormap!
         | 
| 208 | 
            -
                          bitonal.write( cpath ) do
         | 
| 209 | 
            -
                             | 
| 210 | 
            -
                             | 
| 211 | 
            -
                             | 
| 208 | 
            +
                          bitonal.write( cpath ) do |curimg|
         | 
| 209 | 
            +
                            curimg.format = 'TIFF'
         | 
| 210 | 
            +
                            curimg.define( 'TIFF','rows-per-strip',img.rows )
         | 
| 211 | 
            +
                            curimg.compression = Group4Compression
         | 
| 212 212 | 
             
                          end
         | 
| 213 213 | 
             
                          bitonal.destroy!
         | 
| 214 214 | 
             
                          created = true
         | 
| @@ -230,10 +230,10 @@ class PDFBeads::PageDataProvider < Array | |
| 230 230 | 
             
                  binpath = "#{@basename}.black.tiff"
         | 
| 231 231 | 
             
                  if not File.exists? binpath or force
         | 
| 232 232 | 
             
                    im_copy = img.copy; bitonal = im_copy.threshold(QuantumRange/255*treshold); im_copy.destroy!
         | 
| 233 | 
            -
                    bitonal.write( binpath ){
         | 
| 234 | 
            -
                       | 
| 235 | 
            -
                       | 
| 236 | 
            -
                       | 
| 233 | 
            +
                    bitonal.write( binpath ) { |curimg|
         | 
| 234 | 
            +
                      curimg.format = 'TIFF'
         | 
| 235 | 
            +
                      curimg.define( 'TIFF','rows-per-strip',img.rows )
         | 
| 236 | 
            +
                      curimg.compression = Group4Compression
         | 
| 237 237 | 
             
                    }
         | 
| 238 238 | 
             
                    bitonal.destroy!
         | 
| 239 239 | 
             
                    map[:created] = true
         | 
| @@ -324,7 +324,7 @@ class PDFBeads::PageDataProvider < Array | |
| 324 324 | 
             
                  PageData.fixResolution( img )
         | 
| 325 325 | 
             
                  mask.resize!( imw,imh ) if mask.columns != imw or mask.rows != imh
         | 
| 326 326 |  | 
| 327 | 
            -
                  no_fg = img.composite( mask,CenterGravity, | 
| 327 | 
            +
                  no_fg = img.composite( mask,CenterGravity,CopyAlphaCompositeOp )
         | 
| 328 328 | 
             
                  bg = no_fg.blur_channel( 0,6,AllChannels )
         | 
| 329 329 | 
             
                  bg.alpha( DeactivateAlphaChannel )
         | 
| 330 330 |  | 
| @@ -346,7 +346,7 @@ class PDFBeads::PageDataProvider < Array | |
| 346 346 | 
             
                    ksam = mask.negate
         | 
| 347 347 | 
             
                    mask.destroy!
         | 
| 348 348 |  | 
| 349 | 
            -
                    no_bg = img.composite( ksam,CenterGravity, | 
| 349 | 
            +
                    no_bg = img.composite( ksam,CenterGravity,CopyAlphaCompositeOp )
         | 
| 350 350 | 
             
                    fg = no_bg.clone
         | 
| 351 351 |  | 
| 352 352 | 
             
                    # Resize the image to a tiny size and then back to the original size
         | 
| @@ -403,8 +403,8 @@ class PDFBeads::PageDataProvider < Array | |
| 403 403 |  | 
| 404 404 | 
             
                # A hack for some Windows versions of RMagick, which throw an error the
         | 
| 405 405 | 
             
                # first time when Magick.formats is accessed
         | 
| 406 | 
            +
                retries = 2
         | 
| 406 407 | 
             
                begin
         | 
| 407 | 
            -
                  retries = 2
         | 
| 408 408 | 
             
                  mfmts = Magick.formats
         | 
| 409 409 | 
             
                rescue
         | 
| 410 410 | 
             
                  retry if (retries -= 1 ) > 0
         | 
    
        data/lib/pdfbeads/pdftoc.rb
    CHANGED
    
    | 
            File without changes
         | 
    
        data/lib/pdfbeads.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,55 +1,55 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pdfbeads
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Alexey Kryukov
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-11-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rmagick
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - -  | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 2. | 
| 19 | 
            +
                    version: 3.2.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - -  | 
| 24 | 
            +
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 2. | 
| 26 | 
            +
                    version: 3.2.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: nokogiri
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - -  | 
| 31 | 
            +
                - - ">="
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 33 | 
             
                    version: 1.5.10
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - -  | 
| 38 | 
            +
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: 1.5.10
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: pdf-reader
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 | 
            -
                - -  | 
| 45 | 
            +
                - - ">="
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 47 | 
             
                    version: 1.0.0
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 | 
            -
                - -  | 
| 52 | 
            +
                - - ">="
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: 1.0.0
         | 
| 55 55 | 
             
            description: |2
         | 
| @@ -70,45 +70,44 @@ extra_rdoc_files: | |
| 70 70 | 
             
            - COPYING
         | 
| 71 71 | 
             
            - ChangeLog
         | 
| 72 72 | 
             
            files:
         | 
| 73 | 
            +
            - COPYING
         | 
| 74 | 
            +
            - ChangeLog
         | 
| 75 | 
            +
            - README
         | 
| 76 | 
            +
            - bin/pdfbeads
         | 
| 77 | 
            +
            - doc/pdfbeads.en.html
         | 
| 78 | 
            +
            - doc/pdfbeads.ru.html
         | 
| 79 | 
            +
            - lib/imageinspector.rb
         | 
| 80 | 
            +
            - lib/pdfbeads.rb
         | 
| 73 81 | 
             
            - lib/pdfbeads/pdfbuilder.rb
         | 
| 74 | 
            -
            - lib/pdfbeads/ | 
| 75 | 
            -
            - lib/pdfbeads/pdftoc.rb
         | 
| 82 | 
            +
            - lib/pdfbeads/pdfdoc.rb
         | 
| 76 83 | 
             
            - lib/pdfbeads/pdffont.rb
         | 
| 77 84 | 
             
            - lib/pdfbeads/pdflabels.rb
         | 
| 78 | 
            -
            - lib/pdfbeads/ | 
| 79 | 
            -
            - lib/pdfbeads.rb
         | 
| 80 | 
            -
            - lib/imageinspector.rb
         | 
| 81 | 
            -
            - bin/pdfbeads
         | 
| 82 | 
            -
            - doc/pdfbeads.ru.html
         | 
| 83 | 
            -
            - doc/pdfbeads.en.html
         | 
| 84 | 
            -
            - README
         | 
| 85 | 
            -
            - COPYING
         | 
| 86 | 
            -
            - ChangeLog
         | 
| 85 | 
            +
            - lib/pdfbeads/pdfpage.rb
         | 
| 86 | 
            +
            - lib/pdfbeads/pdftoc.rb
         | 
| 87 87 | 
             
            homepage: http://pdfbeads.rubyforge.org
         | 
| 88 88 | 
             
            licenses:
         | 
| 89 | 
            -
            - GPL
         | 
| 89 | 
            +
            - GPL-3.0+
         | 
| 90 90 | 
             
            metadata: {}
         | 
| 91 | 
            -
            post_install_message: | 
| 91 | 
            +
            post_install_message:
         | 
| 92 92 | 
             
            rdoc_options: []
         | 
| 93 93 | 
             
            require_paths:
         | 
| 94 94 | 
             
            - lib
         | 
| 95 95 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 96 96 | 
             
              requirements:
         | 
| 97 | 
            -
              - -  | 
| 97 | 
            +
              - - ">="
         | 
| 98 98 | 
             
                - !ruby/object:Gem::Version
         | 
| 99 99 | 
             
                  version: '0'
         | 
| 100 100 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 101 101 | 
             
              requirements:
         | 
| 102 | 
            -
              - -  | 
| 102 | 
            +
              - - ">="
         | 
| 103 103 | 
             
                - !ruby/object:Gem::Version
         | 
| 104 104 | 
             
                  version: '0'
         | 
| 105 105 | 
             
            requirements:
         | 
| 106 | 
            -
            - RMagick,  | 
| 106 | 
            +
            - RMagick, v3.2.0 or greater
         | 
| 107 107 | 
             
            - nokogiri, v1.5.10 or greater
         | 
| 108 108 | 
             
            - PDF::Reader, v1.0.0 or greater
         | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
            signing_key: 
         | 
| 109 | 
            +
            rubygems_version: 3.2.29
         | 
| 110 | 
            +
            signing_key:
         | 
| 112 111 | 
             
            specification_version: 4
         | 
| 113 112 | 
             
            summary: PDFBeads -- convert scanned images to a single PDF file.
         | 
| 114 113 | 
             
            test_files: []
         |