ferrum_pdf 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -12
  3. data/lib/ferrum_pdf/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd59867787cfd16bf19645eda1dce8c8f21541d3d8b52614e025a60847787930
4
- data.tar.gz: 5dd180545309a3a0c61ba90286943404382478c44337495c81237f49953559dd
3
+ metadata.gz: 0ea0c6aba4254ef7d958dec7d9f51048ce82e106ab068a413c1e3b83ec470b01
4
+ data.tar.gz: e34df1014f457e4ad42a41a5a29ab9a0d0ab42027cb8d8374aeacf6557a49833
5
5
  SHA512:
6
- metadata.gz: 4b42648daf392f18fc9f1b8dfa947a1b26a1af29eb615af558dd23440222e80f9d846c40fe44206b1dd9f8bfcad5be64f5987559c6e833a2547b246a97093226
7
- data.tar.gz: 649e5d9b57f8bfd4ad9e0c62d23cba3f1b435ec3a7a13a237e8e0cd567914e4958d93489519c103166bed3912327547bfe443af0f8f04697043a05e33658a7ed
6
+ metadata.gz: 68e840f65f0c0821cb8dfe6f3e249e2b5b567f8d3655c1a71a59f143beb25241aedea29fe33d95b18763a32fd5eea88bec9f6a9f4b0b6181df082544cc2453c2
7
+ data.tar.gz: 123f094697e37dcee391c157ca5ba379b1b9557e8a4e7c017cb7b45861936bf24e484bec74092793dd3e64e36ffaee0a98bc613f56ed9a5e4e2dfefdbf7f1ac1
data/README.md CHANGED
@@ -1,28 +1,59 @@
1
1
  # FerrumPdf
2
- Short description and motivation.
3
2
 
4
- ## Usage
5
- How to use my plugin.
3
+ PDFs for Rails using [Ferrum](https://github.com/rubycdp/ferrum) & headless Chrome
6
4
 
7
5
  ## Installation
8
- Add this line to your application's Gemfile:
6
+
7
+ Run the following or add the gem to your Gemfile:
8
+
9
+ ```ruby
10
+ bundle add "ferrum_pdf"
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Rails controllers
16
+
17
+ Use the `render_pdf` helper in Rails controllers to render a PDF from the current action.
18
+
19
+ ```ruby
20
+ def show
21
+ respond_to do |format|
22
+ format.html
23
+ format.pdf { send_data render_pdf, disposition: :inline, filename: "example.pdf" }
24
+ end
25
+ end
26
+ ```
27
+
28
+ You can also customize which template is rendered:
9
29
 
10
30
  ```ruby
11
- gem "ferrum_pdf"
31
+ render_pdf(name = action_name, formats: [ :html ])
12
32
  ```
13
33
 
14
- And then execute:
15
- ```bash
16
- $ bundle
34
+ This will render the template to string, then pass it along to FerrumPdf.
35
+
36
+ ### Directly with HTML
37
+
38
+ FerrumPdf can generate a PDF from HTML directly:
39
+
40
+ ```ruby
41
+ FerrumPdf.render_pdf(html: content)
17
42
  ```
18
43
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install ferrum_pdf
44
+ You can also pass host and protocol to convert any relative paths to full URLs. This is helpful for converting relative asset paths to full URLs.
45
+
46
+ ```ruby
47
+ FerrumPdf.render_pdf(
48
+ html: content,
49
+ host: request.host_with_port,
50
+ protocol: request.protocol
51
+ )
22
52
  ```
23
53
 
24
54
  ## Contributing
25
- Contribution directions go here.
55
+
56
+ If you have an issue you'd like to submit, please do so using the issue tracker in GitHub. In order for us to help you in the best way possible, please be as detailed as you can.
26
57
 
27
58
  ## License
28
59
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,3 +1,3 @@
1
1
  module FerrumPdf
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferrum_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.2.1
19
+ version: 6.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 7.2.1
26
+ version: 6.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ferrum
29
29
  requirement: !ruby/object:Gem::Requirement