drnic-princely 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.md +49 -0
- data/VERSION +1 -1
- data/init.rb +1 -6
- data/lib/{prince.rb → princely.rb} +5 -4
- data/lib/{pdf_helper.rb → princely/pdf_helper.rb} +0 -0
- data/lib/princely/rails.rb +6 -0
- data/princely.gemspec +45 -0
- metadata +8 -5
- data/README +0 -50
data/.gitignore
ADDED
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
Princely
|
2
|
+
========
|
3
|
+
|
4
|
+
Princely is a simple wrapper for the Prince XML PDF generation library
|
5
|
+
(http://www.princexml.com). It is almost entirely based on the SubImage
|
6
|
+
Prince library found on this blog post:
|
7
|
+
|
8
|
+
http://sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-ruby-on-rails
|
9
|
+
|
10
|
+
I have taken the helpers and made them a little bit more generalized and
|
11
|
+
reusable, and created a render option set for pdf generation. The plugin
|
12
|
+
will also automatically register the PDF MimeType so that you can use
|
13
|
+
pdf in controller respond_to blocks.
|
14
|
+
|
15
|
+
Example
|
16
|
+
=======
|
17
|
+
|
18
|
+
class Provider::EstimatesController < Provider::BaseController
|
19
|
+
def show
|
20
|
+
respond_to do |format|
|
21
|
+
format.html
|
22
|
+
format.pdf do
|
23
|
+
render :pdf => "file_name",
|
24
|
+
:template => "controller/action.pdf.erb",
|
25
|
+
:stylesheets => ["application","prince"]
|
26
|
+
:layout => "pdf"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def pdf
|
32
|
+
make_and_send_pdf("file_name")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Render Defaults
|
37
|
+
===============
|
38
|
+
|
39
|
+
The defaults for the render options are as follows:
|
40
|
+
|
41
|
+
layout: false
|
42
|
+
template: the template for the current controller/action
|
43
|
+
stylesheets: none
|
44
|
+
|
45
|
+
Resources
|
46
|
+
=========
|
47
|
+
|
48
|
+
* Copyright (c) 2007 Michael Bleigh and Intridea, Inc., released under the MIT license
|
49
|
+
* Copyright (c) 2007 Seth from Subimage from http://sublog.subimage.com/2007/05/29/html-css-to-pdf-using-ruby-on-rails
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/init.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# PrinceXML Ruby interface.
|
2
2
|
# http://www.princexml.com
|
3
3
|
#
|
4
4
|
# Library by Subimage Interactive - http://www.subimage.com
|
@@ -6,17 +6,18 @@
|
|
6
6
|
#
|
7
7
|
# USAGE
|
8
8
|
# -----------------------------------------------------------------------------
|
9
|
-
#
|
9
|
+
# princely = Princely.new()
|
10
10
|
# html_string = render_to_string(:template => 'some_document')
|
11
11
|
# send_data(
|
12
|
-
#
|
12
|
+
# princely.pdf_from_string(html_string),
|
13
13
|
# :filename => 'some_document.pdf'
|
14
14
|
# :type => 'application/pdf'
|
15
15
|
# )
|
16
16
|
#
|
17
|
+
$:.unshift(File.dirname(__FILE__))
|
17
18
|
require 'logger'
|
18
19
|
|
19
|
-
class
|
20
|
+
class Princely
|
20
21
|
VERSION = "1.0.0"
|
21
22
|
|
22
23
|
attr_accessor :exe_path, :style_sheets, :log_file, :logger
|
File without changes
|
data/princely.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{princely}
|
8
|
+
s.version = "1.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Michael Bleigh", "Seth from Subimage Interactive"]
|
12
|
+
s.date = %q{2009-08-21}
|
13
|
+
s.description = %q{A wrapper for the PrinceXML PDF generation library based on article by Seth from Subimage Interactive at http://sublog.subimage.com/2007/05/29/html-css-to-pdf-using-ruby-on-rails}
|
14
|
+
s.email = %q{michael@intridea.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"MIT-LICENSE",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"init.rb",
|
25
|
+
"lib/princely.rb",
|
26
|
+
"lib/princely/pdf_helper.rb",
|
27
|
+
"lib/princely/rails.rb",
|
28
|
+
"princely.gemspec"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/drnic/princely}
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.5}
|
34
|
+
s.summary = %q{A simple Rails wrapper for the PrinceXML PDF generation library.}
|
35
|
+
|
36
|
+
if s.respond_to? :specification_version then
|
37
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
41
|
+
else
|
42
|
+
end
|
43
|
+
else
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drnic-princely
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -21,15 +21,18 @@ executables: []
|
|
21
21
|
extensions: []
|
22
22
|
|
23
23
|
extra_rdoc_files:
|
24
|
-
- README
|
24
|
+
- README.md
|
25
25
|
files:
|
26
|
+
- .gitignore
|
26
27
|
- MIT-LICENSE
|
27
|
-
- README
|
28
|
+
- README.md
|
28
29
|
- Rakefile
|
29
30
|
- VERSION
|
30
31
|
- init.rb
|
31
|
-
- lib/
|
32
|
-
- lib/
|
32
|
+
- lib/princely.rb
|
33
|
+
- lib/princely/pdf_helper.rb
|
34
|
+
- lib/princely/rails.rb
|
35
|
+
- princely.gemspec
|
33
36
|
has_rdoc: false
|
34
37
|
homepage: http://github.com/drnic/princely
|
35
38
|
licenses:
|
data/README
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
Princely
|
2
|
-
========
|
3
|
-
|
4
|
-
Princely is a simple wrapper for the Prince XML PDF generation library
|
5
|
-
(http://www.princexml.com). It is almost entirely based on the SubImage
|
6
|
-
Prince library found on this blog post:
|
7
|
-
|
8
|
-
http://sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-ruby-on-rails
|
9
|
-
|
10
|
-
I have taken the helpers and made them a little bit more generalized and
|
11
|
-
reusable, and created a render option set for pdf generation. The plugin
|
12
|
-
will also automatically register the PDF MimeType so that you can use
|
13
|
-
pdf in controller respond_to blocks.
|
14
|
-
|
15
|
-
Example
|
16
|
-
=======
|
17
|
-
|
18
|
-
class Provider::EstimatesController < Provider::BaseController
|
19
|
-
def show
|
20
|
-
respond_to do |format|
|
21
|
-
format.html
|
22
|
-
format.pdf do
|
23
|
-
render :pdf => "file_name",
|
24
|
-
:template => "controller/action.pdf.erb",
|
25
|
-
:stylesheets => ["application","prince"]
|
26
|
-
:layout => "pdf"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def pdf
|
32
|
-
make_and_send_pdf("file_name")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
Render Defaults
|
37
|
-
===============
|
38
|
-
|
39
|
-
The defaults for the render options are as follows:
|
40
|
-
|
41
|
-
layout: false
|
42
|
-
template: the template for the current controller/action
|
43
|
-
stylesheets: none
|
44
|
-
|
45
|
-
Resources
|
46
|
-
=========
|
47
|
-
|
48
|
-
Trac: http://trac.intridea.com/trac/public/
|
49
|
-
|
50
|
-
Copyright (c) 2007 Michael Bleigh and Intridea, Inc., released under the MIT license
|