my_pdfkit 0.1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b592c911bea1ec92e16f47301ec55d71be516122
4
+ data.tar.gz: 85474282cf3891d96ef6232b117df788c56a7c3a
5
+ SHA512:
6
+ metadata.gz: 72387294a13288ded50e4a01dbc4420757c5de7c63bf8ad8048ad38fe995122d03bb425a88daf2b279ac0966b0eba949feafe7245021e358c5cf50109f8910a0
7
+ data.tar.gz: 8183f0fba1596cbae5ca749fe739cf6dca9fb5b92a5ed0347ef33d9578f5879decc4ac2394cd1eeead42048afcac81821c6d8e9e80db074c8d0996a560edcf52
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,19 @@
1
+ name: Release Drafter
2
+
3
+ on:
4
+ push:
5
+ # branches to consider in the event; optional, defaults to all
6
+ branches:
7
+ - master
8
+
9
+ jobs:
10
+ update_release_draft:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ # Drafts your next Release notes as Pull Requests are merged into "master"
14
+ - uses: release-drafter/release-drafter@v5
15
+ # with:
16
+ # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
17
+ # config-name: my-config.yml
18
+ env:
19
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,19 @@
1
+ name: Mark stale issues and pull requests
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 0 * * *"
6
+
7
+ jobs:
8
+ stale:
9
+
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/stale@v1
14
+ with:
15
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
16
+ stale-issue-message: 'This issue has been marked as stale and will be automatically closed.'
17
+ stale-pr-message: 'This pull request has been marked as stale and will be automatically closed.'
18
+ stale-issue-label: 'no-issue-activity'
19
+ stale-pr-label: 'no-pr-activity'
@@ -0,0 +1,71 @@
1
+ name: Test workflow
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ os: [ubuntu-latest]
11
+ ruby:
12
+ - '2.5'
13
+ - '2.6'
14
+ - '2.7'
15
+ - '3.0'
16
+ - '3.1'
17
+ rails:
18
+ - '~> 4.1'
19
+ - '~> 5.2'
20
+ - '~> 6.0.0'
21
+ - '~> 6.1'
22
+ - '~> 7.0.0'
23
+ exclude:
24
+ - ruby: '2.5'
25
+ rails: '~> 7.0.0'
26
+ - ruby: '2.6'
27
+ rails: '~> 7.0.0'
28
+ - ruby: '2.7'
29
+ rails: '~> 4.1'
30
+ - ruby: '3.0'
31
+ rails: '~> 4.1'
32
+ - ruby: '3.0'
33
+ rails: '~> 5.2'
34
+ - ruby: '3.1'
35
+ rails: '~> 4.1'
36
+ - ruby: '3.1'
37
+ rails: '~> 5.2'
38
+ - ruby: '3.1'
39
+ rails: '~> 6.0.0'
40
+ runs-on: ${{ matrix.os }}
41
+ env:
42
+ RAILS_VERSION: ${{ matrix.rails }}
43
+ steps:
44
+ - uses: actions/checkout@v2
45
+ - uses: ruby/setup-ruby@v1
46
+ # rubygems-update's latest is no longer compatible with ruby 2.5, so conditionally run ruby-setup setting the
47
+ # rubygem version the most recent valid version for 2.5:
48
+ # https://rubygems.org/gems/rubygems-update/versions/3.3.26
49
+ if: ${{ matrix.ruby == '2.5' }}
50
+ with:
51
+ ruby-version: ${{ matrix.ruby }}
52
+ rubygems: 3.3.26
53
+ bundler: latest
54
+ bundler-cache: true
55
+ - uses: ruby/setup-ruby@v1
56
+ # otherwise, we can use rubygems latest
57
+ if: ${{ matrix.ruby != '2.5' }}
58
+ with:
59
+ ruby-version: ${{ matrix.ruby }}
60
+ rubygems: latest
61
+ bundler: latest
62
+ bundler-cache: true
63
+
64
+ - name: Setup wkhtmltopdf
65
+ run: |
66
+ sudo apt-get install -y xfonts-base xfonts-75dpi
67
+ wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
68
+ sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
69
+
70
+ - name: Run tests
71
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ .bundle
23
+ spec/custom_wkhtmltopdf_path.rb
24
+ spec/test_save.pdf
25
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ my_pdfkit
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.6.9
data/.travis.yml ADDED
@@ -0,0 +1,46 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
+ - 3.0
8
+ - 3.1
9
+
10
+ env:
11
+ matrix:
12
+ - RAILS_VERSION="~> 4.1"
13
+ - RAILS_VERSION="~> 5.2"
14
+ - RAILS_VERSION="~> 6.0.0"
15
+ - RAILS_VERSION="~> 6.1"
16
+ - RAILS_VERSION="~> 7.0.0"
17
+
18
+ jobs:
19
+ exclude:
20
+ - rvm: 2.5
21
+ env: RAILS_VERSION="~> 7.0.0"
22
+ - rvm: 2.6
23
+ env: RAILS_VERSION="~> 7.0.0"
24
+ - rvm: 2.7
25
+ env: RAILS_VERSION="~> 4.1"
26
+ - rvm: 3.0
27
+ env: RAILS_VERSION="~> 4.1"
28
+ - rvm: 3.0
29
+ env: RAILS_VERSION="~> 5.2"
30
+ - rvm: 3.1
31
+ env: RAILS_VERSION="~> 4.1"
32
+ - rvm: 3.1
33
+ env: RAILS_VERSION="~> 5.2"
34
+ - rvm: 3.1
35
+ env: RAILS_VERSION="~> 6.0.0"
36
+
37
+ cache: bundler
38
+
39
+ before_install:
40
+ - gem update --system
41
+ - gem update bundler
42
+
43
+ before_script:
44
+ - "sudo apt-get -qq -y install fontconfig libxrender1"
45
+ - "wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.xenial_amd64.deb"
46
+ - "sudo apt-get install ./wkhtmltox_0.12.5-1.xenial_amd64.deb"
data/CHANGELOG.md ADDED
@@ -0,0 +1,154 @@
1
+ 2023-02-27
2
+ =================
3
+ * Bump to 0.8.7.3
4
+ * Allow passing a `Pathname` object to the `path` argument by @yujideveloper in https://github.com/pdfkit/pdfkit/pull/522
5
+ * Update repeatable options by @mguidetti in https://github.com/pdfkit/pdfkit/pull/524
6
+
7
+ 2022-10-18
8
+ =================
9
+ * Bump to 0.8.7.2
10
+ * Call IO.popen with an Array of command arguments (#519)
11
+
12
+ 2022-10-17
13
+ =================
14
+ * Bump to 0.8.7.1
15
+ * Support non-lower-case Content-Type header provided by app (#516)
16
+
17
+ 2022-10-02
18
+ =================
19
+ * Bump to 0.8.7
20
+ * Lowercase the header names for rack 3 changes (#511)
21
+ * Partially escaped URLs should be escaped (#509)
22
+
23
+ 2022-04-11
24
+ =================
25
+ * Bump to 0.8.6
26
+ * Update ruby and rails versions
27
+
28
+ 2021-01-23
29
+ =================
30
+ * Bump to 0.8.5
31
+ * Make `MyPDFKit::VERSION` public (#484)
32
+ * Fix to render stylesheets as html safe string on Rails 6 (#483)
33
+ * Adds support for Rails 6
34
+
35
+ 2020-08-16
36
+ =================
37
+ * Bump to 0.8.4.3.2
38
+ * Reduce scope of middleware exception handling (#476)
39
+
40
+ 2020-07-05
41
+ =================
42
+ * Bump to 0.8.4.3.1
43
+ * Don't override request level Content-Disposition header if it exists (#466)
44
+ * Update rake (#471)
45
+ * Add missing require statements for tempfile (#467)
46
+ * Only grab last line of bundle exec which output (#464)
47
+ * Return 500 status when an exception is caught in middleware (#469)
48
+ * Update Travis CI URL for wkhtmltopf (#473)
49
+
50
+ 2020-04-01
51
+ =================
52
+ * Bump to 0.8.4.2
53
+ * Improve path detection feedback (#460)
54
+ * Fix typos (#444)
55
+ * Update readme (#439)
56
+
57
+ 2019-02-22
58
+ =================
59
+ * Bump to 0.8.4.1
60
+ * Make PDFkit threadsafe (#377)
61
+ * Update activesupport (#434)
62
+
63
+ 2019-02-21
64
+ =================
65
+ * Bump to 0.8.4
66
+ * Removed support for Ruby < 2.2
67
+ * Xvfb support (#277)
68
+ * Remove 'config.protocol' from the README (#389)
69
+
70
+ 2015-08-26
71
+ =================
72
+ * Bump to 0.8.2
73
+ * Fix URI errors for users using MyPDFKit in contexts with 'uri' not
74
+ already required (thanks christhekeele)
75
+
76
+ 2015-08-20
77
+ =================
78
+ * Bump to 0.8.1
79
+ * Fix shell escaping issues for Windows (thanks muness)
80
+ * Fix shell escaping issues for URLs, introduced in 0.5.3 release
81
+
82
+ 2015-07-08
83
+ =================
84
+ * Bump to 0.8.0
85
+ * Support Cover and Table Of Contents options (thanks @nicpillinger)
86
+ * Fix repeatings keys with string values
87
+ * Fix caching bug (thanks @jocranford)
88
+ * Fix munging of relative paths (thanks @jocranford)
89
+ * Fix bug where nil values did not stay nil (thanks @tylerITP)
90
+
91
+ 2015-05-06
92
+ =================
93
+ * Bump to 0.7.0
94
+ * Fix issue #230 where MyPDFKit called `bundle exec` without a Gemfile
95
+ * Fix issue #183 where MyPDFKit broke the path to wkhtmltopdf.exe by escaping
96
+ spaces in paths
97
+ * Improve performance by not storing the PDF in memory if a path is
98
+ provided. Thanks @mikefarah
99
+ * Middleware now infers HTTP or HTTPS from environment for relative URLs
100
+
101
+ 2014-04-20
102
+ ==================
103
+ * Bump to 0.6.2
104
+ * There was a bug where parsing meta tags would include the option name
105
+ causing an invalid command to be generated. This was fixed in #229 after
106
+ being reported by Frank Oxener.
107
+
108
+ 2014-02-18
109
+ ==================
110
+ * Bump to 0.6.0
111
+ * Added ability to run wkhtmltopdf without `--quiet`
112
+ * Now handles repeatable options as both config parameters and meta tag
113
+ options
114
+ * Fix status code 2 being treated as failure
115
+ * Escape `\X` in styesheets
116
+ * Allow controllers to set MyPDFKit-save-pdf
117
+ * Fix Middleware not respecting subdomains in path
118
+
119
+ 2013-06-12
120
+ ==================
121
+ * Bump to 0.5.4
122
+ * Fix broken page numbers (https://github.com/pdfkit/pdfkit/pull/181)
123
+
124
+ 2013-02-21
125
+ ==================
126
+ * Bump to 0.5.3
127
+ * Fix security vulnerability due to unsanitized strings being passed to `wkhtmltopdf` (https://github.com/pdfkit/pdfkit/issues/164)
128
+
129
+ 2011-07-02
130
+ ==================
131
+ * Bump to 0.5.2
132
+ * Fix of dealing with ActiveSupport::SafeBuffer >= 3.0.8.
133
+ * Fix for meta tag options getting dropped in REE 1.8.7.
134
+ * Fix on bundler environment detection.
135
+
136
+ 2011-06-17
137
+ ==================
138
+ * Bump to 0.5.1
139
+ * Fix for response body coming through as an array.
140
+ * Added root_url configuration for setup where a host my not know its own name.
141
+ * Awareness of Bundler when looking for the wkhtmltopdf executable.
142
+ * Fix for file data getting truncated in Ruby 1.8.6
143
+ * Fix for 0.5.0 release getting stuck rendering all requests as PDFs.
144
+ * More robust meta tag detection.
145
+
146
+ 2010-12-27
147
+ ==================
148
+ * Bump to 0.5.0
149
+ * Switched to popen - adds support for JRuby and Windows
150
+ * Pulled in support for pdf rendering conditions in middleware via Rémy Coutable
151
+ * Use `which` to try and determine path to wkhtmltopdf
152
+ * Removed wkhtmltopdf auto installer
153
+ * Changed :disable\_smart\_shrinking to false for default options.
154
+ * Added History.md
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'activesupport', ENV['RAILS_VERSION'] || '~> 4.1'
5
+ gem 'simplecov', require: false
6
+ end
7
+
8
+ group :development, :test do
9
+ gem 'pry'
10
+ end
11
+
12
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 jdpace
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/POST_INSTALL ADDED
@@ -0,0 +1,14 @@
1
+ ******************************************************************
2
+
3
+ Install wkhtmltopdf:
4
+
5
+ 1. Install by hand (recomended):
6
+
7
+ https://github.com/pdfkit/MyPDFKit/wiki/Installing-WKHTMLTOPDF
8
+
9
+ 2. Try using the wkhtmltopdf-binary gem (mac + linux i386)
10
+
11
+ gem install wkhtmltopdf-binary
12
+
13
+
14
+ ******************************************************************
data/README.md ADDED
@@ -0,0 +1,190 @@
1
+ # MyPDFKit
2
+
3
+ Create PDFs using plain old HTML+CSS. Uses [wkhtmltopdf](http://github.com/antialize/wkhtmltopdf) on the back-end which renders HTML using Webkit.
4
+
5
+ ## Supported versions
6
+
7
+ - Ruby 2.5, 2.6, 2.7, 3.0, 3.1
8
+ - Rails 4.2, 5.2, 6.0, 6.1, 7.0
9
+
10
+ ## Install
11
+
12
+ ### MyPDFKit
13
+ ```
14
+ gem install my_pdfkit
15
+ ```
16
+ ### wkhtmltopdf
17
+
18
+ 1. Install by hand (recommended):
19
+
20
+ <https://github.com/pdfkit/pdfkit/wiki/Installing-WKHTMLTOPDF>
21
+
22
+ 2. Try using the `wkhtmltopdf-binary-edge` gem (mac + linux i386)
23
+ ```
24
+ gem install wkhtmltopdf-binary
25
+ ```
26
+ *Note:* The automated installer has been removed.
27
+
28
+ ## Usage
29
+ ```ruby
30
+ # MyPDFKit.new takes the HTML and any options for wkhtmltopdf
31
+ # run `wkhtmltopdf --extended-help` for a full list of options
32
+ kit = MyPDFKit.new(html, :page_size => 'Letter')
33
+ kit.stylesheets << '/path/to/css/file'
34
+
35
+ # Get an inline PDF
36
+ pdf = kit.to_pdf
37
+
38
+ # Save the PDF to a file
39
+ file = kit.to_file('/path/to/save/pdf')
40
+
41
+ # MyPDFKit.new can optionally accept a URL or a File.
42
+ # Stylesheets can not be added when source is provided as a URL or File.
43
+ kit = MyPDFKit.new('http://google.com')
44
+ kit = MyPDFKit.new(File.new('/path/to/html'))
45
+
46
+ # Add any kind of option through meta tags
47
+ MyPDFKit.new('<html><head><meta name="pdfkit-page_size" content="Letter"')
48
+ MyPDFKit.new('<html><head><meta name="pdfkit-cookie cookie_name1" content="cookie_value1"')
49
+ MyPDFKit.new('<html><head><meta name="pdfkit-cookie cookie_name2" content="cookie_value2"')
50
+ ```
51
+
52
+ ### Resolving relative URLs and protocols
53
+
54
+ If the source HTML has relative URLs (`/images/cat.png`) or
55
+ [protocols](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#prurl)
56
+ (`//example.com/site.css`) that need to be resolved, you can pass `:root_url`
57
+ and `:protocol` options to MyPDFKit:
58
+
59
+ ```ruby
60
+ MyPDFKit.new(html, root_url: 'http://mysite.com/').to_file
61
+ # or:
62
+ MyPDFKit.new(html, protocol: 'https').to_file
63
+ ```
64
+
65
+ ### Using cookies in scraping
66
+ If you want to pass a cookie to pdfkit to scrape a website, you can
67
+ pass it in a hash:
68
+ ```ruby
69
+ kit = MyPDFKit.new(url, cookie: {cookie_name: :cookie_value})
70
+ kit = MyPDFKit.new(url, [:cookie, :cookie_name1] => :cookie_val1, [:cookie, :cookie_name2] => :cookie_val2)
71
+ ```
72
+ ## Configuration
73
+ If you're on Windows or you would like to use a specific wkhtmltopdf you installed, you will need to tell MyPDFKit where the binary is. MyPDFKit will try to intelligently guess at the location of wkhtmltopdf by running the command `which wkhtmltopdf`. If you are on Windows, want to point MyPDFKit to a different binary, or are having trouble with getting MyPDFKit to find your binary, please manually configure the wkhtmltopdf location. You can configure MyPDFKit like so:
74
+ ```ruby
75
+ # config/initializers/pdfkit.rb
76
+ MyPDFKit.configure do |config|
77
+ config.wkhtmltopdf = '/path/to/wkhtmltopdf'
78
+ config.default_options = {
79
+ :page_size => 'Legal',
80
+ :print_media_type => true
81
+ }
82
+ # Use only if your external hostname is unavailable on the server.
83
+ config.root_url = "http://localhost"
84
+ config.verbose = false
85
+ end
86
+ ```
87
+ ## Middleware
88
+ MyPDFKit comes with a middleware that allows users to get a PDF view of any page on your site by appending .pdf to the URL.
89
+
90
+ ### Middleware Setup
91
+ **Non-Rails Rack apps**
92
+ ```ruby
93
+ # in config.ru
94
+ require 'my_pdfkit'
95
+ use MyPDFKit::Middleware
96
+ ```
97
+ **Rails apps**
98
+ ```ruby
99
+ # in application.rb(Rails3) or environment.rb(Rails2)
100
+ require 'pdfkit'
101
+ config.middleware.use MyPDFKit::Middleware
102
+ ```
103
+ **With MyPDFKit options**
104
+ ```ruby
105
+ # options will be passed to MyPDFKit.new
106
+ config.middleware.use MyPDFKit::Middleware, :print_media_type => true
107
+ ```
108
+ **With conditions to limit routes that can be generated in pdf**
109
+ ```ruby
110
+ # conditions can be regexps (either one or an array)
111
+ config.middleware.use MyPDFKit::Middleware, {}, :only => %r[^/public]
112
+ config.middleware.use MyPDFKit::Middleware, {}, :only => [%r[^/invoice], %r[^/public]]
113
+
114
+ # conditions can be strings (either one or an array)
115
+ config.middleware.use MyPDFKit::Middleware, {}, :only => '/public'
116
+ config.middleware.use MyPDFKit::Middleware, {}, :only => ['/invoice', '/public']
117
+
118
+ # conditions can be regexps (either one or an array)
119
+ config.middleware.use MyPDFKit::Middleware, {}, :except => [%r[^/prawn], %r[^/secret]]
120
+
121
+ # conditions can be strings (either one or an array)
122
+ config.middleware.use MyPDFKit::Middleware, {}, :except => ['/secret']
123
+ ```
124
+ **With conditions to force download**
125
+ ```ruby
126
+ # force download with attachment disposition
127
+ config.middleware.use MyPDFKit::Middleware, {}, :disposition => 'attachment'
128
+ # conditions can force a filename
129
+ config.middleware.use MyPDFKit::Middleware, {}, :disposition => 'attachment; filename=report.pdf'
130
+ ```
131
+ **Saving the generated .pdf to disk**
132
+
133
+ Setting the `MyPDFKit-save-pdf` header will cause MyPDFKit to write the generated .pdf to the file indicated by the value of the header.
134
+
135
+ For example:
136
+ ```ruby
137
+ headers['MyPDFKit-save-pdf'] = 'path/to/saved.pdf'
138
+ ```
139
+
140
+ Will cause the .pdf to be saved to `path/to/saved.pdf` in addition to being sent back to the client. If the path is not writable/non-existent the write will fail silently. The `MyPDFKit-save-pdf` header is never sent back to the client.
141
+
142
+ ## Troubleshooting
143
+
144
+ * **Single thread issue:** In development environments it is common to run a
145
+ single server process. This can cause issues when rendering your pdf
146
+ requires wkhtmltopdf to hit your server again (for images, js, css).
147
+ This is because the resource requests will get blocked by the initial
148
+ request and the initial request will be waiting on the resource
149
+ requests causing a deadlock.
150
+
151
+ This is usually not an issue in a production environment. To get
152
+ around this issue you may want to run a server with multiple workers
153
+ like Passenger or try to embed your resources within your HTML to
154
+ avoid extra HTTP requests.
155
+
156
+ Example solution (rails / bundler), add unicorn to the development
157
+ group in your Gemfile `gem 'unicorn'` then run `bundle`. Next, add a
158
+ file `config/unicorn.conf` with
159
+
160
+ worker_processes 3
161
+
162
+ Then to run the app `unicorn_rails -c config/unicorn.conf` (from rails_root)
163
+
164
+ * **Resources aren't included in the PDF:** Images, CSS, or JavaScript
165
+ does not seem to be downloading correctly in the PDF. This is due
166
+ to the fact that wkhtmltopdf does not know where to find those files.
167
+ Make sure you are using absolute paths (start with forward slash) to
168
+ your resources. If you are using MyPDFKit to generate PDFs from a raw
169
+ HTML source make sure you use complete paths (either file paths or
170
+ urls including the domain). In restrictive server environments the
171
+ root_url configuration may be what you are looking for change your
172
+ asset host.
173
+
174
+ * **Mangled output in the browser:** Be sure that your HTTP response
175
+ headers specify "content-type: application/pdf"
176
+
177
+ ## Note on Patches/Pull Requests
178
+
179
+ * Fork the project.
180
+ * Setup your development environment with: `gem install bundler`; `bundle install`
181
+ * Make your feature addition or bug fix.
182
+ * Add tests for it. This is important so I don't break it in a
183
+ future version unintentionally.
184
+ * Commit, do not mess with rakefile, version, or history.
185
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
186
+ * Send me a pull request. Bonus points for topic branches.
187
+
188
+ ## Copyright
189
+
190
+ Copyright (c) 2010 Jared Pace. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec) do |spec|
8
+ end
9
+
10
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
11
+ spec.rcov = true
12
+ end
13
+
14
+ task :default => :spec
15
+
16
+ require 'rdoc/task'
17
+ RDoc::Task.new do |rdoc|
18
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
19
+
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = "MyPDFKit #{version}"
22
+ rdoc.rdoc_files.include('README*')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end