poppler 2.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/README +35 -0
  3. data/Rakefile +75 -0
  4. data/ext/poppler/depend +6 -0
  5. data/ext/poppler/extconf.rb +70 -0
  6. data/ext/poppler/poppler.def +2 -0
  7. data/ext/poppler/rbpoppler-action.c +372 -0
  8. data/ext/poppler/rbpoppler-annotation-callout-line.c +127 -0
  9. data/ext/poppler/rbpoppler-annotation-free-text.c +46 -0
  10. data/ext/poppler/rbpoppler-annotation-mapping.c +72 -0
  11. data/ext/poppler/rbpoppler-annotation-markup.c +98 -0
  12. data/ext/poppler/rbpoppler-annotation-text.c +53 -0
  13. data/ext/poppler/rbpoppler-annotation.c +74 -0
  14. data/ext/poppler/rbpoppler-attachment.c +124 -0
  15. data/ext/poppler/rbpoppler-button-field.c +56 -0
  16. data/ext/poppler/rbpoppler-choice-field.c +131 -0
  17. data/ext/poppler/rbpoppler-color.c +107 -0
  18. data/ext/poppler/rbpoppler-document.c +224 -0
  19. data/ext/poppler/rbpoppler-font-info.c +59 -0
  20. data/ext/poppler/rbpoppler-fonts-iter.c +127 -0
  21. data/ext/poppler/rbpoppler-form-field-mapping.c +44 -0
  22. data/ext/poppler/rbpoppler-form-field.c +98 -0
  23. data/ext/poppler/rbpoppler-image-mapping.c +48 -0
  24. data/ext/poppler/rbpoppler-index-iter.c +128 -0
  25. data/ext/poppler/rbpoppler-link-mapping.c +47 -0
  26. data/ext/poppler/rbpoppler-page-transition.c +59 -0
  27. data/ext/poppler/rbpoppler-page.c +322 -0
  28. data/ext/poppler/rbpoppler-private.h +77 -0
  29. data/ext/poppler/rbpoppler-ps-file.c +66 -0
  30. data/ext/poppler/rbpoppler-rectangle.c +92 -0
  31. data/ext/poppler/rbpoppler-text-field.c +91 -0
  32. data/ext/poppler/rbpoppler.c +111 -0
  33. data/ext/poppler/rbpoppler.h +61 -0
  34. data/ext/poppler/rbpopplerconversions.h +105 -0
  35. data/extconf.rb +49 -0
  36. data/lib/2.0/poppler.so +0 -0
  37. data/lib/2.1/poppler.so +0 -0
  38. data/lib/2.2/poppler.so +0 -0
  39. data/lib/poppler.rb +105 -0
  40. data/sample/number-pdf.rb +32 -0
  41. data/sample/pdf2.rb +132 -0
  42. data/sample/pdf2svg.rb +26 -0
  43. data/sample/pdf2text.rb +16 -0
  44. data/sample/pdfcrop.rb +32 -0
  45. data/sample/pdfdiv.rb +36 -0
  46. data/test/fixtures/image.pdf +0 -0
  47. data/test/fixtures/image.png +0 -0
  48. data/test/poppler-test-utils.rb +58 -0
  49. data/test/run-test.rb +32 -0
  50. data/test/test_annotation.rb +86 -0
  51. data/test/test_color.rb +26 -0
  52. data/test/test_constants.rb +30 -0
  53. data/test/test_document.rb +41 -0
  54. data/test/test_page.rb +42 -0
  55. data/vendor/local/bin/cjpeg.exe +0 -0
  56. data/vendor/local/bin/djpeg.exe +0 -0
  57. data/vendor/local/bin/jpegtran.exe +0 -0
  58. data/vendor/local/bin/libjpeg-9.dll +0 -0
  59. data/vendor/local/bin/libpoppler-48.dll +0 -0
  60. data/vendor/local/bin/libpoppler-cpp-0.dll +0 -0
  61. data/vendor/local/bin/libpoppler-glib-8.dll +0 -0
  62. data/vendor/local/bin/libsqlite3-0.dll +0 -0
  63. data/vendor/local/bin/pdfdetach.exe +0 -0
  64. data/vendor/local/bin/pdffonts.exe +0 -0
  65. data/vendor/local/bin/pdfimages.exe +0 -0
  66. data/vendor/local/bin/pdfinfo.exe +0 -0
  67. data/vendor/local/bin/pdfseparate.exe +0 -0
  68. data/vendor/local/bin/pdftocairo.exe +0 -0
  69. data/vendor/local/bin/pdftohtml.exe +0 -0
  70. data/vendor/local/bin/pdftoppm.exe +0 -0
  71. data/vendor/local/bin/pdftops.exe +0 -0
  72. data/vendor/local/bin/pdftotext.exe +0 -0
  73. data/vendor/local/bin/pdfunite.exe +0 -0
  74. data/vendor/local/bin/rdjpgcom.exe +0 -0
  75. data/vendor/local/bin/sqlite3.exe +0 -0
  76. data/vendor/local/bin/wrjpgcom.exe +0 -0
  77. data/vendor/local/include/jconfig.h +60 -0
  78. data/vendor/local/include/jerror.h +304 -0
  79. data/vendor/local/include/jmorecfg.h +446 -0
  80. data/vendor/local/include/jpeglib.h +1180 -0
  81. data/vendor/local/include/poppler/cpp/poppler-document.h +104 -0
  82. data/vendor/local/include/poppler/cpp/poppler-embedded-file.h +55 -0
  83. data/vendor/local/include/poppler/cpp/poppler-font.h +91 -0
  84. data/vendor/local/include/poppler/cpp/poppler-global.h +111 -0
  85. data/vendor/local/include/poppler/cpp/poppler-image.h +71 -0
  86. data/vendor/local/include/poppler/cpp/poppler-page-renderer.h +66 -0
  87. data/vendor/local/include/poppler/cpp/poppler-page-transition.h +82 -0
  88. data/vendor/local/include/poppler/cpp/poppler-page.h +76 -0
  89. data/vendor/local/include/poppler/cpp/poppler-rectangle.h +84 -0
  90. data/vendor/local/include/poppler/cpp/poppler-toc.h +74 -0
  91. data/vendor/local/include/poppler/cpp/poppler-version.h +39 -0
  92. data/vendor/local/include/poppler/glib/poppler-action.h +316 -0
  93. data/vendor/local/include/poppler/glib/poppler-annot.h +296 -0
  94. data/vendor/local/include/poppler/glib/poppler-attachment.h +87 -0
  95. data/vendor/local/include/poppler/glib/poppler-date.h +30 -0
  96. data/vendor/local/include/poppler/glib/poppler-document.h +299 -0
  97. data/vendor/local/include/poppler/glib/poppler-enums.h +116 -0
  98. data/vendor/local/include/poppler/glib/poppler-features.h +88 -0
  99. data/vendor/local/include/poppler/glib/poppler-form-field.h +111 -0
  100. data/vendor/local/include/poppler/glib/poppler-layer.h +43 -0
  101. data/vendor/local/include/poppler/glib/poppler-media.h +73 -0
  102. data/vendor/local/include/poppler/glib/poppler-movie.h +42 -0
  103. data/vendor/local/include/poppler/glib/poppler-page.h +377 -0
  104. data/vendor/local/include/poppler/glib/poppler-structure-element.h +357 -0
  105. data/vendor/local/include/poppler/glib/poppler.h +250 -0
  106. data/vendor/local/include/sqlite3.h +7494 -0
  107. data/vendor/local/include/sqlite3ext.h +487 -0
  108. data/vendor/local/lib/girepository-1.0/Poppler-0.18.typelib +0 -0
  109. data/vendor/local/lib/libjpeg.a +0 -0
  110. data/vendor/local/lib/libjpeg.dll.a +0 -0
  111. data/vendor/local/lib/libjpeg.la +41 -0
  112. data/vendor/local/lib/libpoppler-cpp.a +0 -0
  113. data/vendor/local/lib/libpoppler-cpp.dll.a +0 -0
  114. data/vendor/local/lib/libpoppler-cpp.la +41 -0
  115. data/vendor/local/lib/libpoppler-glib.a +0 -0
  116. data/vendor/local/lib/libpoppler-glib.dll.a +0 -0
  117. data/vendor/local/lib/libpoppler-glib.la +41 -0
  118. data/vendor/local/lib/libpoppler.a +0 -0
  119. data/vendor/local/lib/libpoppler.dll.a +0 -0
  120. data/vendor/local/lib/libpoppler.la +41 -0
  121. data/vendor/local/lib/libsqlite3.a +0 -0
  122. data/vendor/local/lib/libsqlite3.dll.a +0 -0
  123. data/vendor/local/lib/libsqlite3.la +41 -0
  124. data/vendor/local/lib/pkgconfig/poppler-cairo.pc +9 -0
  125. data/vendor/local/lib/pkgconfig/poppler-cpp.pc +13 -0
  126. data/vendor/local/lib/pkgconfig/poppler-glib.pc +13 -0
  127. data/vendor/local/lib/pkgconfig/poppler-splash.pc +9 -0
  128. data/vendor/local/lib/pkgconfig/poppler.pc +11 -0
  129. data/vendor/local/lib/pkgconfig/sqlite3.pc +13 -0
  130. data/vendor/local/share/gir-1.0/Poppler-0.18.gir +8281 -0
  131. data/vendor/local/share/gtk-doc/html/poppler/PopplerAnnot.html +3221 -0
  132. data/vendor/local/share/gtk-doc/html/poppler/PopplerAttachment.html +267 -0
  133. data/vendor/local/share/gtk-doc/html/poppler/PopplerDocument.html +3328 -0
  134. data/vendor/local/share/gtk-doc/html/poppler/PopplerFormField.html +1403 -0
  135. data/vendor/local/share/gtk-doc/html/poppler/PopplerLayer.html +307 -0
  136. data/vendor/local/share/gtk-doc/html/poppler/PopplerMedia.html +381 -0
  137. data/vendor/local/share/gtk-doc/html/poppler/PopplerMovie.html +197 -0
  138. data/vendor/local/share/gtk-doc/html/poppler/PopplerPage.html +3002 -0
  139. data/vendor/local/share/gtk-doc/html/poppler/PopplerStructureElement.html +3781 -0
  140. data/vendor/local/share/gtk-doc/html/poppler/annotation-glossary.html +63 -0
  141. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-12.html +123 -0
  142. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-14.html +102 -0
  143. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-16.html +180 -0
  144. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-18.html +72 -0
  145. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-20.html +39 -0
  146. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-22.html +64 -0
  147. data/vendor/local/share/gtk-doc/html/poppler/api-index-deprecated.html +39 -0
  148. data/vendor/local/share/gtk-doc/html/poppler/api-index-full.html +1830 -0
  149. data/vendor/local/share/gtk-doc/html/poppler/ch01.html +74 -0
  150. data/vendor/local/share/gtk-doc/html/poppler/home.png +0 -0
  151. data/vendor/local/share/gtk-doc/html/poppler/index.html +85 -0
  152. data/vendor/local/share/gtk-doc/html/poppler/index.sgml +557 -0
  153. data/vendor/local/share/gtk-doc/html/poppler/left-insensitive.png +0 -0
  154. data/vendor/local/share/gtk-doc/html/poppler/left.png +0 -0
  155. data/vendor/local/share/gtk-doc/html/poppler/poppler-PDF-Utility-functions.html +107 -0
  156. data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerAction.html +796 -0
  157. data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerColor.html +201 -0
  158. data/vendor/local/share/gtk-doc/html/poppler/poppler-Version-and-Features-Information.html +254 -0
  159. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler.html +169 -0
  160. data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp2 +470 -0
  161. data/vendor/local/share/gtk-doc/html/poppler/right-insensitive.png +0 -0
  162. data/vendor/local/share/gtk-doc/html/poppler/right.png +0 -0
  163. data/vendor/local/share/gtk-doc/html/poppler/style.css +476 -0
  164. data/vendor/local/share/gtk-doc/html/poppler/up-insensitive.png +0 -0
  165. data/vendor/local/share/gtk-doc/html/poppler/up.png +0 -0
  166. data/vendor/local/share/license/poppler/AUTHORS +5 -0
  167. data/vendor/local/share/license/poppler/COPYING +339 -0
  168. data/vendor/local/share/man/man1/cjpeg.1 +387 -0
  169. data/vendor/local/share/man/man1/djpeg.1 +252 -0
  170. data/vendor/local/share/man/man1/jpegtran.1 +293 -0
  171. data/vendor/local/share/man/man1/pdfdetach.1 +86 -0
  172. data/vendor/local/share/man/man1/pdffonts.1 +119 -0
  173. data/vendor/local/share/man/man1/pdfimages.1 +260 -0
  174. data/vendor/local/share/man/man1/pdfinfo.1 +152 -0
  175. data/vendor/local/share/man/man1/pdfseparate.1 +49 -0
  176. data/vendor/local/share/man/man1/pdftocairo.1 +295 -0
  177. data/vendor/local/share/man/man1/pdftohtml.1 +107 -0
  178. data/vendor/local/share/man/man1/pdftoppm.1 +170 -0
  179. data/vendor/local/share/man/man1/pdftops.1 +217 -0
  180. data/vendor/local/share/man/man1/pdftotext.1 +137 -0
  181. data/vendor/local/share/man/man1/pdfunite.1 +33 -0
  182. data/vendor/local/share/man/man1/rdjpgcom.1 +63 -0
  183. data/vendor/local/share/man/man1/sqlite3.1 +279 -0
  184. data/vendor/local/share/man/man1/wrjpgcom.1 +103 -0
  185. metadata +254 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3580a50d2ededb175fd37f0732d944f76dee221e
