poppler 3.1.9-x64-mingw32 → 3.2.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +8 -3
  3. data/lib/poppler/document.rb +55 -36
  4. data/test/test-document.rb +24 -0
  5. data/vendor/local/bin/cjpeg.exe +0 -0
  6. data/vendor/local/bin/djpeg.exe +0 -0
  7. data/vendor/local/bin/jpegtran.exe +0 -0
  8. data/vendor/local/bin/libjpeg-9.dll +0 -0
  9. data/vendor/local/bin/libopenjp2.dll +0 -0
  10. data/vendor/local/bin/libpoppler-59.dll +0 -0
  11. data/vendor/local/bin/libpoppler-cpp-0.dll +0 -0
  12. data/vendor/local/bin/libpoppler-glib-8.dll +0 -0
  13. data/vendor/local/bin/libsqlite3-0.dll +0 -0
  14. data/vendor/local/bin/opj_compress.exe +0 -0
  15. data/vendor/local/bin/opj_decompress.exe +0 -0
  16. data/vendor/local/bin/opj_dump.exe +0 -0
  17. data/vendor/local/bin/pdfdetach.exe +0 -0
  18. data/vendor/local/bin/pdffonts.exe +0 -0
  19. data/vendor/local/bin/pdfimages.exe +0 -0
  20. data/vendor/local/bin/pdfinfo.exe +0 -0
  21. data/vendor/local/bin/pdfseparate.exe +0 -0
  22. data/vendor/local/bin/pdftocairo.exe +0 -0
  23. data/vendor/local/bin/pdftohtml.exe +0 -0
  24. data/vendor/local/bin/pdftoppm.exe +0 -0
  25. data/vendor/local/bin/pdftops.exe +0 -0
  26. data/vendor/local/bin/pdftotext.exe +0 -0
  27. data/vendor/local/bin/pdfunite.exe +0 -0
  28. data/vendor/local/bin/rdjpgcom.exe +0 -0
  29. data/vendor/local/bin/sqlite3.exe +0 -0
  30. data/vendor/local/bin/wrjpgcom.exe +0 -0
  31. data/vendor/local/lib/libjpeg.dll.a +0 -0
  32. data/vendor/local/lib/libopenjp2.dll.a +0 -0
  33. data/vendor/local/lib/libpoppler-cpp.dll.a +0 -0
  34. data/vendor/local/lib/libpoppler-glib.dll.a +0 -0
  35. data/vendor/local/lib/libpoppler.dll.a +0 -0
  36. data/vendor/local/lib/libsqlite3.dll.a +0 -0
  37. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b27cee135e8542fc26755848bd13bf9f3ba0f4e6
4
- data.tar.gz: 5c61caf127fd6dd4cf0cba0fb879b7807e640b6f
3
+ metadata.gz: 48259e119a6ab1d97eac74c64efc493c8279f51a
4
+ data.tar.gz: b5f8759425e729b803ac7e4f98f7b0bbf25440f0
5
5
  SHA512:
6
- metadata.gz: 59e0f276936badfe553bfd1884b1d700d256a431612fea614d9bdc5b75f55e7dfa05d0020baeff40eac1c4422087f53608ece647763e402672a76ee81be3f7e5
7
- data.tar.gz: 7a4d3007878178507ad083a61809fe74cd7fc6d3f88ddb3dc60ac23a2903219add3d08c922214d1fbccf97d7a50a887bf46a742929de86d6d6bbf70a0ac26bb3
6
+ metadata.gz: 24701e666c2169c41093d947bbe88d989199be988b4b746c8ca16829923fbfa922771a5c4c0e0038e378d723d5f57c13a236d9b0331459617115e2ae7326ef55
7
+ data.tar.gz: 09a020bf3444d40bed1e2dc07f8a5ed9011c8c8500f871f51ea5320819572c4d78ff1a51ba179972511f37d75b7d13921fbdc91301d5a5c9b1077077a31ce58d
data/Rakefile CHANGED
@@ -22,16 +22,21 @@ require 'gnome2-raketask'
22
22
  package_task = GNOME2::Rake::PackageTask.new do |package|
23
23
  package.summary = "Ruby/Poppler is a Ruby binding of poppler-glib."
24
24
  package.description = "Ruby/Poppler is a Ruby binding of poppler-glib."
25
- package.dependency.gem.runtime = [["cairo", ">= 1.14.0"], "gdk_pixbuf2"]
25
+ package.dependency.gem.runtime = [
26
+ "cairo-gobject",
27
+ "gio2",
28
+ ]
26
29
  package.windows.packages = []
27
30
  package.windows.dependencies = []
28
31
  package.windows.build_dependencies = [
29
32
  "glib2",
30
33
  "gobject-introspection",
31
- "gdk_pixbuf2",
34
+ "gio2",
35
+ "cairo-gobject",
32
36
  ]
33
37
  package.windows.gobject_introspection_dependencies = [
34
- "gdk_pixbuf2",
38
+ "gio2",
39
+ "cairo-gobject",
35
40
  ]
