to_pdf 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -8
- data/lib/to_pdf/railtie.rb +5 -5
- data/lib/to_pdf/version.rb +1 -1
- metadata +5 -5
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
= ToPDF
|
2
2
|
|
3
|
-
|
3
|
+
Render rails actions as a PDF using {PrinceXML}[http://princexml.com/].
|
4
4
|
|
5
5
|
== Installation
|
6
6
|
|
7
|
-
In your Gemfile:
|
7
|
+
In your Gemfile (Rails >= 3.0):
|
8
8
|
|
9
9
|
gem 'to_pdf'
|
10
10
|
|
@@ -25,13 +25,13 @@ Then in your controller it’s just like responding to HTML or JSON etc.:
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
Don’t worry about a regular HTML document structure. Treat it more like XML (example in {HAML}[http://haml-lang.com/]):
|
29
29
|
|
30
30
|
.job
|
31
31
|
.name
|
32
32
|
= job.name
|
33
33
|
|
34
|
-
You can though define CSS at the top of the document:
|
34
|
+
You can though define CSS at the top of the document (note that "body" rules will apply even though we have not defined that element explicitly in our markup):
|
35
35
|
|
36
36
|
%style
|
37
37
|
:sass
|
@@ -40,16 +40,18 @@ You can though define CSS at the top of the document:
|
|
40
40
|
body
|
41
41
|
color: #000
|
42
42
|
font-family: "DejaVu Sans"
|
43
|
+
p
|
44
|
+
margin: 0 0 1cm 0
|
43
45
|
|
44
|
-
Or
|
46
|
+
Or link a stylesheet:
|
45
47
|
|
46
48
|
= stylesheet_link_tag 'pdf', media: 'print'
|
47
49
|
|
48
50
|
.job
|
49
|
-
|
50
|
-
|
51
|
+
.name
|
52
|
+
= job.name
|
51
53
|
|
52
|
-
This will work with the Rails 3.1 asset pipeline in production
|
54
|
+
This will even work with the Rails 3.1 asset pipeline in production although in development you will need to add this line of configuration to your development.rb:
|
53
55
|
|
54
56
|
MyProject::Application.configure do
|
55
57
|
...
|
data/lib/to_pdf/railtie.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module ToPDF
|
2
2
|
class Railtie < Rails::Railtie
|
3
|
-
initializer 'to_pdf.configure_prince_xml' do
|
4
|
-
if
|
5
|
-
PrinceXML.asset_domain =
|
3
|
+
initializer 'to_pdf.configure_prince_xml' do |app|
|
4
|
+
if app.config.respond_to? :prince_xml_asset_domain
|
5
|
+
PrinceXML.asset_domain = app.config.prince_xml_asset_domain
|
6
6
|
end
|
7
7
|
|
8
|
-
if
|
9
|
-
PrinceXML.executable_path =
|
8
|
+
if app.config.respond_to? :prince_xml_executable_path
|
9
|
+
PrinceXML.executable_path = app.config.prince_xml_executable_path
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
data/lib/to_pdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-24 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70310188469080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70310188469080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70310188468480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70310188468480
|
36
36
|
description: Render rails actions as a PDF using PrinceXML.
|
37
37
|
email: hugh@artpop.com.au
|
38
38
|
executables: []
|