icanhazpdf 0.0.5.0 → 0.0.5.1
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/Gemfile.lock +1 -1
- data/README.md +4 -3
- data/lib/icanhazpdf/client.rb +3 -1
- data/lib/icanhazpdf/controller.rb +1 -1
- data/lib/icanhazpdf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d89c8453bb83ede82e17a77f47b7b4f80a7a78d0
|
4
|
+
data.tar.gz: d0e9e158d6077e613da20ac9c1f7611379b407ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 001a9f87d9ad48613250987aa9bde715a135a8e96e27e1fdefa20576db89d0061f8f3645115949f11da38dea397d0164040801cfe066088cb8093e4ddf341da0
|
7
|
+
data.tar.gz: 982217bdd61402758ab691763bad9678e1d429bc6280f271dcb07f40ab6d3bd7467c2cdff6b7f4a0b2a56339578e84c9a087ae85cedd715d7b68af84de64721d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Makes using the icanhazpdf service in a Rails app simples
|
|
5
5
|
|
6
6
|
Add this line to your application's Gemfile:
|
7
7
|
|
8
|
-
gem 'icanhazpdf', '~> 0.0.
|
8
|
+
gem 'icanhazpdf', '~> 0.0.5'
|
9
9
|
|
10
10
|
## Rails configuration
|
11
11
|
|
@@ -43,14 +43,15 @@ To render a pdf (send the file to the browser) from a url use the renderer modul
|
|
43
43
|
|
44
44
|
The method takes a url from which to render the pdf and a filename - which is sent
|
45
45
|
to the browser when it saves the file. You can omit the filename and a default
|
46
|
-
filename is used.
|
46
|
+
filename is used. You can also pass options along with the filename such as margin or landscape so a full featured request might look like
|
47
|
+
|
48
|
+
render_pdf_from my_resource_url(r), {filename: 'bob.pdf', margin: '0cm', landscape: 'true'}
|
47
49
|
|
48
50
|
To render a pdf using a previous response from the Client use:
|
49
51
|
|
50
52
|
class MyController < ApplicationController
|
51
53
|
include Icanhazpdf::Controller::Renderer
|
52
54
|
|
53
|
-
|
54
55
|
def my_action
|
55
56
|
pdf_response = Icanhazpdf::Client.new.pdf_from_url my_resource_url(resource)
|
56
57
|
|
data/lib/icanhazpdf/client.rb
CHANGED
@@ -28,8 +28,10 @@ module Icanhazpdf
|
|
28
28
|
service_url = Icanhazpdf::Client.default_service_url
|
29
29
|
end
|
30
30
|
encoded_url = "#{service_url}?url=#{URI.encode(uri.to_s).gsub(':', '%3A').gsub('/', '%2F').gsub('?', '%3F').gsub('=', '%3D').gsub('&', '%26')}"
|
31
|
-
encoded_url += "&use_wkhtmltopdf=true" if options.has_key?(:use_wkhtmltopdf)
|
31
|
+
encoded_url += "&use_wkhtmltopdf=true" if options.has_key?(:use_wkhtmltopdf) && options[:use_wkhtmltopdf] == true
|
32
32
|
encoded_url += "&margin=#{options[:margin]}" if options.has_key?(:margin)
|
33
|
+
encoded_url += "&landscape=true" if options.has_key?(:landscape) && options[:landscape] == true
|
34
|
+
|
33
35
|
HTTParty.get(encoded_url, :timeout => 10000)
|
34
36
|
end
|
35
37
|
|
@@ -10,7 +10,7 @@ module Icanhazpdf
|
|
10
10
|
|
11
11
|
# generate and render a pdf from a url
|
12
12
|
def render_pdf_from(url, options = {})
|
13
|
-
options.slice!(:filename, :use_wkhtmltopdf, :margin)
|
13
|
+
options.slice!(:filename, :use_wkhtmltopdf, :margin, :landscape)
|
14
14
|
render_response_for Icanhazpdf::Client.new.pdf_from_url(url, options), options
|
15
15
|
end
|
16
16
|
|
data/lib/icanhazpdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icanhazpdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.5.
|
4
|
+
version: 0.0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nic Pillinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|