wicked_pdf 2.0.2 → 2.7.0
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 +4 -4
 - data/.github/workflows/ci.yml +56 -0
 - data/.rubocop.yml +57 -1
 - data/.rubocop_todo.yml +29 -117
 - data/CHANGELOG.md +88 -4
 - data/README.md +58 -16
 - data/Rakefile +3 -10
 - data/gemfiles/5.0.gemfile +2 -2
 - data/gemfiles/5.1.gemfile +2 -2
 - data/gemfiles/5.2.gemfile +3 -4
 - data/gemfiles/6.0.gemfile +3 -4
 - data/gemfiles/6.1.gemfile +11 -0
 - data/gemfiles/7.0.gemfile +11 -0
 - data/generators/wicked_pdf/templates/wicked_pdf.rb +9 -0
 - data/lib/wicked_pdf/binary.rb +65 -0
 - data/lib/wicked_pdf/option_parser.rb +230 -0
 - data/lib/wicked_pdf/pdf_helper.rb +29 -44
 - data/lib/wicked_pdf/railtie.rb +3 -12
 - data/lib/wicked_pdf/tempfile.rb +33 -3
 - data/lib/wicked_pdf/version.rb +1 -1
 - data/lib/wicked_pdf/wicked_pdf_helper/assets.rb +62 -6
 - data/lib/wicked_pdf.rb +32 -260
 - data/test/functional/pdf_helper_test.rb +1 -1
 - data/test/unit/wicked_pdf_binary_test.rb +26 -0
 - data/test/unit/wicked_pdf_option_parser_test.rb +133 -0
 - data/test/unit/wicked_pdf_test.rb +0 -157
 - data/test/unit/wkhtmltopdf_location_test.rb +0 -2
 - data/wicked_pdf.gemspec +3 -5
 - metadata +33 -29
 - data/.travis.yml +0 -79
 - data/gemfiles/4.0.gemfile +0 -7
 - data/gemfiles/4.1.gemfile +0 -7
 - data/gemfiles/4.2.gemfile +0 -9
 - data/gemfiles/rails_edge.gemfile +0 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 120e7e1b14e3e17ac6bc407dd6c7d27438543e87a979d684bab919440ebd7879
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f9340f26589900f6f30c19f5631ca2104b48685b9ac102c3bdc2e9d168c0c847
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f26972b5aa38ac4785ffddd283e787ec49361ae1891d66b8bfe92d3e9b196d4215a03cec3ffced97ec5269f0316f53f0a24374c26a1df255898a01241b85ce57
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0d00bcb4d776acb3a469dfb55e0994ca22eab620694b92f7433a4a93aa91a07653848bef7bd3eaff709d861fdf6bf1260cd8ad048be9e671f8f26d78f37d0300
         
     | 
| 
         @@ -0,0 +1,56 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: CI
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            on: [push, pull_request, workflow_dispatch]
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 6 
     | 
    
         
            +
              tests:
         
     | 
| 
      
 7 
     | 
    
         
            +
                name: Tests with Ruby ${{ matrix.ruby-version }} and Rails ${{ matrix.gemfile }}
         
     | 
| 
      
 8 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 9 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 10 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 11 
     | 
    
         
            +
                    gemfile: ["5.0"]
         
     | 
| 
      
 12 
     | 
    
         
            +
                    ruby-version: [2.6]
         
     | 
| 
      
 13 
     | 
    
         
            +
                    include:
         
     | 
| 
      
 14 
     | 
    
         
            +
                      - gemfile: "5.0"
         
     | 
| 
      
 15 
     | 
    
         
            +
                        ruby-version: 2.7
         
     | 
| 
      
 16 
     | 
    
         
            +
                      - gemfile: "5.1"
         
     | 
| 
      
 17 
     | 
    
         
            +
                        ruby-version: 2.6
         
     | 
| 
      
 18 
     | 
    
         
            +
                      - gemfile: "5.1"
         
     | 
| 
      
 19 
     | 
    
         
            +
                        ruby-version: 2.7
         
     | 
| 
      
 20 
     | 
    
         
            +
                      - gemfile: "5.2"
         
     | 
| 
      
 21 
     | 
    
         
            +
                        ruby-version: 2.6
         
     | 
| 
      
 22 
     | 
    
         
            +
                      - gemfile: "5.2"
         
     | 
| 
      
 23 
     | 
    
         
            +
                        ruby-version: 2.7
         
     | 
| 
      
 24 
     | 
    
         
            +
                      - gemfile: "6.0"
         
     | 
| 
      
 25 
     | 
    
         
            +
                        ruby-version: 2.6
         
     | 
| 
      
 26 
     | 
    
         
            +
                      - gemfile: "6.0"
         
     | 
| 
      
 27 
     | 
    
         
            +
                        ruby-version: 2.7
         
     | 
| 
      
 28 
     | 
    
         
            +
                      - gemfile: "6.1"
         
     | 
| 
      
 29 
     | 
    
         
            +
                        ruby-version: 2.7
         
     | 
| 
      
 30 
     | 
    
         
            +
                      - gemfile: "6.1"
         
     | 
| 
      
 31 
     | 
    
         
            +
                        ruby-version: '3.0'
         
     | 
| 
      
 32 
     | 
    
         
            +
                      - gemfile: "7.0"
         
     | 
| 
      
 33 
     | 
    
         
            +
                        ruby-version: 3.1
         
     | 
| 
      
 34 
     | 
    
         
            +
                      - gemfile: "7.0"
         
     | 
| 
      
 35 
     | 
    
         
            +
                        ruby-version: 3.2
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                env:
         
     | 
| 
      
 38 
     | 
    
         
            +
                  BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
         
     | 
| 
      
 39 
     | 
    
         
            +
                  WKHTMLTOPDF_BIN: /usr/bin/wkhtmltopdf
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 42 
     | 
    
         
            +
                  - uses: actions/checkout@v3
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  - name: Install OS dependencies
         
     | 
| 
      
 45 
     | 
    
         
            +
                    run: |
         
     | 
| 
      
 46 
     | 
    
         
            +
                      sudo apt-get update -y -qq
         
     | 
| 
      
 47 
     | 
    
         
            +
                      sudo apt-get install -y wkhtmltopdf
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  - name: Install Ruby ${{ matrix.ruby-version }}
         
     | 
| 
      
 50 
     | 
    
         
            +
                    uses: ruby/setup-ruby@v1
         
     | 
| 
      
 51 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 52 
     | 
    
         
            +
                      ruby-version: ${{ matrix.ruby-version }}
         
     | 
| 
      
 53 
     | 
    
         
            +
                      bundler-cache: true
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  - name: Run tests with Ruby ${{ matrix.ruby-version }} and Rails ${{ matrix.gemfile }}
         
     | 
| 
      
 56 
     | 
    
         
            +
                    run: bundle exec rake
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -1,15 +1,71 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            inherit_from: .rubocop_todo.yml
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            AllCops:
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
      
 4 
     | 
    
         
            +
              NewCops: disable
         
     | 
| 
      
 5 
     | 
    
         
            +
              SuggestExtensions: false
         
     | 
| 
      
 6 
     | 
    
         
            +
              TargetRubyVersion: 2.6
         
     | 
| 
       5 
7 
     | 
    
         
             
              Exclude:
         
     | 
