poppler 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/dependency-check/Rakefile +44 -0
  3. data/lib/poppler.rb +21 -107
  4. data/lib/poppler/annot-callout-line.rb +57 -0
  5. data/lib/poppler/cairo.rb +23 -0
  6. data/lib/poppler/color.rb +36 -0
  7. data/lib/poppler/deprecated.rb +67 -0
  8. data/lib/poppler/document.rb +108 -0
  9. data/lib/poppler/image-mapping.rb +25 -0
  10. data/lib/poppler/index-iter.rb +30 -0
  11. data/lib/poppler/loader.rb +139 -0
  12. data/lib/poppler/page.rb +61 -0
  13. data/lib/poppler/rectangle.rb +40 -0
  14. data/lib/poppler/version.rb +35 -0
  15. data/sample/number-pdf.rb +21 -2
  16. data/sample/pdf2.rb +0 -4
  17. data/sample/pdf2svg.rb +1 -1
  18. data/sample/pdf2text.rb +1 -1
  19. data/sample/pdfcrop.rb +1 -1
  20. data/sample/pdfdiv.rb +1 -1
  21. data/test/fixtures/image.odt +0 -0
  22. data/test/fixtures/image.pdf +0 -0
  23. data/test/fixtures/multiple-pages.odt +0 -0
  24. data/test/fixtures/multiple-pages.pdf +0 -0
  25. data/test/fixtures/text-field.odt +0 -0
  26. data/test/fixtures/text-field.pdf +0 -0
  27. data/test/poppler-test-utils.rb +24 -16
  28. data/test/run-test.rb +26 -4
  29. data/test/test-annotation.rb +76 -0
  30. data/test/{test_color.rb → test-color.rb} +0 -3
  31. data/test/test-constants.rb +16 -0
  32. data/test/{test_document.rb → test-document.rb} +26 -10
  33. data/test/test-page.rb +101 -0
  34. metadata +28 -45
  35. data/README +0 -35
  36. data/ext/poppler/depend +0 -6
  37. data/ext/poppler/extconf.rb +0 -73
  38. data/ext/poppler/poppler.def +0 -2
  39. data/ext/poppler/rbpoppler-action.c +0 -402
  40. data/ext/poppler/rbpoppler-annotation-callout-line.c +0 -127
  41. data/ext/poppler/rbpoppler-annotation-free-text.c +0 -46
  42. data/ext/poppler/rbpoppler-annotation-mapping.c +0 -72
  43. data/ext/poppler/rbpoppler-annotation-markup.c +0 -98
  44. data/ext/poppler/rbpoppler-annotation-text.c +0 -53
  45. data/ext/poppler/rbpoppler-annotation.c +0 -74
  46. data/ext/poppler/rbpoppler-attachment.c +0 -124
  47. data/ext/poppler/rbpoppler-button-field.c +0 -56
  48. data/ext/poppler/rbpoppler-choice-field.c +0 -131
  49. data/ext/poppler/rbpoppler-color.c +0 -107
  50. data/ext/poppler/rbpoppler-document.c +0 -224
  51. data/ext/poppler/rbpoppler-font-info.c +0 -59
  52. data/ext/poppler/rbpoppler-fonts-iter.c +0 -127
  53. data/ext/poppler/rbpoppler-form-field-mapping.c +0 -44
  54. data/ext/poppler/rbpoppler-form-field.c +0 -98
  55. data/ext/poppler/rbpoppler-image-mapping.c +0 -48
  56. data/ext/poppler/rbpoppler-index-iter.c +0 -130
  57. data/ext/poppler/rbpoppler-link-mapping.c +0 -47
  58. data/ext/poppler/rbpoppler-page-transition.c +0 -59
  59. data/ext/poppler/rbpoppler-page.c +0 -322
  60. data/ext/poppler/rbpoppler-private.h +0 -77
  61. data/ext/poppler/rbpoppler-ps-file.c +0 -66
  62. data/ext/poppler/rbpoppler-rectangle.c +0 -92
  63. data/ext/poppler/rbpoppler-text-field.c +0 -91
  64. data/ext/poppler/rbpoppler.c +0 -110
  65. data/ext/poppler/rbpoppler.h +0 -61
  66. data/ext/poppler/rbpopplerconversions.h +0 -105
  67. data/extconf.rb +0 -49
  68. data/test/fixtures/image.png +0 -0
  69. data/test/test_annotation.rb +0 -86
  70. data/test/test_constants.rb +0 -30
  71. data/test/test_page.rb +0 -51
