pdfium 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +9 -0
  5. data/Guardfile +7 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +68 -0
  8. data/Rakefile +62 -0
  9. data/ext/pdfium_ext/bookmark.cc +221 -0
  10. data/ext/pdfium_ext/buffer_file_write.hpp +27 -0
  11. data/ext/pdfium_ext/document.cc +268 -0
  12. data/ext/pdfium_ext/document.h +66 -0
  13. data/ext/pdfium_ext/document_wrapper.cc +63 -0
  14. data/ext/pdfium_ext/document_wrapper.h +56 -0
  15. data/ext/pdfium_ext/extconf.h +3 -0
  16. data/ext/pdfium_ext/extconf.rb +76 -0
  17. data/ext/pdfium_ext/image.cc +332 -0
  18. data/ext/pdfium_ext/page.cc +392 -0
  19. data/ext/pdfium_ext/page.h +5 -0
  20. data/ext/pdfium_ext/page_object_wrapper.cc +38 -0
  21. data/ext/pdfium_ext/page_object_wrapper.h +27 -0
  22. data/ext/pdfium_ext/page_wrapper.cc +86 -0
  23. data/ext/pdfium_ext/page_wrapper.h +37 -0
  24. data/ext/pdfium_ext/pdfium.cc +115 -0
  25. data/ext/pdfium_ext/pdfium.h +69 -0
  26. data/lib/pdfium.rb +15 -0
  27. data/lib/pdfium/bookmark_list.rb +28 -0
  28. data/lib/pdfium/bounding_box.rb +16 -0
  29. data/lib/pdfium/image_list.rb +21 -0
  30. data/lib/pdfium/page_list.rb +36 -0
  31. data/lib/pdfium/page_sizes.rb +7 -0
  32. data/lib/pdfium/version.rb +4 -0
  33. data/pdfium.gemspec +29 -0
  34. data/test/benchmark-docsplit.rb +41 -0
  35. data/test/bookmarks_list_spec.rb +26 -0
  36. data/test/bookmarks_spec.rb +34 -0
  37. data/test/debug.rb +24 -0
  38. data/test/document_spec.rb +49 -0
  39. data/test/image_list_spec.rb +18 -0
  40. data/test/image_spec.rb +53 -0
  41. data/test/page_list_spec.rb +24 -0
  42. data/test/page_spec.rb +91 -0
  43. data/test/pdfium_spec.rb +15 -0
  44. data/test/profile.rb +29 -0
  45. data/test/spec_helper.rb +31 -0
  46. metadata +202 -0
@@ -0,0 +1,31 @@
1
+ require 'minitest/autorun'
2
+ require_relative '../lib/pdfium'
3
+ require 'pathname'
4
+ require 'fastimage'
5
+
6
+ class MiniTest::Spec
7
+
8
+ def load_document(name)
9
+ PDFium::Document.new(pdf_path(name))
10
+ end
11
+
12
+ def pdf_path(name)
13
+ Pathname.new(__FILE__).dirname.join('pdfs',name+'.pdf')
14
+ end
15
+
16
+ def after_saving(pdf)
17
+ Tempfile.open(['test','.pdf']) do |f|
18
+ pdf.save(f.path)
19
+ yield PDFium::Document.new(f.path)
20
+ end
21
+ end
22
+
23
+ def assert_size(size, file)
24
+ ext = File.extname(file).gsub(/^\./,'')
25
+ img_size = FastImage.size(file)
26
+ img_size = img_size ? img_size.join("x") : "0x0"
27
+ assert_match size, img_size, "Expected size to be #{size} but was #{img_size}"
28
+ img_type=FastImage.type(file).to_s
29
+ assert_match ext, img_type, "Expected type to be #{ext} but was #{img_type}"
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pdfium
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Stitt
8
+ - Ted Han
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-05-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.7'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.7'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '10.0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: guard-minitest
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: guard-rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: fastimage
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: image_science
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rake-compiler
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ description: Ruby bindings for Google's PDFium project. It supports extracting text
113
+ and images from PDF's as well as rendering pages to bitmaps
114
+ email:
115
+ - nathan@stitt.org
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".gitignore"
121
+ - ".ruby-version"
122
+ - Gemfile
123
+ - Guardfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - ext/pdfium_ext/bookmark.cc
128
+ - ext/pdfium_ext/buffer_file_write.hpp
129
+ - ext/pdfium_ext/document.cc
130
+ - ext/pdfium_ext/document.h
131
+ - ext/pdfium_ext/document_wrapper.cc
132
+ - ext/pdfium_ext/document_wrapper.h
133
+ - ext/pdfium_ext/extconf.h
134
+ - ext/pdfium_ext/extconf.rb
135
+ - ext/pdfium_ext/image.cc
136
+ - ext/pdfium_ext/page.cc
137
+ - ext/pdfium_ext/page.h
138
+ - ext/pdfium_ext/page_object_wrapper.cc
139
+ - ext/pdfium_ext/page_object_wrapper.h
140
+ - ext/pdfium_ext/page_wrapper.cc
141
+ - ext/pdfium_ext/page_wrapper.h
142
+ - ext/pdfium_ext/pdfium.cc
143
+ - ext/pdfium_ext/pdfium.h
144
+ - lib/pdfium.rb
145
+ - lib/pdfium/bookmark_list.rb
146
+ - lib/pdfium/bounding_box.rb
147
+ - lib/pdfium/image_list.rb
148
+ - lib/pdfium/page_list.rb
149
+ - lib/pdfium/page_sizes.rb
150
+ - lib/pdfium/version.rb
151
+ - pdfium.gemspec
152
+ - test/benchmark-docsplit.rb
153
+ - test/bookmarks_list_spec.rb
154
+ - test/bookmarks_spec.rb
155
+ - test/debug.rb
156
+ - test/document_spec.rb
157
+ - test/image_list_spec.rb
158
+ - test/image_spec.rb
159
+ - test/page_list_spec.rb
160
+ - test/page_spec.rb
161
+ - test/pdfium_spec.rb
162
+ - test/pdfs/alphatrans.pdf
163
+ - test/profile.rb
164
+ - test/spec_helper.rb
165
+ homepage: https://github.com/nathanstitt/pdfium-ruby
166
+ licenses:
167
+ - MIT
168
+ metadata: {}
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubyforge_project:
185
+ rubygems_version: 2.4.5
186
+ signing_key:
187
+ specification_version: 4
188
+ summary: Ruby bindings for Google's PDFium project
189
+ test_files:
190
+ - test/benchmark-docsplit.rb
191
+ - test/bookmarks_list_spec.rb
192
+ - test/bookmarks_spec.rb
193
+ - test/debug.rb
194
+ - test/document_spec.rb
195
+ - test/image_list_spec.rb
196
+ - test/image_spec.rb
197
+ - test/page_list_spec.rb
198
+ - test/page_spec.rb
199
+ - test/pdfium_spec.rb
200
+ - test/pdfs/alphatrans.pdf
201
+ - test/profile.rb
202
+ - test/spec_helper.rb