| 
       6 
8 
     | 
    
         
             
                - 'gemfiles/bin/*'
         
     | 
| 
       7 
9 
     | 
    
         
             
                - 'test/dummy/**/*'
         
     | 
| 
      
 10 
     | 
    
         
            +
                - 'vendor/**/*'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            Metrics/PerceivedComplexity:
         
     | 
| 
      
 13 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Gemspec/RequiredRubyVersion:
         
     | 
| 
      
 16 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Bundler/OrderedGems:
         
     | 
| 
      
 19 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Style/FrozenStringLiteralComment:
         
     | 
| 
      
 22 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            Style/RedundantBegin:
         
     | 
| 
      
 25 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            Style/NumericPredicate:
         
     | 
| 
      
 28 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Style/RedundantRegexpEscape:
         
     | 
| 
      
 31 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            Style/SafeNavigation:
         
     | 
| 
      
 34 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            Lint/SendWithMixinArgument:
         
     | 
| 
      
 37 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            Lint/RedundantCopDisableDirective:
         
     | 
| 
      
 40 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            Metrics/AbcSize:
         
     | 
| 
      
 43 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            Style/StringConcatenation:
         
     | 
| 
      
 46 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            Style/RedundantFetchBlock:
         
     | 
| 
      
 49 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            Style/CaseLikeIf:
         
     | 
| 
      
 52 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 53 
     | 
    
         
            +
             
         
     | 
| 
      
 54 
     | 
    
         
            +
            Style/SoleNestedConditional:
         
     | 
| 
      
 55 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            Style/RedundantReturn:
         
     | 
| 
      
 58 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
       8 
59 
     | 
    
         | 
| 
       9 
60 
     | 
    
         
             
            Metrics/BlockLength:
         
     | 
| 
       10 
61 
     | 
    
         
             
              Exclude:
         
     | 
| 
       11 
62 
     | 
    
         
             
                - 'wicked_pdf.gemspec'
         
     | 
| 
       12 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
            Metrics/ModuleLength:
         
     | 
| 
      
 65 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 66 
     | 
    
         
            +
                # Excluding to keep the logic in one module for the time being.
         
     | 
| 
      
 67 
     | 
    
         
            +
                - 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
       13 
69 
     | 
    
         
             
            # I'd like wicked_pdf to keep Ruby 1.8 compatibility for now
         
     | 
| 
       14 
70 
     | 
    
         
             
            Style/HashSyntax:
         
     | 
| 
       15 
71 
     | 
    
         
             
              EnforcedStyle: hash_rockets
         
     | 
    
        data/.rubocop_todo.yml
    CHANGED
    
    | 
         @@ -1,103 +1,39 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # This configuration was generated by
         
     | 
| 
       2 
2 
     | 
    
         
             
            # `rubocop --auto-gen-config`
         
     | 
| 
       3 
     | 
    
         
            -
            # on  
     | 
| 
      
 3 
     | 
    
         
            +
            # on 2023-01-24 11:24:49 UTC using RuboCop version 1.44.0.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # The point is for the user to remove these configuration records
         
     | 
| 
       5 
5 
     | 
    
         
             
            # one by one as the offenses are removed from the code base.
         
     | 
| 
       6 
6 
     | 
    
         
             
            # Note that changes in the inspected code, or installation of new
         
     | 
| 
       7 
7 
     | 
    
         
             
            # versions of RuboCop, may require this file to be generated again.
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
            # Offense count: 9
         
     | 
| 
       10 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       11 
     | 
    
         
            -
            # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
         
     | 
| 
       12 
     | 
    
         
            -
            # Include: **/*.gemfile, **/Gemfile, **/gems.rb
         
     | 
| 
       13 
     | 
    
         
            -
            Bundler/OrderedGems:
         
     | 
| 
       14 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       15 
     | 
    
         
            -
                - 'gemfiles/4.0.gemfile'
         
     | 
| 
       16 
     | 
    
         
            -
                - 'gemfiles/4.1.gemfile'
         
     | 
| 
       17 
     | 
    
         
            -
                - 'gemfiles/4.2.gemfile'
         
     | 
| 
       18 
     | 
    
         
            -
                - 'gemfiles/5.0.gemfile'
         
     | 
| 
       19 
     | 
    
         
            -
                - 'gemfiles/5.1.gemfile'
         
     | 
| 
       20 
     | 
    
         
            -
                - 'gemfiles/5.2.gemfile'
         
     | 
| 
       21 
     | 
    
         
            -
                - 'gemfiles/6.0.gemfile'
         
     | 
| 
       22 
     | 
    
         
            -
                - 'gemfiles/rails_edge.gemfile'
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            # Offense count: 2
         
     | 
| 
       25 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       26 
     | 
    
         
            -
            # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
         
     | 
| 
       27 
     | 
    
         
            -
            # Include: **/*.gemspec
         
     | 
| 
       28 
     | 
    
         
            -
            Gemspec/OrderedDependencies:
         
     | 
| 
       29 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       30 
     | 
    
         
            -
                - 'wicked_pdf.gemspec'
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            # Offense count: 16
         
     | 
| 
       33 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       34 
     | 
    
         
            -
            Layout/EmptyLineAfterGuardClause:
         
     | 
| 
       35 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       36 
     | 
    
         
            -
                - 'Rakefile'
         
     | 
| 
       37 
     | 
    
         
            -
                - 'lib/wicked_pdf.rb'
         
     | 
| 
       38 
     | 
    
         
            -
                - 'lib/wicked_pdf/pdf_helper.rb'
         
     | 
| 
       39 
     | 
    
         
            -
                - 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
            # Offense count: 2
         
     | 
| 
       42 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       43 
     | 
    
         
            -
            Layout/LeadingBlankLines:
         
     | 
| 
       44 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       45 
     | 
    
         
            -
                - 'test/unit/wkhtmltopdf_location_test.rb'
         
     | 
| 
       46 
     | 
    
         
            -
                - 'wicked_pdf.gemspec'
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       49 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       50 
     | 
    
         
            -
            Layout/RescueEnsureAlignment:
         
     | 
| 
       51 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       52 
     | 
    
         
            -
                - 'lib/wicked_pdf.rb'
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       55 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       56 
     | 
    
         
            -
            # Configuration parameters: EnforcedStyle.
         
     | 
| 
       57 
     | 
    
         
            -
            # SupportedStyles: final_newline, final_blank_line
         
     | 
| 
       58 
     | 
    
         
            -
            Layout/TrailingBlankLines:
         
     | 
| 
       59 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       60 
     | 
    
         
            -
                - 'gemfiles/4.0.gemfile'
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            # Offense count: 11
         
     | 
| 
       63 
     | 
    
         
            -
            Metrics/AbcSize:
         
     | 
| 
       64 
     | 
    
         
            -
              Max: 45
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
9 
     | 
    
         
             
            # Offense count: 2
         
     | 
| 
       67 
     | 
    
         
            -
            # Configuration parameters: CountComments.
         
     | 
| 
      
 10 
     | 
    
         
            +
            # Configuration parameters: CountComments, CountAsOne.
         
     | 
| 
       68 
11 
     | 
    
         
             
            Metrics/ClassLength:
         
     | 
| 
       69 
     | 
    
         
            -
              Max:  
     | 
