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,59 @@
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
+ #define RG_TARGET_NAMESPACE cFontInfo
24
+
25
+ static VALUE RG_TARGET_NAMESPACE;
26
+
27
+ static ID id_valid;
28
+
29
+ static VALUE
30
+ rg_initialize(VALUE self, VALUE document)
31
+ {
32
+ G_INITIALIZE(self, poppler_font_info_new(RVAL2POPPLERDOCUMENT(document)));
33
+ return Qnil;
34
+ }
35
+
36
+ static VALUE
37
+ rg_scan(VALUE self, VALUE n_pages)
38
+ {
39
+ VALUE rb_iter = Qnil;
40
+ PopplerFontsIter *iter;
41
+
42
+ if (poppler_font_info_scan(RVAL2FONTINFO(self), NUM2INT(n_pages), &iter)) {
43
+ rb_iter = POPPLERFONTSITER2RVAL(iter);
44
+ rb_ivar_set(rb_iter, id_valid, Qtrue);
45
+ poppler_fonts_iter_free(iter);
46
+ }
47
+ return rb_iter;
48
+ }
49
+
50
+ void
51
+ Init_poppler_font_info(VALUE mPoppler)
52
+ {
53
+ id_valid = rb_intern("valid?");
54
+
55
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONT_INFO, "FontInfo", mPoppler);
56
+
57
+ RG_DEF_METHOD(initialize, 1);
58
+ RG_DEF_METHOD(scan, 1);
59
+ }
@@ -0,0 +1,127 @@
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
+ #define RG_TARGET_NAMESPACE cFontsIter
24
+
25
+ #define CHECK_FITER_IS_VALID(iter) do { \
26
+ if (!RVAL2CBOOL(rg_valid_p(iter))) \
27
+ return Qnil; \
28
+ } while (0)
29
+
30
+ static ID id_valid;
31
+
32
+ static VALUE
33
+ rg_valid_p(VALUE self)
34
+ {
35
+ return rb_ivar_get(self, id_valid);
36
+ }
37
+
38
+ static VALUE
39
+ rg_name(VALUE self)
40
+ {
41
+ CHECK_FITER_IS_VALID(self);
42
+ return CSTR2RVAL(poppler_fonts_iter_get_name(RVAL2POPPLERFONTSITER(self)));
43
+ }
44
+
45
+ static VALUE
46
+ rg_full_name(VALUE self)
47
+ {
48
+ CHECK_FITER_IS_VALID(self);
49
+ return CSTR2RVAL(poppler_fonts_iter_get_full_name(RVAL2POPPLERFONTSITER(self)));
50
+ }
51
+
52
+ static VALUE
53
+ rg_file_name(VALUE self)
54
+ {
55
+ CHECK_FITER_IS_VALID(self);
56
+ return CSTR2RVAL(poppler_fonts_iter_get_file_name(RVAL2POPPLERFONTSITER(self)));
57
+ }
58
+
59
+ static VALUE
60
+ rg_font_type(VALUE self)
61
+ {
62
+ CHECK_FITER_IS_VALID(self);
63
+ return POPPLERFONTTYPE2RVAL(poppler_fonts_iter_get_font_type(RVAL2POPPLERFONTSITER(self)));
64
+ }
65
+
66
+ static VALUE
67
+ rg_embedded_p(VALUE self)
68
+ {
69
+ CHECK_FITER_IS_VALID(self);
70
+ return CBOOL2RVAL(poppler_fonts_iter_is_embedded(RVAL2POPPLERFONTSITER(self)));
71
+ }
72
+
73
+ static VALUE
74
+ rg_subset_p(VALUE self)
75
+ {
76
+ CHECK_FITER_IS_VALID(self);
77
+ return CBOOL2RVAL(poppler_fonts_iter_is_subset(RVAL2POPPLERFONTSITER(self)));
78
+ }
79
+
80
+ static VALUE
81
+ rg_next(VALUE self)
82
+ {
83
+ if (poppler_fonts_iter_next(RVAL2POPPLERFONTSITER(self))) {
84
+ return Qtrue;
85
+ } else {
86
+ rb_ivar_set(self, id_valid, Qfalse);
87
+ return Qfalse;
88
+ }
89
+ }
90
+
91
+ static VALUE
92
+ rg_each(VALUE self)
93
+ {
94
+ PopplerFontsIter *iter;
95
+
96
+ CHECK_FITER_IS_VALID(self);
97
+ iter = RVAL2POPPLERFONTSITER(self);
98
+ do {
99
+ rb_yield(self);
100
+ } while (poppler_fonts_iter_next(iter));
101
+ rb_ivar_set(self, id_valid, Qfalse);
102
+
103
+ return self;
104
+ }
105
+
106
+ void
107
+ Init_poppler_fonts_iter(VALUE mPoppler)
108
+ {
109
+ VALUE RG_TARGET_NAMESPACE;
110
+
111
+ id_valid = rb_intern("valid?");
112
+
113
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONTS_ITER, "FontsIter", mPoppler);
114
+
115
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
116
+
117
+ RG_DEF_METHOD(name, 0);
118
+ RG_DEF_METHOD(full_name, 0);
119
+ RG_DEF_METHOD(file_name, 0);
120
+ RG_DEF_METHOD(font_type, 0);
121
+ RG_DEF_METHOD_P(embedded, 0);
122
+ RG_DEF_METHOD_P(subset, 0);
123
+ RG_DEF_METHOD(next, 0);
124
+
125
+ RG_DEF_METHOD_P(valid, 0);
126
+ RG_DEF_METHOD(each, 0);
127
+ }
@@ -0,0 +1,44 @@
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
+ #define RG_TARGET_NAMESPACE cFormFieldMapping
24
+
25
+ DEF_ACCESSOR_WITH_SETTER(form_field_mapping, area,
26
+ RVAL2POPPLERFORMFIELDMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
27
+ DEF_ACCESSOR(form_field_mapping, field, RVAL2POPPLERFORMFIELDMAPPING,
28
+ POPPLERFORMFIELD2RVAL, RVAL2POPPLERFORMFIELD)
29
+
30
+ void
31
+ Init_poppler_form_field_mapping(VALUE mPoppler)
32
+ {
33
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD_MAPPING,
34
+ "FormFieldMapping", mPoppler);
35
+
36
+ rbg_define_method(RG_TARGET_NAMESPACE, "area", form_field_mapping_get_area, 0);
37
+ rbg_define_method(RG_TARGET_NAMESPACE, "field", form_field_mapping_get_field,
38
+ 0);
39
+
40
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_area",
41
+ form_field_mapping_set_area, 1);
42
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_field",
43
+ form_field_mapping_set_field, 1);
44
+ }
@@ -0,0 +1,98 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cFormField
25
+ #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj)
26
+
27
+ static VALUE cButtonField, cTextField, cChoiceField;
28
+ static VALUE cUnknownField, cSignatureField;
29
+
30
+ VALUE
31
+ rb_poppler_ruby_object_from_form_field(PopplerFormField *field)
32
+ {
33
+ VALUE obj;
34
+
35
+ obj = rbgobj_ruby_object_from_instance2(field, FALSE);
36
+ if (NIL_P(obj)) {
37
+ switch (poppler_form_field_get_field_type(field)) {
38
+ case POPPLER_FORM_FIELD_UNKNOWN:
39
+ obj = rbgobj_create_object(cUnknownField);
40
+ break;
41
+ case POPPLER_FORM_FIELD_BUTTON:
42
+ obj = rbgobj_create_object(cButtonField);
43
+ break;
44
+ case POPPLER_FORM_FIELD_TEXT:
45
+ obj = rbgobj_create_object(cTextField);
46
+ break;
47
+ case POPPLER_FORM_FIELD_CHOICE:
48
+ obj = rbgobj_create_object(cChoiceField);
49
+ break;
50
+ case POPPLER_FORM_FIELD_SIGNATURE:
51
+ obj = rbgobj_create_object(cSignatureField);
52
+ break;
53
+ }
54
+ g_object_ref(field);
55
+ G_INITIALIZE(obj, (gpointer)field);
56
+ }
57
+
58
+ return obj;
59
+ }
60
+
61
+ static VALUE
62
+ rg_id(VALUE self)
63
+ {
64
+ return INT2NUM(poppler_form_field_get_id(_SELF(self)));
65
+ }
66
+
67
+ static VALUE
68
+ rg_font_size(VALUE self)
69
+ {
70
+ return rb_float_new(poppler_form_field_get_font_size(_SELF(self)));
71
+ }
72
+
73
+ static VALUE
74
+ rg_read_only_p(VALUE self)
75
+ {
76
+ return CBOOL2RVAL(poppler_form_field_is_read_only(_SELF(self)));
77
+ }
78
+
79
+ void
80
+ Init_poppler_form_field(VALUE mPoppler)
81
+ {
82
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD, "FormField", mPoppler);
83
+ cUnknownField = rb_define_class_under(mPoppler, "UnknownField", RG_TARGET_NAMESPACE);
84
+ cSignatureField = rb_define_class_under(mPoppler, "SignatureField",
85
+ RG_TARGET_NAMESPACE);
86
+
87
+ RG_DEF_METHOD(id, 0);
88
+ RG_DEF_METHOD(font_size, 0);
89
+ RG_DEF_METHOD_P(read_only, 0);
90
+
91
+ Init_poppler_button_field(mPoppler, RG_TARGET_NAMESPACE);
92
+ Init_poppler_text_field(mPoppler, RG_TARGET_NAMESPACE);
93
+ Init_poppler_choice_field(mPoppler, RG_TARGET_NAMESPACE);
94
+
95
+ cButtonField = rb_const_get(mPoppler, rb_intern("ButtonField"));
96
+ cTextField = rb_const_get(mPoppler, rb_intern("TextField"));
97
+ cChoiceField = rb_const_get(mPoppler, rb_intern("ChoiceField"));
98
+ }
@@ -0,0 +1,48 @@
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
+ #define RG_TARGET_NAMESPACE cImageMapping
24
+
25
+ DEF_ACCESSOR_WITH_SETTER(image_mapping, area,
26
+ RVAL2POPPLERIMAGEMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
27
+ DEF_ACCESSOR(image_mapping, image_id, RVAL2POPPLERIMAGEMAPPING, INT2NUM, NUM2INT)
28
+ static VALUE
29
+ rg_image(VALUE self)
30
+ {
31
+ return rb_funcall(rb_iv_get(self, "@page"), rb_intern("get_image"),
32
+ 1, INT2NUM(RVAL2POPPLERIMAGEMAPPING(self)->image_id));
33
+ }
34
+
35
+ void
36
+ Init_poppler_image_mapping(VALUE mPoppler)
37
+ {
38
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_IMAGE_MAPPING,
39
+ "ImageMapping", mPoppler);
40
+
41
+ rbg_define_method(RG_TARGET_NAMESPACE, "area", image_mapping_get_area, 0);
42
+ rbg_define_method(RG_TARGET_NAMESPACE, "image_id", image_mapping_get_image_id, 0);
43
+ RG_DEF_METHOD(image, 0);
44
+
45
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_area", image_mapping_set_area, 1);
46
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_image_id",
47
+ image_mapping_set_image_id, 1);
48
+ }
@@ -0,0 +1,128 @@
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
+ #define RG_TARGET_NAMESPACE cIndexIter
24
+
25
+ static VALUE RG_TARGET_NAMESPACE;
26
+
27
+ static ID id_valid;
28
+
29
+ /* Interface for getting the Index of a poppler_document */
30
+ #define CHECK_IITER_IS_VALID(iter) do { \
31
+ if (!RVAL2CBOOL(rg_valid_p(iter))) \
32
+ return Qnil; \
33
+ } while (0)
34
+
35
+ static VALUE
36
+ rg_valid_p(VALUE self)
37
+ {
38
+ return rb_ivar_get(self, id_valid);
39
+ }
40
+
41
+ static VALUE
42
+ rg_initialize(VALUE self, VALUE document)
43
+ {
44
+ PopplerIndexIter *iter;
45
+ iter = poppler_index_iter_new(RVAL2POPPLERDOCUMENT(document));
46
+ G_INITIALIZE(self, iter);
47
+ poppler_index_iter_free(iter);
48
+ rb_ivar_set(self, id_valid, CBOOL2RVAL(iter));
49
+ return Qnil;
50
+ }
51
+
52
+ static VALUE
53
+ rg_child(VALUE self)
54
+ {
55
+ PopplerIndexIter *child;
56
+ VALUE rb_child;
57
+
58
+ CHECK_IITER_IS_VALID(self);
59
+ child = poppler_index_iter_get_child(RVAL2POPPLERINDEXITER(self));
60
+ rb_child = POPPLERINDEXITER2RVAL(child);
61
+ rb_ivar_set(rb_child, id_valid, CBOOL2RVAL(child));
62
+ poppler_index_iter_free(child);
63
+ return rb_child;
64
+ }
65
+
66
+ static VALUE
67
+ rg_open_p(VALUE self)
68
+ {
69
+ CHECK_IITER_IS_VALID(self);
70
+ return CBOOL2RVAL(poppler_index_iter_is_open(RVAL2POPPLERINDEXITER(self)));
71
+ }
72
+
73
+ #ifndef HAVE_TYPE_POPPLERACTIONANY
74
+ static VALUE
75
+ rg_action(VALUE self)
76
+ {
77
+ CHECK_IITER_IS_VALID(self);
78
+ return POPPLERACTION2RVAL(poppler_index_iter_get_action(RVAL2POPPLERINDEXITER(self)));
79
+ }
80
+ #endif
81
+
82
+ static VALUE
83
+ rg_next(VALUE self)
84
+ {
85
+ if (poppler_index_iter_next(RVAL2POPPLERINDEXITER(self))) {
86
+ return Qtrue;
87
+ } else {
88
+ rb_ivar_set(self, id_valid, Qfalse);
89
+ return Qfalse;
90
+ }
91
+ }
92
+
93
+ static VALUE
94
+ rg_each(VALUE self)
95
+ {
96
+ PopplerIndexIter *iter;
97
+
98
+ CHECK_IITER_IS_VALID(self);
99
+ iter = RVAL2POPPLERINDEXITER(self);
100
+ do {
101
+ rb_yield(self);
102
+ } while (poppler_index_iter_next(iter));
103
+ rb_ivar_set(self, id_valid, Qfalse);
104
+
105
+ return self;
106
+ }
107
+
108
+ void
109
+ Init_poppler_index_iter(VALUE mPoppler)
110
+ {
111
+ id_valid = rb_intern("valid?");
112
+
113
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_INDEX_ITER, "IndexIter", mPoppler);
114
+
115
+ /* Interface for getting the Index of a poppler_document */
116
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
117
+
118
+ RG_DEF_METHOD(initialize, 1);
119
+ RG_DEF_METHOD(child, 0);
120
+ RG_DEF_METHOD_P(open, 0);
121
+ #ifndef HAVE_TYPE_POPPLERACTIONANY
122
+ RG_DEF_METHOD(action, 0);
123
+ #endif
124
+ RG_DEF_METHOD(next, 0);
125
+
126
+ RG_DEF_METHOD_P(valid, 0);
127
+ RG_DEF_METHOD(each, 0);
128
+ }