36
41
  package.external_packages = [
37
42
  {
@@ -22,48 +22,63 @@ module Poppler
22
22
  def initialize(*args)
23
23
  if args.size == 1 and args[0].is_a?(Hash)
24
24
  options = args[0]
25
- data = options[:data]
26
- uri = options[:uri]
27
- path = options[:path]
28
- stream = options[:stream]
29
- length = options[:length]
30
- file = options[:file]
31
- password = options[:password]
32
-
33
- if data
34
- initialize_new_from_data(data, password)
35
- elsif uri
36
- initialize_new_from_file(uri, password)
37
- elsif path
38
- uri = ensure_uri(path)
39
- initialize_new_from_file(uri, password)
40
- elsif stream
41
- if length.nil?
42
- raise(ArgumentError,
43
- "must specify :length for :stream: #{options.inspect}")
44
- end
45
- initialize_new_from_stream(stream, length, password)
46
- elsif file
47
- if file.is_a?(String)
48
- initialize(path: file, password: password)
49
- else
50
- initialize_new_from_gfile(file, password)
51
- end
52
- else
53
- message =
54
- "must specify one of :data, :uri, :path, :stream or :file: " +
55
- options.inspect
56
- raise(ArgumentError, message)
57
- end
58
25
  else
59
26
  uri_or_data, password = args
60
27
  if pdf_data?(uri_or_data)
61
- initialize_new_from_data(uri_or_data, password)
28
+ options = {
29
+ :data => uri_or_data,
30
+ :password => password
31
+ }
62
32
  else
63
- uri = ensure_uri(uri_or_data)
64
- initialize_new_from_file(uri, password)
33
+ options = {
34
+ :uri => ensure_uri(uri_or_data),
35
+ :password => password
36
+ }
65
37
  end
66
38
  end
39
+
40
+ data = options[:data]
41
+ uri = options[:uri]
42
+ path = options[:path]
43
+ stream = options[:stream]
44
+ length = options[:length]
45
+ file = options[:file]
46
+ password = options[:password]
47
+
48
+ if data
49
+ # Workaround: poppler_document_new_from_data()'s .gir
50
+ # accepts PDF data as UTF-8 string. PDF data is not UTF-8
51
+ # string. So UTF-8 validation is failed.
52
+ #
53
+ # TODO: Enable the following:
54
+ # initialize_new_from_data(data, password)
55
+
56
+ @bytes = GLib::Bytes.new(data)
57
+ @stream = Gio::MemoryInputStream.new(@bytes)
58
+ initialize_new_from_stream(@stream, data.bytesize, password)
59
+ elsif uri
60
+ initialize_new_from_file(uri, password)
61
+ elsif path
62
+ uri = ensure_uri(path)
63
+ initialize_new_from_file(uri, password)
64
+ elsif stream
65
+ if length.nil?
66
+ raise(ArgumentError,
67
+ "must specify :length for :stream: #{options.inspect}")
68
+ end
69
+ initialize_new_from_stream(stream, length, password)
70
+ elsif file
71
+ if file.is_a?(String)
72
+ initialize(path: file, password: password)
73
+ else
74
+ initialize_new_from_gfile(file, password)
75
+ end
76
+ else
77
+ message =
78
+ "must specify one of :data, :uri, :path, :stream or :file: " +
79
+ options.inspect
80
+ raise(ArgumentError, message)
81
+ end
67
82
  end
68
83
 
69
84
  alias_method :[], :get_page
@@ -90,6 +105,10 @@ module Poppler
90
105
  IndexIter.new(self)
91
106
  end
92
107
 
108
+ alias_method :size, :n_pages
109
+
110
+ alias_method :pages, :to_a
111
+
93
112
  private
94
113
  def pdf_data?(data)
95
114
  data.start_with?("%PDF-1.")
@@ -1,4 +1,17 @@
1
1
  class TestDocument < Test::Unit::TestCase
2
+ sub_test_case("#initialize") do
3
+ def test_data
4
+ pdf = StringIO.new
5
+ surface = Cairo::PDFSurface.new(pdf, 100, 100)
6
+ context = Cairo::Context.new(surface)
7
+ context.show_text("Hello")
8
+ surface.finish
9
+
10
+ document = Poppler::Document.new(:data => pdf.string)
11
+ assert_equal("Hello", document[0].text)
12
+ end
13
+ end
14
+
2
15
  def test_save
3
16
  saved_pdf = File.join(tmp_dir, "saved.pdf")
4
17
  FileUtils.rm_f(saved_pdf)
@@ -45,6 +58,17 @@ class TestDocument < Test::Unit::TestCase
45
58
  document.collect(&:text))
46
59
  end
47
60
 
61
+ def test_size
62
+ document = Poppler::Document.new(multiple_pages_pdf)
63
+ assert_equal(2, document.size)
64
+ end
65
+
66
+ def test_pages
67
+ document = Poppler::Document.new(multiple_pages_pdf)
68
+ assert_equal(["The first page", "The second page"],
69
+ document.pages.collect(&:text))
70
+ end
71
+
48
72
  private
49
73
  def find_first_text_field(document)
50
74
  document.each do |page|
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poppler
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.9
4
+ version: 3.2.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-16 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: cairo
14
+ name: cairo-gobject
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.14.0
19
+ version: 3.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.14.0
26
+ version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: gdk_pixbuf2
28
+ name: gio2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.9
33
+ version: 3.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.9
40
+ version: 3.2.0
41
41
  description: Ruby/Poppler is a Ruby binding of poppler-glib.
42
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
43
43
  executables: []