| 
      
 12 
     | 
    
         
            +
              Max: 203
         
     | 
| 
       70 
13 
     | 
    
         | 
| 
       71 
14 
     | 
    
         
             
            # Offense count: 7
         
     | 
| 
      
 15 
     | 
    
         
            +
            # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
         
     | 
| 
       72 
16 
     | 
    
         
             
            Metrics/CyclomaticComplexity:
         
     | 
| 
       73 
     | 
    
         
            -
              Max:  
     | 
| 
      
 17 
     | 
    
         
            +
              Max: 13
         
     | 
| 
       74 
18 
     | 
    
         | 
| 
       75 
19 
     | 
    
         
             
            # Offense count: 17
         
     | 
| 
       76 
     | 
    
         
            -
            # Configuration parameters: CountComments, ExcludedMethods.
         
     | 
| 
      
 20 
     | 
    
         
            +
            # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
         
     | 
| 
       77 
21 
     | 
    
         
             
            Metrics/MethodLength:
         
     | 
| 
       78 
     | 
    
         
            -
              Max:  
     | 
| 
      
 22 
     | 
    
         
            +
              Max: 34
         
     | 
| 
       79 
23 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
            # Offense count:  
     | 
| 
       81 
     | 
    
         
            -
            # Configuration parameters: CountComments.
         
     | 
| 
      
 24 
     | 
    
         
            +
            # Offense count: 1
         
     | 
| 
      
 25 
     | 
    
         
            +
            # Configuration parameters: CountComments, CountAsOne.
         
     | 
| 
       82 
26 
     | 
    
         
             
            Metrics/ModuleLength:
         
     | 
| 
       83 
     | 
    
         
            -
              Max:  
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            # Offense count: 6
         
     | 
| 
       86 
     | 
    
         
            -
            Metrics/PerceivedComplexity:
         
     | 
| 
       87 
     | 
    
         
            -
              Max: 12
         
     | 
| 
      
 27 
     | 
    
         
            +
              Max: 104
         
     | 
| 
       88 
28 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
            # Offense count:  
     | 
| 
      
 29 
     | 
    
         
            +
            # Offense count: 1
         
     | 
| 
       90 
30 
     | 
    
         
             
            Naming/AccessorMethodName:
         
     | 
| 
       91 
31 
     | 
    
         
             
              Exclude:
         
     | 
| 
       92 
32 
     | 
    
         
             
                - 'lib/wicked_pdf/middleware.rb'
         
     | 
| 
       93 
     | 
    
         
            -
                - 'lib/wicked_pdf/pdf_helper.rb'
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       96 
     | 
    
         
            -
            Security/Open:
         
     | 
| 
       97 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       98 
     | 
    
         
            -
                - 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
         
     | 
| 
       99 
33 
     | 
    
         | 
| 
       100 
34 
     | 
    
         
             
            # Offense count: 1
         
     | 
| 
      
 35 
     | 
    
         
            +
            # This cop supports safe autocorrection (--autocorrect).
         
     | 
| 
      
 36 
     | 
    
         
            +
            # Configuration parameters: AllowOnConstant, AllowOnSelfClass.
         
     | 
| 
       101 
37 
     | 
    
         
             
            Style/CaseEquality:
         
     | 
| 
       102 
38 
     | 
    
         
             
              Exclude:
         
     | 
| 
       103 
39 
     | 
    
         
             
                - 'lib/wicked_pdf/wicked_pdf_helper.rb'
         
     | 
| 
         @@ -107,14 +43,17 @@ Style/ClassVars: 
     | 
|
| 
       107 
43 
     | 
    
         
             
              Exclude:
         
     | 
| 
       108 
44 
     | 
    
         
             
                - 'lib/wicked_pdf.rb'
         
     | 
| 
       109 
45 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
            # Offense count:  
     | 
| 
      
 46 
     | 
    
         
            +
            # Offense count: 13
         
     | 
| 
      
 47 
     | 
    
         
            +
            # Configuration parameters: AllowedConstants.
         
     | 
| 
       111 
48 
     | 
    
         
             
            Style/Documentation:
         
     | 
| 
       112 
49 
     | 
    
         
             
              Exclude:
         
     | 
| 
       113 
50 
     | 
    
         
             
                - 'spec/**/*'
         
     | 
| 
       114 
51 
     | 
    
         
             
                - 'test/**/*'
         
     | 
| 
       115 
52 
     | 
    
         
             
                - 'generators/wicked_pdf/wicked_pdf_generator.rb'
         
     | 
| 
       116 
53 
     | 
    
         
             
                - 'lib/wicked_pdf.rb'
         
     | 
| 
      
 54 
     | 
    
         
            +
                - 'lib/wicked_pdf/binary.rb'
         
     | 
| 
       117 
55 
     | 
    
         
             
                - 'lib/wicked_pdf/middleware.rb'
         
     | 
| 
      
 56 
     | 
    
         
            +
                - 'lib/wicked_pdf/option_parser.rb'
         
     | 
| 
       118 
57 
     | 
    
         
             
                - 'lib/wicked_pdf/pdf_helper.rb'
         
     | 
| 
       119 
58 
     | 
    
         
             
                - 'lib/wicked_pdf/progress.rb'
         
     | 
| 
       120 
59 
     | 
    
         
             
                - 'lib/wicked_pdf/railtie.rb'
         
     | 
| 
         @@ -123,71 +62,44 @@ Style/Documentation: 
     | 
|
| 
       123 
62 
     | 
    
         
             
                - 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
         
     | 
| 
       124 
63 
     | 
    
         | 
| 
       125 
64 
     | 
    
         
             
            # Offense count: 2
         
     | 
| 
       126 
     | 
    
         
            -
            #  
     | 
| 
      
 65 
     | 
    
         
            +
            # This cop supports safe autocorrection (--autocorrect).
         
     | 
| 
       127 
66 
     | 
    
         
             
            Style/ExpandPathArguments:
         
     | 
| 
       128 
67 
     | 
    
         
             
              Exclude:
         
     | 
| 
       129 
68 
     | 
    
         
             
                - 'test/test_helper.rb'
         
     | 
| 
       130 
69 
     | 
    
         
             
                - 'wicked_pdf.gemspec'
         
     | 
| 
       131 
70 
     | 
    
         | 
| 
       132 
     | 
    
         
            -
            # Offense count:  
     | 
| 
       133 
     | 
    
         
            -
            #  
     | 
| 
       134 
     | 
    
         
            -
            # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
         
     | 
| 
      
 71 
     | 
    
         
            +
            # Offense count: 4
         
     | 
| 
      
 72 
     | 
    
         
            +
            # This cop supports safe autocorrection (--autocorrect).
         
     | 
| 
      
 73 
     | 
    
         
            +
            # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
         
     | 
| 
       135 
74 
     | 
    
         
             
            # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
         
     | 
| 
      
 75 
     | 
    
         
            +
            # SupportedShorthandSyntax: always, never, either, consistent
         
     | 
| 
       136 
76 
     | 
    
         
             
            Style/HashSyntax:
         
     | 
| 
       137 
77 
     | 
    
         
             
              Exclude:
         
     | 
| 
       138 
     | 
    
         
            -
                - 'gemfiles/4.0.gemfile'
         
     | 
