pdf-reader-html 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Marcus Ortiz, http://marcusortiz.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # pdf-reader-html
2
+
3
+ an extension to the `pdf-reader` gem that provides a `to_html` method for the `PDF::Reader` object
4
+
5
+ ## install
6
+
7
+ gem install pdf-reader-html
8
+
9
+ ## usage
10
+
11
+ ``` ruby
12
+ require 'pdf/reader/html'
13
+
14
+ pdf = PDF::Reader.new('test.pdf')
15
+ pdf.to_html
16
+ ```
@@ -0,0 +1,26 @@
1
+ require 'pdf/reader'
2
+ require 'html_writer'
3
+
4
+ require 'pdf/reader/html/version'
5
+
6
+ module PDF
7
+ class Reader
8
+ class Page
9
+ def to_html
10
+ self.text.split("\n").map do |paragraph|
11
+ HtmlWriter.new.write_inline { |html| html.p paragraph }
12
+ end
13
+ end
14
+ end
15
+
16
+ def to_html(options={})
17
+ HtmlWriter.new.write do |html|
18
+ html.doctype options[:doctype] || 5
19
+ html.head do |head|
20
+ head.title options[:title] || ''
21
+ end
22
+ html.body self.pages.map(&:to_html).join('')
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ module PDF
2
+ class Reader
3
+ class Html
4
+ VERSION = '0.1.0'
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pdf-reader-html
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Marcus Ortiz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pdf-reader
16
+ requirement: &2220178920 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2220178920
25
+ - !ruby/object:Gem::Dependency
26
+ name: html_writer
27
+ requirement: &2220177960 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2220177960
36
+ description: convert .pdf files into html
37
+ email: mportiz08@gmail.com
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - README.md
43
+ - LICENSE.md
44
+ - lib/pdf/reader/html/version.rb
45
+ - lib/pdf/reader/html.rb
46
+ homepage: https://github.com/mportiz08/pdf-reader-html
47
+ licenses: []
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ segments:
59
+ - 0
60
+ hash: 927794954297331673
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ segments:
68
+ - 0
69
+ hash: 927794954297331673
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 1.8.11
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: convert .pdf files into html
76
+ test_files: []