data/extconf.rb DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'pathname'
4
- require 'mkmf'
5
- require 'rbconfig'
6
- require 'fileutils'
7
-
8
- package = "poppler"
9
-
10
- base_dir = Pathname(__FILE__).dirname.expand_path
11
- ext_dir = base_dir + "ext" + package
12
- mkmf_gnome2_dir = base_dir + 'lib'
13
-
14
- ruby = File.join(RbConfig::CONFIG['bindir'],
15
- RbConfig::CONFIG['ruby_install_name'] +
16
- RbConfig::CONFIG["EXEEXT"])
17
-
18
- build_dir = Pathname("ext") + package
19
- FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
20
- extconf_rb_path = ext_dir + "extconf.rb"
21
- system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
22
-
23
- create_makefile(package)
24
- FileUtils.mv("Makefile", "Makefile.lib")
25
-
26
- File.open("Makefile", "w") do |makefile|
27
- makefile.puts(<<-EOM)
28
- all:
29
- (cd ext/#{package} && $(MAKE))
30
- $(MAKE) -f Makefile.lib
31
-
32
- install:
33
- (cd ext/#{package} && $(MAKE) install)
34
- $(MAKE) -f Makefile.lib install
35
-
36
- site-install:
37
- (cd ext/#{package} && $(MAKE) site-install)
38
- $(MAKE) -f Makefile.lib site-install
39
-
40
- clean:
41
- (cd ext/#{package} && $(MAKE) clean)
42
- $(MAKE) -f Makefile.lib clean
43
-
44
- distclean:
45
- (cd ext/#{package} && $(MAKE) distclean)
46
- $(MAKE) -f Makefile.lib distclean
47
- @rm -f Makefile.lib
48
- EOM
49
- end
Binary file
@@ -1,86 +0,0 @@
1
- class TestAnnotation < Test::Unit::TestCase
2
- def test_type
3
- only_poppler_version(0, 7, 2)
4
- assert_kind_of(Poppler::AnnotationType, annotation.type)
5
- end
6
-
7
- def test_contents
8
- only_poppler_version(0, 7, 2)
9
- assert_nil(annotation.contents)
10
- end
11
-
12
- def test_name
13
- only_poppler_version(0, 7, 2)
14
- assert_nil(annotation.name)
15
- end
16
-
17
- def test_modified
18
- only_poppler_version(0, 7, 2)
19
- assert_nil(annotation.modified)
20
- end
21
-
22
- def test_flags
23
- only_poppler_version(0, 7, 2)
24
- assert_kind_of(Poppler::AnnotationFlag, annotation.flags)
25
- end
26
-
27
- def test_color
28
- only_poppler_version(0, 7, 2)
29
- assert_nil(annotation.color)
30
- end
31
-
32
- def test_markup
33
- only_poppler_version(0, 7, 2)
34
- # We don't have a PDF that has annotation markup...
35
- assert_method_defined(Poppler::AnnotationMarkup, :label)
36
- assert_method_defined(Poppler::AnnotationMarkup, :popup_is_open?)
37
- assert_method_defined(Poppler::AnnotationMarkup, :opacity)
38
- assert_method_defined(Poppler::AnnotationMarkup, :date)
39
- assert_method_defined(Poppler::AnnotationMarkup, :subject)
40
- assert_method_defined(Poppler::AnnotationMarkup, :reply_to)
41
- assert_method_defined(Poppler::AnnotationMarkup, :external_data)
42
- end
43
-
44
- def test_text
45
- only_poppler_version(0, 7, 2)
46
- # We don't have a PDF that has annotation text...
47
- assert_method_defined(Poppler::AnnotationText, :open?)
48
- assert_method_defined(Poppler::AnnotationText, :icon)
49
- assert_method_defined(Poppler::AnnotationText, :state)
50
- end
51
-
52
- def test_free_text
53
- only_poppler_version(0, 7, 2)
54
- # We don't have a PDF that has annotation free text...
55
- assert_method_defined(Poppler::AnnotationFreeText, :quadding)
56
- assert_method_defined(Poppler::AnnotationFreeText, :callout_line)
57
- end
58
-
59
- def test_callout_line
60
- only_poppler_version(0, 7, 2)
61
- callout_line = Poppler::AnnotationCalloutLine.new(true,
62
- 1.1, 2.2, 3.3,
63
- 4.4, 5.5, 6.6)
64
- assert(callout_line.multiline?)
65
- assert_equal(1.1, callout_line.x1)
66
- assert_equal(2.2, callout_line.y1)
67
- assert_equal(3.3, callout_line.x2)
68
- assert_equal(4.4, callout_line.y2)
69
- assert_equal(5.5, callout_line.x3)
70
- assert_equal(6.6, callout_line.y3)
71
- assert_equal([true, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6], callout_line.to_a)
72
- end
73
-
74
- private
75
- def annotation
76
- document = Poppler::Document.new(form_pdf)
77
- page = document[0]
78
- page.annotation_mapping[0].annotation
79
- end
80
-
81
- def assert_method_defined(object, method)
82
- assert do
83
- object.method_defined?(method)
84
- end
85
- end
86
- end
@@ -1,30 +0,0 @@
1
- class TestConstants < Test::Unit::TestCase
2
- def test_annotation
3
- if later_version?(0, 7, 2)
4
- assertion = :assert_const_defined
5
- else
6
- assertion = :assert_not_const_defined
7
- end
8
- send(assertion, Poppler, :AnnotationType)
9
- if assertion == :assert_const_defined
10
- assert_equal("3d", Poppler::AnnotationType::TYPE_3D.nick)
11
- end
12
- send(assertion, Poppler, :AnnotationFlag)
13
- send(assertion, Poppler, :AnnotationMarkupReplyType)
14
- send(assertion, Poppler, :AnnotationExternalDataType)
15
- if assertion == :assert_const_defined
16
- assert_equal("3d", Poppler::AnnotationExternalDataType::TYPE_3D.nick)
17
- end
18
- if later_version?(0, 9, 0)
19
- assert_not_const_defined(Poppler, :AnnotationTextIcon)
20
- else
21
- send(assertion, Poppler, :AnnotationTextIcon)
22
- end
23
- send(assertion, Poppler, :AnnotationTextState)
24
- send(assertion, Poppler, :AnnotationFreeTextQuadding)
25
- end
26
-
27
- def test_permissions
28
- assert_const_defined(Poppler, :Permissions)
29
- end
30
- end
@@ -1,51 +0,0 @@
1
- class TestPage < Test::Unit::TestCase
2
- def test_get_image
3
- omit("We don't have PDF that has image...")
4
- document = Poppler::Document.new(image_pdf)
5
- page, mapping = find_first_image_mapping(document)
6
- assert_kind_of(Cairo::ImageSurface, page.get_image(mapping.image_id))
7
- assert_kind_of(Cairo::ImageSurface, mapping.image)
8
- end
9
-
10
- def test_selection_region
11
- document = Poppler::Document.new(form_pdf)
12
- page = document[0]
13
- rectangle = Poppler::Rectangle.new(0, 0, *page.size)
14
- region = page.get_selection_region(0.5, :word, rectangle)
15
- if later_version?(0, 7, 2)
16
- assert_kind_of(Poppler::Rectangle, region[0])
17
- else
18
- assert_kind_of(Gdk::Region, region)
19
- end
20
- end
21
-
22
- def test_annotation_mapping
23
- only_poppler_version(0, 7, 2)
24
- document = Poppler::Document.new(form_pdf)
25
- page = document[0]
26
- assert_equal([Poppler::AnnotationMapping],
27
- page.annotation_mapping.collect {|mapping| mapping.class}.uniq)
28
- mapping = page.annotation_mapping[0]
29
- assert_kind_of(Poppler::Rectangle, mapping.area)
30
- assert_kind_of(Poppler::Annotation, mapping.annotation)
31
- end
32
-
33
- def test_text_layout
34
- only_poppler_version(0, 16, 0)
35
- document = Poppler::Document.new(form_pdf)
36
- page = document[0]
37
- layout = page.text_layout
38
- assert_equal([60, 31, 79, 60],
39
- layout[0].to_a.collect(&:round))
40
- end
41
-
42
- private
43
- def find_first_image_mapping(document)
44
- document.each do |page|
45
- page.image_mapping.each do |mapping|
46
- return [page, mapping]
47
- end
48
- end
49
- nil
50
- end
51
- end