4
+ data.tar.gz: c29e45ee2422dfb7aaf8092e6c465bc6c2259770
5
+ SHA512:
6
+ metadata.gz: 18dbb2daaad4b6b68158176f1c8a15be4ec5af66ed1cfc99716f03d3d6946d127b59eb0108d9efd5d1fbc788e272c56dfcc2934381f6ac2f9f22323bf90debee
7
+ data.tar.gz: 6bce9043c1b8ef1b29f998f6d879bacd0e306518083ea6f15d2e7d0482df8420488c92dec5c785e37479bbd7fd5eef06e561a019f0e8ae9a0cd19d6384c0cd73
data/README ADDED
@@ -0,0 +1,35 @@
1
+ Ruby/Poppler
2
+ ============
3
+
4
+ Ruby/Poppler is a Ruby binding of poppler-glib.
5
+
6
+ Requirements
7
+ ------------
8
+
9
+ Ruby: http://www.ruby-lang.org/
10
+ poppler-glib [*]: http://poppler.freedesktop.org/
11
+ Ruby/GLib2: http://ruby-gnome2.sourceforge.net/
12
+ cairo/rcairo: http://cairographics.org/ (optional)
13
+
14
+ [*]: 0.12.0 or later is requried.
15
+
16
+ Install
17
+ -------
18
+
19
+ 0. install ruby and poppler-glib.
20
+ 1. ruby extconf.rb
21
+ 2. make
22
+ 3. su
23
+ 4. make install
24
+
25
+ Copying
26
+ -------
27
+ Copyright (c) 2002-2013 Ruby-GNOME2 Project Team
28
+
29
+ This program is free software.
30
+ You can distribute/modify this program under the terms of
31
+ the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
32
+
33
+ Project Website
34
+ ---------------
35
+ http://ruby-gnome2.sourceforge.jp/
@@ -0,0 +1,75 @@
1
+ # -*- ruby -*-
2
+ #
3
+ # Copyright (C) 2010-2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ $LOAD_PATH.unshift("./../glib2/lib")
20
+ require 'gnome2-raketask'
21
+
22
+ package_task = GNOME2::Rake::PackageTask.new do |package|
23
+ package.summary = "Ruby/Poppler is a Ruby binding of poppler-glib."
24
+ package.description = "Ruby/Poppler is a Ruby binding of poppler-glib."
25
+ package.dependency.gem.runtime = [["cairo", ">= 1.14.0"], "gdk_pixbuf2"]
26
+ package.windows.packages = []
27
+ package.windows.dependencies = []
28
+ package.windows.build_dependencies = [
29
+ "glib2",
30
+ "gobject-introspection",
31
+ "gdk_pixbuf2",
32
+ ]
33
+ package.windows.gobject_introspection_dependencies = [
34
+ "gdk_pixbuf2",
35
+ ]
36
+ package.external_packages = [
37
+ {
38
+ :name => "libjpeg",
39
+ :base_name => "jpeg-9a",
40
+ :archive_base_name => "jpegsrc.v9a.tar.gz",
41
+ :download_base_url => "http://www.ijg.org/files",
42
+ :label => "libjpeg",
43
+ :windows => {
44
+ :configure_args => [],
45
+ :built_file => "bin/libjpeg-9.dll",
46
+ },
47
+ },
48
+ {
49
+ :name => "sqlite-autoconf",
50
+ :download_base_url => "http://www.sqlite.org/2014",
51
+ :label => "SQLite",
52
+ :version => "3080600",
53
+ :compression_method => "gz",
54
+ :windows => {
55
+ :configure_args => [],
56
+ :built_file => "bin/libsqlite3-0.dll",
57
+ },
58
+ },
59
+ {
60
+ :name => "poppler",
61
+ :download_base_url => "http://poppler.freedesktop.org",
62
+ :label => "Poppler",
63
+ :version => "0.29.0",
64
+ :compression_method => "xz",
65
+ :windows => {
66
+ :configure_args => [
67
+ "--enable-introspection",
68
+ ],
69
+ :built_file => "bin/libpoppler-glib-8.dll",
70
+ },
71
+ },
72
+ ]
73
+ end
74
+ package_task.define
75
+
@@ -0,0 +1,6 @@
1
+ install: install-pc
2
+ install-pc:
3
+ if test -n "$(pkgconfigdir)"; then \
4
+ $(MAKEDIRS) $(pkgconfigdir); \
5
+ $(INSTALL_DATA) ruby-poppler.pc $(pkgconfigdir); \
6
+ fi
@@ -0,0 +1,70 @@
1
+ =begin
2
+ extconf.rb for Ruby/Poppler extention library
3
+ =end
4
+
5
+ require 'pathname'
6
+
7
+ base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
8
+ top_dir = base_dir.parent
9
+ top_build_dir = Pathname(".").parent.parent.parent.expand_path
10
+
11
+ mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
12
+ version_suffix = ""
13
+ unless mkmf_gnome2_dir.exist?
14
+ if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
15
+ version_suffix = $1
16
+ mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
17
+ end
18
+ end
19
+
20
+ $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
21
+
22
+ module_name = "poppler"
23
+ package_id = "poppler-glib"
24
+
25
+ begin
26
+ require 'mkmf-gnome2'
27
+ rescue LoadError
28
+ require 'rubygems'
29
+ gem 'glib2'
30
+ require 'mkmf-gnome2'
31
+ end
32
+
33
+ ["glib2", "atk", "gdk_pixbuf2"].each do |package|
34
+ directory = "#{package}#{version_suffix}"
35
+ build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
36
+ add_depend_package(package, "#{directory}/ext/#{package}",
37
+ top_dir.to_s,
38
+ :top_build_dir => top_build_dir.to_s,
39
+ :target_build_dir => build_dir)
40
+ end
41
+
42
+ unless check_cairo(:top_dir => top_dir)
43
+ exit(false)
44
+ end
45
+
46
+ setup_windows(module_name, base_dir)
47
+
48
+ unless required_pkg_config_package([package_id, 0, 12, 0],
49
+ :debian => "libpoppler-glib-dev",
50
+ :redhat => "poppler-glib-devel",
51
+ :homebrew => "poppler",
52
+ :macports => "poppler")
53
+ exit(false)
54
+ end
55
+
56
+ unless have_macro("POPPLER_MAJOR_VERSION", ["poppler.h"])
57
+ make_version_header("POPPLER", package_id, ".")
58
+ end
59
+
60
+ create_pkg_config_file("Ruby/Poppler", package_id)
61
+ $defs << " -DRUBY_POPPLER_COMPILATION"
62
+ create_makefile(module_name)
63
+
64
+ pkg_config_dir = with_config("pkg-config-dir")
65
+ if pkg_config_dir.is_a?(String)
66
+ File.open("Makefile", "ab") do |makefile|
67
+ makefile.puts
68
+ makefile.puts("pkgconfigdir=#{pkg_config_dir}")
69
+ end
70
+ end
@@ -0,0 +1,2 @@
1
+ EXPORTS
2
+ Init_poppler
@@ -0,0 +1,372 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbpoppler-private.h"
22
+
23
+ /* PopplerAction */
24
+ static VALUE rb_cPopplerAction;
25
+ static VALUE rb_cPopplerActionDest;
26
+ static VALUE rb_cPopplerActionAny;
27
+ static VALUE rb_cPopplerActionUnknown;
28
+ static VALUE rb_cPopplerActionGotoDest;
29
+ static VALUE rb_cPopplerActionGotoRemote;
30
+ static VALUE rb_cPopplerActionLaunch;
31
+ static VALUE rb_cPopplerActionURI;
32
+ static VALUE rb_cPopplerActionNamed;
33
+ static VALUE rb_cPopplerActionMovie;
34
+ static VALUE rb_cPopplerActionRendition;
35
+ static VALUE rb_cPopplerActionOCGState;
36
+ static VALUE rb_cPopplerActionJavaScript;
37
+
38
+ #define DEFINE_ACTION_TYPE(type_lower_case, type_upper_case) \
39
+ static GType \
40
+ rb_poppler_action_ ## type_lower_case ## _get_type(void) \
41
+ { \
42
+ static GType type = 0; \
43
+ if (type == 0) { \
44
+ type = g_boxed_type_register_static("PopplerAction" # type_upper_case, \
45
+ (GBoxedCopyFunc)poppler_action_copy, \
46
+ (GBoxedFreeFunc)poppler_action_free); \
47
+ } \
48
+ return type; \
49
+ }
50
+
51
+ DEFINE_ACTION_TYPE(any, Any)
52
+ DEFINE_ACTION_TYPE(unknown, Unknown)
53
+ DEFINE_ACTION_TYPE(goto_dest, GotoDest)
54
+ DEFINE_ACTION_TYPE(goto_remote, GotoRemote)
55
+ DEFINE_ACTION_TYPE(launch, Launch)
56
+ DEFINE_ACTION_TYPE(uri, URI)
57
+ DEFINE_ACTION_TYPE(named, Named)
58
+ DEFINE_ACTION_TYPE(movie, Movie)
59
+ DEFINE_ACTION_TYPE(rendition, Rendition)
60
+ DEFINE_ACTION_TYPE(ocg_state, OCGState)
61
+ DEFINE_ACTION_TYPE(javascript, JavaScript)
62
+
63
+ #define POPPLER_ACTION_TYPE_ANY (rb_poppler_action_any_get_type())
64
+ #define POPPLER_ACTION_TYPE_UNKNOWN (rb_poppler_action_unknown_get_type())
65
+ #define POPPLER_ACTION_TYPE_GOTO_DEST (rb_poppler_action_goto_dest_get_type())
66
+ #define POPPLER_ACTION_TYPE_GOTO_REMOTE (rb_poppler_action_goto_remote_get_type())
67
+ #define POPPLER_ACTION_TYPE_LAUNCH (rb_poppler_action_launch_get_type())
68
+ #define POPPLER_ACTION_TYPE_URI (rb_poppler_action_uri_get_type())
69
+ #define POPPLER_ACTION_TYPE_NAMED (rb_poppler_action_named_get_type())
70
+ #define POPPLER_ACTION_TYPE_MOVIE (rb_poppler_action_movie_get_type())
71
+ #define POPPLER_ACTION_TYPE_RENDITION (rb_poppler_action_rendition_get_type())
72
+ #define POPPLER_ACTION_TYPE_OCG_STATE (rb_poppler_action_ocg_state_get_type())
73
+ #define POPPLER_ACTION_TYPE_JAVASCRIPT (rb_poppler_action_javascript_get_type())
74
+
75
+ static GType
76
+ rb_poppler_action_type_to_gtype(PopplerActionType action_type)
77
+ {
78
+ GType gtype = POPPLER_ACTION_TYPE_ANY;
79
+
80
+ switch (action_type) {
81
+ case POPPLER_ACTION_NONE:
82
+ break;
83
+ case POPPLER_ACTION_UNKNOWN:
84
+ gtype = POPPLER_ACTION_TYPE_UNKNOWN;
85
+ break;
86
+ case POPPLER_ACTION_GOTO_DEST:
87
+ gtype = POPPLER_ACTION_TYPE_GOTO_DEST;
88
+ break;
89
+ case POPPLER_ACTION_GOTO_REMOTE:
90
+ gtype = POPPLER_ACTION_TYPE_GOTO_REMOTE;
91
+ break;
92
+ case POPPLER_ACTION_LAUNCH:
93
+ gtype = POPPLER_ACTION_TYPE_LAUNCH;
94
+ break;
95
+ case POPPLER_ACTION_URI:
96
+ gtype = POPPLER_ACTION_TYPE_URI;
97
+ break;
98
+ case POPPLER_ACTION_NAMED:
99
+ gtype = POPPLER_ACTION_TYPE_NAMED;
100
+ break;
101
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
102
+ case POPPLER_ACTION_MOVIE:
103
+ gtype = POPPLER_ACTION_TYPE_MOVIE;
104
+ break;
105
+ case POPPLER_ACTION_RENDITION:
106
+ gtype = POPPLER_ACTION_TYPE_RENDITION;
107
+ break;
108
+ case POPPLER_ACTION_OCG_STATE:
109
+ gtype = POPPLER_ACTION_TYPE_OCG_STATE;
110
+ break;
111
+ #endif
112
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
113
+ case POPPLER_ACTION_JAVASCRIPT:
114
+ gtype = POPPLER_ACTION_TYPE_JAVASCRIPT;
115
+ break;
116
+ #endif
117
+ default:
118
+ break;
119
+ }
120
+
121
+ return gtype;
122
+ }
123
+
124
+ static GType
125
+ rb_poppler_action_to_gtype(VALUE action)
126
+ {
127
+ VALUE klass;
128
+ GType type = POPPLER_ACTION_TYPE_ANY;
129
+
130
+ klass = rb_obj_class(action);
131
+ if (klass == rb_cPopplerActionAny) {
132
+ type = POPPLER_ACTION_TYPE_ANY;
133
+ } else if (klass == rb_cPopplerActionUnknown) {
134
+ type = POPPLER_ACTION_TYPE_UNKNOWN;
135
+ } else if (klass == rb_cPopplerActionGotoDest) {
136
+ type = POPPLER_ACTION_TYPE_GOTO_DEST;
137
+ } else if (klass == rb_cPopplerActionGotoRemote) {
138
+ type = POPPLER_ACTION_TYPE_GOTO_REMOTE;
139
+ } else if (klass == rb_cPopplerActionLaunch) {
140
+ type = POPPLER_ACTION_TYPE_LAUNCH;
141
+ } else if (klass == rb_cPopplerActionURI) {
142
+ type = POPPLER_ACTION_TYPE_URI;
143
+ } else if (klass == rb_cPopplerActionNamed) {
144
+ type = POPPLER_ACTION_TYPE_NAMED;
145
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
146
+ } else if (klass == rb_cPopplerActionMovie) {
147
+ type = POPPLER_ACTION_TYPE_MOVIE;
148
+ } else if (klass == rb_cPopplerActionRendition) {
149
+ type = POPPLER_ACTION_TYPE_RENDITION;
150
+ } else if (klass == rb_cPopplerActionOCGState) {
151
+ type = POPPLER_ACTION_TYPE_OCG_STATE;
152
+ #endif
153
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
154
+ } else if (klass == rb_cPopplerActionJavaScript) {
155
+ type = POPPLER_ACTION_TYPE_JAVASCRIPT;
156
+ #endif
157
+ } else {
158
+ rb_raise(rb_eArgError, "Not action object: %s", RBG_INSPECT(action));
159
+ }
160
+
161
+ return type;
162
+ }
163
+
164
+ VALUE
165
+ rb_poppler_ruby_object_from_action(PopplerAction *action)
166
+ {
167
+ return BOXED2RVAL(action, rb_poppler_action_type_to_gtype(action->any.type));
168
+ }
169
+
170
+ PopplerAction *
171
+ rb_poppler_action_from_ruby_object(VALUE action)
172
+ {
173
+ return RVAL2BOXED(action, rb_poppler_action_to_gtype(action));
174
+ }
175
+
176
+ #define ACTION_ATTR_STR(type, name) \
177
+ static VALUE \
178
+ action_ ## type ## _ ## name (VALUE self) \
179
+ { \
180
+ return CSTR2RVAL(RVAL2POPPLERACTION(self)->type.name); \
181
+ }
182
+
183
+ #define ACTION_ATTR_DEST(type, name) \
184
+ static VALUE \
185
+ action_ ## type ## _ ## name (VALUE self) \
186
+ { \
187
+ return POPPLERDEST2RVAL(RVAL2POPPLERACTION(self)->type.name); \
188
+ }
189
+
190
+ #define DEFINE_ACCESSOR(prefix, target, name) \
191
+ rbg_define_method(target, G_STRINGIFY(name), prefix ## _ ## name, 0);
192
+
193
+ #define DEFINE_ACTION_ACCESSOR(target, type, name) \
194
+ DEFINE_ACCESSOR(action_ ## type, target, name)
195
+
196
+ /* PopplerActionAny */
197
+ static VALUE
198
+ action_any_type(VALUE self)
199
+ {
200
+ return POPPLERACTIONTYPE2RVAL(RVAL2POPPLERACTION(self)->type);
201
+ }
202
+ ACTION_ATTR_STR(any, title);
203
+
204
+ /* PopplerActionGotoDest */
205
+ ACTION_ATTR_DEST(goto_dest, dest);
206
+
207
+ /* PopplerActionGotoRemote */
208
+ ACTION_ATTR_STR(goto_remote, file_name);
209
+ ACTION_ATTR_DEST(goto_remote, dest);
210
+
211
+ /* PopplerActionLaunch */
212
+ ACTION_ATTR_STR(launch, file_name);
213
+ ACTION_ATTR_STR(launch, params);
214
+
215
+ /* PopplerActionURI */
216
+ ACTION_ATTR_STR(uri, uri);
217
+
218
+ /* PopplerActionNamed */
219
+ ACTION_ATTR_STR(named, named_dest);
220
+
221
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
222
+ /* PopplerActionMovie */
223
+ ACTION_ATTR_DEST(movie, movie);
224
+
225
+ /* PopplerActionRendition */
226
+ ACTION_ATTR_DEST(rendition, media);
227
+
228
+ /* PopplerActionOCGState */
229
+ ACTION_ATTR_DEST(ocg_state, state_list);
230
+ #endif
231
+
232
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
233
+ /* PopplerActionJavascript */
234
+ ACTION_ATTR_STR(javascript, script);
235
+ #endif
236
+
237
+ /* PopplerDest */
238
+ #ifdef RB_POPPLER_TYPE_DEST_NOT_DEFINED
239
+ GType
240
+ poppler_dest_get_type (void)
241
+ {
242
+ static GType our_type = 0;
243
+
244
+ if (our_type == 0)
245
+ our_type = g_boxed_type_register_static("PopplerDest",
246
+ (GBoxedCopyFunc)poppler_dest_copy,
247
+ (GBoxedFreeFunc)poppler_dest_free);
248
+
249
+ return our_type;
250
+ }
251
+ #endif
252
+
253
+ static VALUE
254
+ dest_get_type(VALUE self)
255
+ {
256
+ return POPPLERDESTTYPE2RVAL(RVAL2POPPLERDEST(self)->type);
257
+ }
258
+
259
+ #define DEST_ATTR_INT(name) \
260
+ static VALUE \
261
+ dest_ ## name (VALUE self) \
262
+ { \
263
+ return INT2NUM(RVAL2POPPLERDEST(self)->name); \
264
+ }
265
+
266
+ #define DEST_ATTR_UINT(name) \
267
+ static VALUE \
268
+ dest_ ## name (VALUE self) \
269
+ { \
270
+ return UINT2NUM(RVAL2POPPLERDEST(self)->name); \
271
+ }
272
+
273
+ #define DEST_ATTR_DOUBLE(name) \
274
+ static VALUE \
275
+ dest_ ## name (VALUE self) \
276
+ { \
277
+ return rb_float_new(RVAL2POPPLERDEST(self)->name); \
278
+ }
279
+
280
+ #define DEST_ATTR_STR(name) \
281
+ static VALUE \
282
+ dest_ ## name (VALUE self) \
283
+ { \
284
+ return CSTR2RVAL(RVAL2POPPLERDEST(self)->name); \
285
+ }
286
+
287
+ #define DEFINE_DEST_ACCESSOR(target, name) \
288
+ DEFINE_ACCESSOR(dest, target, name)
289
+
290
+
291
+ DEST_ATTR_INT(page_num)
292
+ DEST_ATTR_DOUBLE(left)
293
+ DEST_ATTR_DOUBLE(bottom)
294
+ DEST_ATTR_DOUBLE(right)
295
+ DEST_ATTR_DOUBLE(top)
296
+ DEST_ATTR_DOUBLE(zoom)
297
+ DEST_ATTR_STR(named_dest)
298
+ DEST_ATTR_UINT(change_left)
299
+ DEST_ATTR_UINT(change_top)
300
+ DEST_ATTR_UINT(change_zoom)
301
+
302
+ void
303
+ Init_poppler_action(VALUE mPoppler)
304
+ {
305
+ rb_cPopplerAction = G_DEF_CLASS(POPPLER_TYPE_ACTION, "Action", mPoppler);
306
+
307
+ rb_cPopplerActionAny = rb_define_class_under(mPoppler, "ActionAny", rb_cPopplerAction);
308
+ rbg_define_method(rb_cPopplerActionAny, "type", action_any_type, 0);
309
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionAny, any, title);
310
+
311
+ rb_cPopplerActionUnknown = rb_define_class_under(mPoppler, "ActionUnknown",
312
+ rb_cPopplerAction);
313
+
314
+ rb_cPopplerActionGotoDest = rb_define_class_under(mPoppler, "ActionGotoDest",
315
+ rb_cPopplerActionAny);
316
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoDest, goto_dest, dest);
317
+
318
+ rb_cPopplerActionGotoRemote = rb_define_class_under(mPoppler, "ActionGotoRemote",
319
+ rb_cPopplerActionAny);
320
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoRemote, goto_remote, file_name);
321
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoRemote, goto_remote, dest);
322
+
323
+ rb_cPopplerActionLaunch = rb_define_class_under(mPoppler, "ActionLaunch",
324
+ rb_cPopplerActionAny);
325
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionLaunch, launch, file_name);
326
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionLaunch, launch, params);
327
+
328
+ rb_cPopplerActionURI = rb_define_class_under(mPoppler, "ActionURI", rb_cPopplerActionAny);
329
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionURI, uri, uri);
330
+
331
+ rb_cPopplerActionNamed = rb_define_class_under(mPoppler, "ActionNamed",
332
+ rb_cPopplerActionAny);
333
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionNamed, named, named_dest);
334
+
335
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
336
+ rb_cPopplerActionMovie = rb_define_class_under(mPoppler, "ActionMovie",
337
+ rb_cPopplerActionAny);
338
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionMovie, movie, movie);
339
+
340
+ rb_cPopplerActionRendition = rb_define_class_under(mPoppler, "ActionRendtion",
341
+ rb_cPopplerActionAny);
342
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionRendition, rendition, media);
343
+
344
+ rb_cPopplerActionOCGState = rb_define_class_under(mPoppler, "ActionOCGState",
345
+ rb_cPopplerActionAny);
346
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionOCGState, ocg_state, state_list);
347
+ #endif
348
+
349
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
350
+ rb_cPopplerActionJavaScript =
351
+ rb_define_class_under(mPoppler, "ActionJavaScript",
352
+ rb_cPopplerActionAny);
353
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionJavaScript, javascript, script);
354
+ #endif
355
+
356
+ G_DEF_CLASS(POPPLER_TYPE_ACTION_TYPE, "ActionType", mPoppler);
357
+ G_DEF_CLASS(POPPLER_TYPE_DEST_TYPE, "DestType", mPoppler);
358
+
359
+ rb_cPopplerActionDest = G_DEF_CLASS(POPPLER_TYPE_DEST, "Dest", mPoppler);
360
+
361
+ rbg_define_method(rb_cPopplerActionDest, "type", dest_get_type, 0);
362
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, page_num);
363
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, left);
364
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, bottom);
365
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, right);
366
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, top);
367
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, zoom);
368
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, named_dest);
369
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_left);
370
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_top);
371
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_zoom);
372
+ }