| 
       139 
     | 
    
         
            -
                - 'gemfiles/4.1.gemfile'
         
     | 
| 
       140 
     | 
    
         
            -
                - 'gemfiles/4.2.gemfile'
         
     | 
| 
       141 
78 
     | 
    
         
             
                - 'gemfiles/5.0.gemfile'
         
     | 
| 
       142 
79 
     | 
    
         
             
                - 'gemfiles/5.1.gemfile'
         
     | 
| 
       143 
80 
     | 
    
         
             
                - 'gemfiles/5.2.gemfile'
         
     | 
| 
       144 
81 
     | 
    
         
             
                - 'gemfiles/6.0.gemfile'
         
     | 
| 
       145 
     | 
    
         
            -
                - 'gemfiles/rails_edge.gemfile'
         
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
            # Offense count: 3
         
     | 
| 
       148 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       149 
     | 
    
         
            -
            Style/IfUnlessModifier:
         
     | 
| 
       150 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       151 
     | 
    
         
            -
                - 'Rakefile'
         
     | 
| 
       152 
     | 
    
         
            -
                - 'lib/wicked_pdf.rb'
         
     | 
| 
       153 
     | 
    
         
            -
                - 'lib/wicked_pdf/railtie.rb'
         
     | 
| 
       154 
82 
     | 
    
         | 
| 
       155 
83 
     | 
    
         
             
            # Offense count: 2
         
     | 
| 
       156 
     | 
    
         
            -
            #  
     | 
| 
      
 84 
     | 
    
         
            +
            # This cop supports unsafe autocorrection (--autocorrect-all).
         
     | 
| 
       157 
85 
     | 
    
         
             
            # Configuration parameters: EnforcedStyle.
         
     | 
| 
       158 
86 
     | 
    
         
             
            # SupportedStyles: literals, strict
         
     | 
| 
       159 
87 
     | 
    
         
             
            Style/MutableConstant:
         
     | 
| 
       160 
88 
     | 
    
         
             
              Exclude:
         
     | 
| 
       161 
89 
     | 
    
         
             
                - 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
         
     | 
| 
       162 
90 
     | 
    
         | 
| 
       163 
     | 
    
         
            -
            # Offense count:  
     | 
| 
       164 
     | 
    
         
            -
            #  
     | 
| 
      
 91 
     | 
    
         
            +
            # Offense count: 5
         
     | 
| 
      
 92 
     | 
    
         
            +
            # This cop supports safe autocorrection (--autocorrect).
         
     | 
| 
       165 
93 
     | 
    
         
             
            # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
         
     | 
| 
       166 
94 
     | 
    
         
             
            # SupportedStyles: slashes, percent_r, mixed
         
     | 
| 
       167 
95 
     | 
    
         
             
            Style/RegexpLiteral:
         
     | 
| 
       168 
96 
     | 
    
         
             
              Exclude:
         
     | 
| 
       169 
97 
     | 
    
         
             
                - 'lib/wicked_pdf/middleware.rb'
         
     | 
| 
       170 
98 
     | 
    
         
             
                - 'lib/wicked_pdf/wicked_pdf_helper/assets.rb'
         
     | 
| 
       171 
     | 
    
         
            -
                - 'test/unit/wicked_pdf_test.rb'
         
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       174 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       175 
     | 
    
         
            -
            # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
         
     | 
| 
       176 
     | 
    
         
            -
            # SupportedStyles: single_quotes, double_quotes
         
     | 
| 
       177 
     | 
    
         
            -
            Style/StringLiterals:
         
     | 
| 
       178 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       179 
     | 
    
         
            -
                - 'gemfiles/4.0.gemfile'
         
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
            # Offense count: 29
         
     | 
| 
       182 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       183 
     | 
    
         
            -
            # Configuration parameters: MinSize.
         
     | 
| 
       184 
     | 
    
         
            -
            # SupportedStyles: percent, brackets
         
     | 
| 
       185 
     | 
    
         
            -
            Style/SymbolArray:
         
     | 
| 
       186 
     | 
    
         
            -
              EnforcedStyle: brackets
         
     | 
| 
       187 
99 
     | 
    
         | 
| 
       188 
     | 
    
         
            -
            # Offense count:  
     | 
| 
       189 
     | 
    
         
            -
            #  
     | 
| 
       190 
     | 
    
         
            -
            # Configuration parameters:  
     | 
| 
      
 100 
     | 
    
         
            +
            # Offense count: 18
         
     | 
| 
      
 101 
     | 
    
         
            +
            # This cop supports safe autocorrection (--autocorrect).
         
     | 
| 
      
 102 
     | 
    
         
            +
            # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
         
     | 
| 
       191 
103 
     | 
    
         
             
            # URISchemes: http, https
         
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
            Layout/LineLength:
         
     | 
| 
       193 
105 
     | 
    
         
             
              Max: 563
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -4,11 +4,94 @@ This project adheres to [Semantic Versioning](http://semver.org/). 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            ## [master branch] - Unreleased
         
     | 
| 
       6 
6 
     | 
    
         
             
            ### Breaking Changes
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## [2.7.0]
         
     | 
| 
       8 
9 
     | 
    
         
             
            ### New Features
         
     | 
| 
       9 
     | 
    
         
            -
            -  
     | 
| 
      
 10 
     | 
    
         
            +
            - [Support Shakapacker 7](https://github.com/mileszs/wicked_pdf/pull/1067)
         
     | 
| 
      
 11 
     | 
    
         
            +
            - [Add option `delete_temporary_files` to keep the temporary files generated by `pdf_from_string` method](https://github.com/mileszs/wicked_pdf/pull/1068)
         
     | 
| 
      
 12 
     | 
    
         
            +
            - [Add support for --allow flag](https://github.com/mileszs/wicked_pdf/pull/1030)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            ## Fixes
         
     | 
| 
      
 15 
     | 
    
         
            +
            - [Add require for `stringio`, which is no longer loaded by default in Ruby 3.1+](https://github.com/mileszs/wicked_pdf/pull/1062)
         
     | 
| 
      
 16 
     | 
    
         
            +
            - [Fix CI build.](https://github.com/mileszs/wicked_pdf/pull/1055)
         
     | 
| 
      
 17 
     | 
    
         
            +
            - [Fix Header/footer temporary file is removed before `wkhtmltopdf` is called](https://github.com/mileszs/wicked_pdf/pull/1039)
         
     | 
| 
      
 18 
     | 
    
         
            +
            - [Bump rubocop to 1.46](https://github.com/mileszs/wicked_pdf/pull/1051)
         
     | 
| 
      
 19 
     | 
    
         
            +
            - [Add Ruby 3.2 to the test matrix](https://github.com/mileszs/wicked_pdf/pull/1046)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## [2.6.3]
         
     | 
| 
      
 22 
     | 
    
         
            +
            ### Fixes
         
     | 
| 
      
 23 
     | 
    
         
            +
            - [Fix typo of #possible_binary_locations](https://github.com/mileszs/wicked_pdf/pull/1025)
         
     | 
| 
      
 24 
     | 
    
         
            +
            - [Drop unused executables gemspec directive](https://github.com/mileszs/wicked_pdf/pull/1024)
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ## [2.6.2]
         
     | 
| 
       10 
27 
     | 
    
         
             
            ### Fixes
         
     | 
| 
       11 
     | 
    
         
            -
            -  
     | 
| 
      
 28 
     | 
    
         
            +
            - [Fix undefined local variable or method 'block' for render_to_string](https://github.com/mileszs/wicked_pdf/pull/962)
         
     | 
| 
      
 29 
     | 
    
         
            +
            - [Add require for `delegate`, which is no longer loaded by default in Ruby 2.7+](https://github.com/mileszs/wicked_pdf/pull/1019)
         
     | 
| 
      
 30 
     | 
    
         
            +
            ## [2.6.0]
         
     | 
| 
      
 31 
     | 
    
         
            +
            ### New Features
         
     | 
| 
      
 32 
     | 
    
         
            +
            - [Support Propshaft in find_asset helper](https://github.com/mileszs/wicked_pdf/pull/1010)
         
     | 
| 
      
 33 
     | 
    
         
            +
            ### Fixes
         
     | 
| 
      
 34 
     | 
    
         
            +
            - [Update Changelog with changes from 2.1.0](https://github.com/mileszs/wicked_pdf/pull/1013)
         
     | 
| 
      
 35 
     | 
    
         
            +
            - [Fix CI build for Rails 7.](https://github.com/mileszs/wicked_pdf/pull/1014)
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            ## [2.5.4] December 20th 2021 769f9df487f3c1e31dc91431666baa78d2aa24fb
         
     | 
| 
      
 38 
     | 
    
         
            +
            ### New Features
         
     | 
| 
      
 39 
     | 
    
         
            +
            - [Test with Rails 7](https://github.com/mileszs/wicked_pdf/pull/998)
         
     | 
| 
      
 40 
     | 
    
         
            +
            ### Fixes
         
     | 
| 
      
 41 
     | 
    
         
            +
            - [Include view helper on view load.](https://github.com/mileszs/wicked_pdf/pull/992)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            ## [2.5.3] December 15th 2021 7991877de634067b4245fb47fdad65da43761887
         
     | 
| 
      
 44 
     | 
    
         
            +
            - [Fix check for webpacker version](https://github.com/mileszs/wicked_pdf/pull/964)
         
     | 
| 
      
 45 
     | 
    
         
            +
            - [Complete transition to Github actions](https://github.com/mileszs/wicked_pdf/pull/987)
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            ## [2.5.2] November 2021 - fix webpacker_source_url bdd0ca3eca759e277ce5461141b1506f56fefcd1
         
     | 
| 
      
 48 
     | 
    
         
            +
            - [fix: `webpacker_source_url`](https://github.com/mileszs/wicked_pdf/pull/993)
         
     | 
| 
      
 49 
     | 
    
         
            +
            - [update README](https://github.com/mileszs/wicked_pdf/pull/968)
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            ## [2.5.1] September 2021 - fix webpacker helper, github actions and Readme updates ae725e8055dc8f51a392c27767b4dcdcfffe155d
         
     | 
| 
      
 52 
     | 
    
         
            +
            - [Add comment about enable_local_file_access to README](https://github.com/mileszs/wicked_pdf/commit/2dc96dde2e0fd7362395064f2480cac1edcc1f48)
         
     | 
| 
      
 53 
     | 
    
         
            +
            - [README updates](https://github.com/mileszs/wicked_pdf/pull/974) &&
         
     | 
| 
      
 54 
     | 
    
         
            +
            - [Github actions](https://github.com/mileszs/wicked_pdf/pull/986)
         
     | 
| 
      
 55 
     | 
    
         
            +
            - [Screencast links](https://github.com/mileszs/wicked_pdf/pull/976)
         
     | 
| 
      
 56 
     | 
    
         
            +
            - [fix url generating in webpacker helper](https://github.com/mileszs/wicked_pdf/pull/973)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            ## [2.5.0] November 2020 Release - 2b1d47a84fce3600e7cbe2f50843af1a7b84d4a6
         
     | 
| 
      
 59 
     | 
    
         
            +
            - [Remove code for unsupported rails and ruby versions](https://github.com/mileszs/wicked_pdf/pull/925)
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            ## [2.4.1] b56c46a05895def395ebc75ed8e822551c2c478f
         
     | 
| 
      
 62 
     | 
    
         
            +
            - [Extract reading in chunk](https://github.com/mileszs/wicked_pdf/pull/951)
         
     | 
| 
      
 63 
     | 
    
         
            +
            - [add ruby 2.7 to the test matrix](https://github.com/mileszs/wicked_pdf/pull/952)
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            ## [2.4.0] 8c007a77057e1a6680469d1ef53aa19a108fe209
         
     | 
| 
      
 66 
     | 
    
         
            +
            ### New Features
         
     | 
| 
      
 67 
     | 
    
         
            +
            - [Do not unlink HTML temp files immediately (to enable HTML tempfile inspection)](https://github.com/mileszs/wicked_pdf/pull/950)
         
     | 
| 
      
 68 
     | 
    
         
            +
            - [Read HTML string and generated PDF file in chunks (to reduce memory overhead of generating large PDFs)](https://github.com/mileszs/wicked_pdf/pull/949)
         
     | 
| 
      
 69 
     | 
    
         
            +
            - [Add `wicked_pdf_url_base64` helper](https://github.com/mileszs/wicked_pdf/pull/947)
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            ## [2.3.1] - Allow bundler 2.x ee6a5e1f807c872af37c1382f629dd4cac3040a8
         
     | 
| 
      
 72 
     | 
    
         
            +
            - [Adjust gemspec development dependencies](https://github.com/mileszs/wicked_pdf/pull/814)
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            ## [2.3.0] - Remove support for Ruby 1.x and Rails 2.x 66149c67e54cd3a63dd27528f5b78255fdd5ac43
         
     | 
| 
      
 75 
     | 
    
         
            +
            - [Remove support for Ruby 1.x and Rails 2.x](https://github.com/mileszs/wicked_pdf/pull/859)
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            ## [2.2.0] - October 2020 release f8abe706f5eb6dba2fcded473c81f2176e9d717e
         
     | 
| 
      
 78 
     | 
    
         
            +
            ### Fixes
         
     | 
| 
      
 79 
     | 
    
         
            +
            - [Make CI green again](https://github.com/mileszs/wicked_pdf/pull/939)
         
     | 
| 
      
 80 
     | 
    
         
            +
            - [rubocop fixes](https://github.com/mileszs/wicked_pdf/pull/945)
         
     | 
| 
      
 81 
     | 
    
         
            +
            ### New Features
         
     | 
| 
      
 82 
     | 
    
         
            +
            - [Add support for --keep-relative-links flag](https://github.com/mileszs/wicked_pdf/pull/930)
         
     | 
| 
      
 83 
     | 
    
         
            +
            - [Encapsulate binary path and version handling](https://github.com/mileszs/wicked_pdf/pull/816) && [#815](https://github.com/mileszs/wicked_pdf/pull/815)
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            ## [2.1.0] - 2020-06-14
         
     | 
| 
      
 87 
     | 
    
         
            +
            ### Fixes
         
     | 
| 
      
 88 
     | 
    
         
            +
            - [Document no_stop_slow_scripts in README](https://github.com/mileszs/wicked_pdf/pull/905)
         
     | 
| 
      
 89 
     | 
    
         
            +
            - [Document how to use locals in README](https://github.com/mileszs/wicked_pdf/pull/915)
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            ### New Features
         
     | 
| 
      
 92 
     | 
    
         
            +
            - [Improved support for Webpacker assets with `wicked_pdf_asset_pack_path`](https://github.com/mileszs/wicked_pdf/pull/896)
         
     | 
| 
      
 93 
     | 
    
         
            +
            - [Support enabling/disabling local file access compatible with wkhtmltopdf 0.12.6](https://github.com/mileszs/wicked_pdf/pull/920)
         
     | 
| 
      
 94 
     | 
    
         
            +
            - [Add option `use_xvfb` to emulate an X server](https://github.com/mileszs/wicked_pdf/pull/909)
         
     | 
| 
       12 
95 
     | 
    
         | 
| 
       13 
96 
     | 
    
         
             
            ## [2.0.2] - 2020-03-17
         
     | 
| 
       14 
97 
     | 
    
         
             
            ### Fixes
         
     | 
| 
         @@ -149,7 +232,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). 
     | 
|
| 
       149 
232 
     | 
    
         
             
            - Asset helpers no longer add a file extension if it already is specified with one
         
     | 
| 
       150 
233 
     | 
    
         | 
| 
       151 
234 
     | 
    
         
             
            # Compare Releases
         
     | 
| 
       152 
     | 
    
         
            -
            - [2.0 
     | 
| 
      
 235 
     | 
    
         
            +
            - [2.1.0...HEAD (unreleased changes)](https://github.com/mileszs/wicked_pdf/compare/2.1.0...HEAD)
         
     | 
| 
      
 236 
     | 
    
         
            +
            - [2.0.2...2.1.0](https://github.com/mileszs/wicked_pdf/compare/2.0.2...2.1.0)
         
     | 
| 
       153 
237 
     | 
    
         
             
            - [2.0.0...2.0.2](https://github.com/mileszs/wicked_pdf/compare/2.0.0...2.0.2)
         
     | 
| 
       154 
238 
     | 
    
         
             
            - [1.4.0...2.0.0](https://github.com/mileszs/wicked_pdf/compare/1.4.0...2.0.0)
         
     | 
| 
       155 
239 
     | 
    
         
             
            - [1.3.0...1.4.0](https://github.com/mileszs/wicked_pdf/compare/1.3.0...1.4.0)
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Wicked PDF [](http://badge.fury.io/rb/wicked_pdf) [](http://badge.fury.io/rb/wicked_pdf) [](https://github.com/mileszs/wicked_pdf/actions/workflows/ci.yml) [](https://codeclimate.com/github/mileszs/wicked_pdf) [](https://www.codetriage.com/mileszs/wicked_pdf)
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            ## A PDF generation plugin for Ruby on Rails
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
         @@ -43,7 +43,8 @@ If your wkhtmltopdf executable is not on your webserver's path, you can configur 
     | 
|
| 
       43 
43 
     | 
    
         | 
| 
       44 
44 
     | 
    
         
             
            ```ruby
         
     | 
| 
       45 
45 
     | 
    
         
             
            WickedPdf.config = {
         
     | 
| 
       46 
     | 
    
         
            -
              exe_path: '/usr/local/bin/wkhtmltopdf'
         
     | 
| 
      
 46 
     | 
    
         
            +
              exe_path: '/usr/local/bin/wkhtmltopdf',
         
     | 
| 
      
 47 
     | 
    
         
            +
              enable_local_file_access: true
         
     | 
| 
       47 
48 
     | 
    
         
             
            }
         
     | 
| 
       48 
49 
     | 
    
         
             
            ```
         
     | 
| 
       49 
50 
     | 
    
         | 
| 
         @@ -109,10 +110,11 @@ Using wicked_pdf_helpers with asset pipeline raises `Asset names passed to helpe 
     | 
|
| 
       109 
110 
     | 
    
         | 
| 
       110 
111 
     | 
    
         
             
            #### Webpacker usage
         
     | 
| 
       111 
112 
     | 
    
         | 
| 
       112 
     | 
    
         
            -
            wicked_pdf supports webpack  
     | 
| 
      
 113 
     | 
    
         
            +
            wicked_pdf supports webpack assets.
         
     | 
| 
       113 
114 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
            Use `wicked_pdf_stylesheet_pack_tag` for stylesheets
         
     | 
| 
       115 
     | 
    
         
            -
            Use `wicked_pdf_javascript_pack_tag` for javascripts
         
     | 
| 
      
 115 
     | 
    
         
            +
            - Use `wicked_pdf_stylesheet_pack_tag` for stylesheets
         
     | 
| 
      
 116 
     | 
    
         
            +
            - Use `wicked_pdf_javascript_pack_tag` for javascripts
         
     | 
| 
      
 117 
     | 
    
         
            +
            - Use `wicked_pdf_asset_pack_path` to access an asset directly, for example: `image_tag wicked_pdf_asset_pack_path("media/images/foobar.png")`
         
     | 
| 
       116 
118 
     | 
    
         | 
| 
       117 
119 
     | 
    
         
             
            #### Asset pipeline usage
         
     | 
| 
       118 
120 
     | 
    
         | 
| 
         @@ -124,11 +126,11 @@ It is best to precompile assets used in PDF views. This will help avoid issues w 
     | 
|
| 
       124 
126 
     | 
    
         | 
| 
       125 
127 
     | 
    
         
             
            In this case, you can use that standard Rails helpers and point to the current CDN for whichever framework you are using. For jQuery, it would look somethng like this, given the current versions at the time of this writing.
         
     | 
| 
       126 
128 
     | 
    
         
             
            ```html
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
            <!doctype html>
         
     | 
| 
      
 130 
     | 
    
         
            +
            <html>
         
     | 
| 
      
 131 
     | 
    
         
            +
              <head>
         
     | 
| 
      
 132 
     | 
    
         
            +
                <%= javascript_include_tag "http://code.jquery.com/jquery-1.10.0.min.js" %>
         
     | 
| 
      
 133 
     | 
    
         
            +
                <%= javascript_include_tag "http://code.jquery.com/ui/1.10.3/jquery-ui.min.js" %>
         
     | 
| 
       132 
134 
     | 
    
         
             
            ```
         
     | 
| 
       133 
135 
     | 
    
         | 
| 
       134 
136 
     | 
    
         
             
            ### Advanced Usage with all available options
         
     | 
| 
         @@ -144,6 +146,7 @@ class ThingsController < ApplicationController 
     | 
|
| 
       144 
146 
     | 
    
         
             
                    render pdf:                            'file_name',
         
     | 
| 
       145 
147 
     | 
    
         
             
                           disposition:                    'attachment',                 # default 'inline'
         
     | 
| 
       146 
148 
     | 
    
         
             
                           template:                       'things/show',
         
     | 
| 
      
 149 
     | 
    
         
            +
                           locals:                         {foo: @bar},
         
     | 
| 
       147 
150 
     | 
    
         
             
                           file:                           "#{Rails.root}/files/foo.erb",
         
     | 
| 
       148 
151 
     | 
    
         
             
                           inline:                         '<!doctype html><html><head></head><body>INLINE HTML</body></html>',
         
     | 
| 
       149 
152 
     | 
    
         
             
                           layout:                         'pdf',                        # for a pdf.pdf.erb file
         
     | 
| 
         @@ -182,11 +185,19 @@ class ThingsController < ApplicationController 
     | 
|
| 
       182 
185 
     | 
    
         
             
                           enable_plugins:                 true,
         
     | 
| 
       183 
186 
     | 
    
         
             
                           disable_internal_links:         true,
         
     | 
| 
       184 
187 
     | 
    
         
             
                           disable_external_links:         true,
         
     | 
| 
      
 188 
     | 
    
         
            +
                           keep_relative_links:            true,
         
     | 
| 
       185 
189 
     | 
    
         
             
                           print_media_type:               true,
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
                           # define as true the key 'disable_local_file_access' or 'enable_local_file_access', not both
         
     | 
| 
      
 192 
     | 
    
         
            +
                           disable_local_file_access:      true,
         
     | 
| 
      
 193 
     | 
    
         
            +
                           enable_local_file_access:       false,                     # must be true when using wkhtmltopdf > 0.12.6
         
     | 
| 
      
 194 
     | 
    
         
            +
                           allow:                          ["#{Rails.root}/public"],  # could be an array or a single string
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
       186 
196 
     | 
    
         
             
                           disable_smart_shrinking:        true,
         
     | 
| 
       187 
197 
     | 
    
         
             
                           use_xserver:                    true,
         
     | 
| 
       188 
198 
     | 
    
         
             
                           background:                     false,                     # background needs to be true to enable background colors to render
         
     | 
| 
       189 
199 
     | 
    
         
             
                           no_background:                  true,
         
     | 
| 
      
 200 
     | 
    
         
            +
                           no_stop_slow_scripts:           false,
         
     | 
| 
       190 
201 
     | 
    
         
             
                           viewport_size:                  'TEXT',                    # available only with use_xserver or patched QT
         
     | 
| 
       191 
202 
     | 
    
         
             
                           extra:                          '',                        # directly inserted into the command to wkhtmltopdf
         
     | 
| 
       192 
203 
     | 
    
         
             
                           raise_on_all_errors:            nil,                       # raise error for any stderr output.  Such as missing media, image assets
         
     | 
| 
         @@ -248,7 +259,8 @@ class ThingsController < ApplicationController 
     | 
|
| 
       248 
259 
     | 
    
         
             
                                        disable_toc_links: true,
         
     | 
| 
       249 
260 
     | 
    
         
             
                                        disable_back_links:true,
         
     | 
| 
       250 
261 
     | 
    
         
             
                                        xsl_style_sheet:   'file.xsl'}, # optional XSLT stylesheet to use for styling table of contents
         
     | 
| 
       251 
     | 
    
         
            -
                           progress: proc { |output| puts output } # proc called when console output changes
         
     | 
| 
      
 262 
     | 
    
         
            +
                           progress: proc { |output| puts output }, # proc called when console output changes
         
     | 
| 
      
 263 
     | 
    
         
            +
                           delete_temporary_files: true             # explicitly delete temporary files, default false
         
     | 
| 
       252 
264 
     | 
    
         
             
                  end
         
     | 
| 
       253 
265 
     | 
    
         
             
                end
         
     | 
| 
       254 
266 
     | 
    
         
             
              end
         
     | 
| 
         @@ -283,14 +295,14 @@ pdf = WickedPdf.new.pdf_from_html_file('/your/absolute/path/here') 
     | 
|
| 
       283 
295 
     | 
    
         
             
            # create a pdf from a URL
         
     | 
| 
       284 
296 
     | 
    
         
             
            pdf = WickedPdf.new.pdf_from_url('https://github.com/mileszs/wicked_pdf')
         
     | 
| 
       285 
297 
     | 
    
         | 
| 
       286 
     | 
    
         
            -
            # create a pdf from string using templates, layouts and content option for header or footer
         
     | 
| 
      
 298 
     | 
    
         
            +
            # create a pdf from string using templates, layouts, and content option for header or footer
         
     | 
| 
       287 
299 
     | 
    
         
             
            pdf = WickedPdf.new.pdf_from_string(
         
     | 
| 
       288 
300 
     | 
    
         
             
              render_to_string('templates/pdf', layout: 'pdfs/layout_pdf.html'),
         
     | 
| 
       289 
301 
     | 
    
         
             
              footer: {
         
     | 
| 
       290 
302 
     | 
    
         
             
                content: render_to_string(
         
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
      
 303 
     | 
    
         
            +
                  'templates/footer',
         
     | 
| 
      
 304 
     | 
    
         
            +
                  layout: 'pdfs/layout_pdf.html'
         
     | 
| 
      
 305 
     | 
    
         
            +
                )
         
     | 
| 
       294 
306 
     | 
    
         
             
              }
         
     | 
| 
       295 
307 
     | 
    
         
             
            )
         
     | 
| 
       296 
308 
     | 
    
         | 
| 
         @@ -421,8 +433,22 @@ JESii's post [WickedPDF, wkhtmltopdf, and Heroku...a tricky combination](http:// 
     | 
|
| 
       421 
433 
     | 
    
         | 
| 
       422 
434 
     | 
    
         
             
            Berislav Babic's post [Send PDF attachments from Rails with WickedPdf and ActionMailer](http://berislavbabic.com/send-pdf-attachments-from-rails-with-wickedpdf-and-actionmailer/)
         
     | 
| 
       423 
435 
     | 
    
         | 
| 
      
 436 
     | 
    
         
            +
            Corsego's 2021 post [Complete guide to generating PDFs with gem wicked_pdf](https://blog.corsego.com/gem-wicked-pdf)
         
     | 
| 
      
 437 
     | 
    
         
            +
             
     | 
| 
      
 438 
     | 
    
         
            +
            PDFTron's post [How to Generate PDFs With Ruby on Rails](https://www.pdftron.com/blog/rails/how-to-generate-pdf-with-ruby-on-rails/)
         
     | 
| 
      
 439 
     | 
    
         
            +
             
     | 
| 
       424 
440 
     | 
    
         
             
            StackOverflow [questions with the tag "wicked-pdf"](http://stackoverflow.com/questions/tagged/wicked-pdf)
         
     | 
| 
       425 
441 
     | 
    
         | 
| 
      
 442 
     | 
    
         
            +
            ### Screencasts
         
     | 
| 
      
 443 
     | 
    
         
            +
             
     | 
| 
      
 444 
     | 
    
         
            +
            * SupeRails Screencast [EN]
         
     | 
| 
      
 445 
     | 
    
         
            +
             
     | 
| 
      
 446 
     | 
    
         
            +
            [](https://youtu.be/tFvtwEmW-GE)
         
     | 
| 
      
 447 
     | 
    
         
            +
             
     | 
| 
      
 448 
     | 
    
         
            +
            * codigofacilito Screencast [ES]
         
     | 
| 
      
 449 
     | 
    
         
            +
             
     | 
| 
      
 450 
     | 
    
         
            +
            [](https://youtu.be/jeWM_gusmJc)
         
     | 
| 
      
 451 
     | 
    
         
            +
             
     | 
| 
       426 
452 
     | 
    
         
             
            ### Debugging
         
     | 
| 
       427 
453 
     | 
    
         | 
| 
       428 
454 
     | 
    
         
             
            Now you can use a debug param on the URL that shows you the content of the pdf in plain html to design it faster.
         
     | 
| 
         @@ -433,7 +459,7 @@ http://localhost:3001/CONTROLLER/X.pdf?debug 
     | 
|
| 
       433 
459 
     | 
    
         | 
| 
       434 
460 
     | 
    
         
             
            However, the wicked_pdf_* helpers will use file:/// paths for assets when using :show_as_html, and your browser's cross-domain safety feature will kick in, and not render them. To get around this, you can load your assets like so in your templates:
         
     | 
| 
       435 
461 
     | 
    
         
             
            ```html
         
     | 
| 
       436 
     | 
    
         
            -
             
     | 
| 
      
 462 
     | 
    
         
            +
            <%= params.key?('debug') ? image_tag('foo') : wicked_pdf_image_tag('foo') %>
         
     | 
| 
       437 
463 
     | 
    
         
             
            ```
         
     | 
| 
       438 
464 
     | 
    
         | 
| 
       439 
465 
     | 
    
         
             
            #### Gotchas
         
     | 
| 
         @@ -442,6 +468,22 @@ If one image from your HTML cannot be found (relative or wrong path for example) 
     | 
|
| 
       442 
468 
     | 
    
         | 
| 
       443 
469 
     | 
    
         
             
            wkhtmltopdf may render at different resolutions on different platforms. For example, Linux prints at 75 dpi (native for WebKit) while on Windows it's at the desktop's DPI (which is normally 96 dpi). [Use `:zoom => 0.78125`](https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2184) (75/96) to match Linux rendering to Windows.
         
     | 
| 
       444 
470 
     | 
    
         | 
| 
      
 471 
     | 
    
         
            +
            ### Security considerations
         
     | 
| 
      
 472 
     | 
    
         
            +
             
     | 
| 
      
 473 
     | 
    
         
            +
            WickedPdf renders page content on the server by saving HTML and assets to temporary files on disk, then executing `wkhtmltopdf` to convert that HTML to a PDF file.
         
     | 
| 
      
 474 
     | 
    
         
            +
             
     | 
| 
      
 475 
     | 
    
         
            +
            It is highly recommended if you allow user-generated HTML/CSS/JS to be converted to PDF, you sanitize it first, or at least disallow requesting content from internal IP addresses and hostnames.
         
     | 
| 
      
 476 
     | 
    
         
            +
             
     | 
| 
      
 477 
     | 
    
         
            +
            For example, these could potentially leak internal AWS metadata:
         
     | 
| 
      
 478 
     | 
    
         
            +
            ```html
         
     | 
| 
      
 479 
     | 
    
         
            +
            <iframe src="http://169.254.169.254/latest/meta-data/"></iframe>
         
     | 
| 
      
 480 
     | 
    
         
            +
            <object data="http://169.254.169.254/latest/meta-data/" type="text/html">
         
     | 
| 
      
 481 
     | 
    
         
            +
            ```
         
     | 
| 
      
 482 
     | 
    
         
            +
             
     | 
| 
      
 483 
     | 
    
         
            +
            Thank you to Adam Gold from [Snyk](https://snyk.io) for reporting this.
         
     | 
| 
      
 484 
     | 
    
         
            +
            We are considering adding host allow & block lists and/or potentially HTML element sanitizing.
         
     | 
| 
      
 485 
     | 
    
         
            +
            Please open an issue or PR to help us out with this.
         
     | 
| 
      
 486 
     | 
    
         
            +
             
     | 
| 
       445 
487 
     | 
    
         
             
            ### Inspiration
         
     | 
| 
       446 
488 
     | 
    
         | 
| 
       447 
489 
     | 
    
         
             
            You may have noticed: this plugin is heavily inspired by the PrinceXML plugin [princely](http://github.com/mbleigh/princely/tree/master).  PrinceXML's cost was prohibitive for me. So, with a little help from some friends (thanks [jqr](http://github.com/jqr)), I tracked down wkhtmltopdf, and here we are.
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ require 'rails/version' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require 'bundler/gem_tasks'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            desc 'Default: run unit tests.'
         
     | 
| 
       8 
     | 
    
         
            -
            task :default => [ 
     | 
| 
      
 8 
     | 
    
         
            +
            task :default => %i[setup_and_run_tests rubocop]
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            desc 'Test the wicked_pdf plugin.'
         
     | 
| 
       11 
11 
     | 
    
         
             
            Rake::TestTask.new(:test) do |t|
         
     | 
| 
         @@ -17,16 +17,13 @@ end 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            desc 'Run RuboCop'
         
     | 
| 
       19 
19 
     | 
    
         
             
            task :rubocop do
         
     | 
| 
       20 
     | 
    
         
            -
              next unless RUBY_VERSION >= '2.0.0'
         
     | 
| 
       21 
20 
     | 
    
         
             
              require 'rubocop/rake_task'
         
     | 
| 
       22 
21 
     | 
    
         
             
              RuboCop::RakeTask.new
         
     | 
| 
       23 
22 
     | 
    
         
             
            end
         
     | 
| 
       24 
23 
     | 
    
         | 
| 
       25 
24 
     | 
    
         
             
            desc 'Setup and run all tests'
         
     | 
| 
       26 
25 
     | 
    
         
             
            task :setup_and_run_tests do
         
     | 
| 
       27 
     | 
    
         
            -
              unless File.exist?('test/dummy/config/environment.rb')
         
     | 
| 
       28 
     | 
    
         
            -
                Rake::Task[:dummy_generate].invoke
         
     | 
| 
       29 
     | 
    
         
            -
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
              Rake::Task[:dummy_generate].invoke unless File.exist?('test/dummy/config/environment.rb')
         
     | 
| 
       30 
27 
     | 
    
         
             
              Rake::Task[:test].invoke
         
     | 
| 
       31 
28 
     | 
    
         
             
            end
         
     | 
| 
       32 
29 
     | 
    
         | 
| 
         @@ -34,11 +31,7 @@ desc 'Generate dummy application for test cases' 
     | 
|
| 
       34 
31 
     | 
    
         
             
            task :dummy_generate do
         
     | 
| 
       35 
32 
     | 
    
         
             
              Rake::Task[:dummy_remove].invoke
         
     | 
| 
       36 
33 
     | 
    
         
             
              puts 'Creating dummy application to run tests'
         
     | 
| 
       37 
     | 
    
         
            -
               
     | 
| 
       38 
     | 
    
         
            -
                system('rails new test/dummy --database=sqlite3')
         
     | 
| 
       39 
     | 
    
         
            -
              else
         
     | 
| 
       40 
     | 
    
         
            -
                system('rails test/dummy')
         
     | 
| 
       41 
     | 
    
         
            -
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
              system('rails new test/dummy --database=sqlite3')
         
     | 
| 
       42 
35 
     | 
    
         
             
              system('touch test/dummy/db/schema.rb')
         
     | 
| 
       43 
36 
     | 
    
         
             
              FileUtils.cp 'test/fixtures/database.yml', 'test/dummy/config/'
         
     | 
| 
       44 
37 
     | 
    
         
             
              FileUtils.rm_r Dir.glob('test/dummy/test/*')
         
     |