poppler 3.1.8-x86-mingw32 → 3.1.9-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dependency-check/Rakefile +44 -0
- data/lib/poppler.rb +21 -107
- data/lib/poppler/annot-callout-line.rb +57 -0
- data/lib/poppler/cairo.rb +23 -0
- data/lib/poppler/color.rb +36 -0
- data/lib/poppler/deprecated.rb +67 -0
- data/lib/poppler/document.rb +108 -0
- data/lib/poppler/image-mapping.rb +25 -0
- data/lib/poppler/index-iter.rb +30 -0
- data/lib/poppler/loader.rb +139 -0
- data/lib/poppler/page.rb +61 -0
- data/lib/poppler/rectangle.rb +40 -0
- data/lib/poppler/version.rb +35 -0
- data/sample/number-pdf.rb +21 -2
- data/sample/pdf2.rb +0 -4
- data/sample/pdf2svg.rb +1 -1
- data/sample/pdf2text.rb +1 -1
- data/sample/pdfcrop.rb +1 -1
- data/sample/pdfdiv.rb +1 -1
- data/test/fixtures/image.odt +0 -0
- data/test/fixtures/image.pdf +0 -0
- data/test/fixtures/multiple-pages.odt +0 -0
- data/test/fixtures/multiple-pages.pdf +0 -0
- data/test/fixtures/text-field.odt +0 -0
- data/test/fixtures/text-field.pdf +0 -0
- data/test/poppler-test-utils.rb +24 -16
- data/test/run-test.rb +26 -4
- data/test/test-annotation.rb +76 -0
- data/test/{test_color.rb → test-color.rb} +0 -3
- data/test/test-constants.rb +16 -0
- data/test/{test_document.rb → test-document.rb} +26 -10
- data/test/test-page.rb +101 -0
- data/vendor/local/bin/cjpeg.exe +0 -0
- data/vendor/local/bin/djpeg.exe +0 -0
- data/vendor/local/bin/jpegtran.exe +0 -0
- data/vendor/local/bin/libjpeg-9.dll +0 -0
- data/vendor/local/bin/libopenjp2.dll +0 -0
- data/vendor/local/bin/libpoppler-59.dll +0 -0
- data/vendor/local/bin/libpoppler-cpp-0.dll +0 -0
- data/vendor/local/bin/libpoppler-glib-8.dll +0 -0
- data/vendor/local/bin/libsqlite3-0.dll +0 -0
- data/vendor/local/bin/opj_compress.exe +0 -0
- data/vendor/local/bin/opj_decompress.exe +0 -0
- data/vendor/local/bin/opj_dump.exe +0 -0
- data/vendor/local/bin/pdfdetach.exe +0 -0
- data/vendor/local/bin/pdffonts.exe +0 -0
- data/vendor/local/bin/pdfimages.exe +0 -0
- data/vendor/local/bin/pdfinfo.exe +0 -0
- data/vendor/local/bin/pdfseparate.exe +0 -0
- data/vendor/local/bin/pdftocairo.exe +0 -0
- data/vendor/local/bin/pdftohtml.exe +0 -0
- data/vendor/local/bin/pdftoppm.exe +0 -0
- data/vendor/local/bin/pdftops.exe +0 -0
- data/vendor/local/bin/pdftotext.exe +0 -0
- data/vendor/local/bin/pdfunite.exe +0 -0
- data/vendor/local/bin/rdjpgcom.exe +0 -0
- data/vendor/local/bin/sqlite3.exe +0 -0
- data/vendor/local/bin/wrjpgcom.exe +0 -0
- data/vendor/local/lib/libjpeg.dll.a +0 -0
- data/vendor/local/lib/libopenjp2.dll.a +0 -0
- data/vendor/local/lib/libpoppler-cpp.dll.a +0 -0
- data/vendor/local/lib/libpoppler-glib.a +0 -0
- data/vendor/local/lib/libpoppler-glib.dll.a +0 -0
- data/vendor/local/lib/libpoppler.a +0 -0
- data/vendor/local/lib/libpoppler.dll.a +0 -0
- data/vendor/local/lib/libsqlite3.dll.a +0 -0
- metadata +26 -46
- data/README +0 -35
- data/ext/poppler/depend +0 -6
- data/ext/poppler/extconf.rb +0 -73
- data/ext/poppler/poppler.def +0 -2
- data/ext/poppler/rbpoppler-action.c +0 -402
- data/ext/poppler/rbpoppler-annotation-callout-line.c +0 -127
- data/ext/poppler/rbpoppler-annotation-free-text.c +0 -46
- data/ext/poppler/rbpoppler-annotation-mapping.c +0 -72
- data/ext/poppler/rbpoppler-annotation-markup.c +0 -98
- data/ext/poppler/rbpoppler-annotation-text.c +0 -53
- data/ext/poppler/rbpoppler-annotation.c +0 -74
- data/ext/poppler/rbpoppler-attachment.c +0 -124
- data/ext/poppler/rbpoppler-button-field.c +0 -56
- data/ext/poppler/rbpoppler-choice-field.c +0 -131
- data/ext/poppler/rbpoppler-color.c +0 -107
- data/ext/poppler/rbpoppler-document.c +0 -224
- data/ext/poppler/rbpoppler-font-info.c +0 -59
- data/ext/poppler/rbpoppler-fonts-iter.c +0 -127
- data/ext/poppler/rbpoppler-form-field-mapping.c +0 -44
- data/ext/poppler/rbpoppler-form-field.c +0 -98
- data/ext/poppler/rbpoppler-image-mapping.c +0 -48
- data/ext/poppler/rbpoppler-index-iter.c +0 -130
- data/ext/poppler/rbpoppler-link-mapping.c +0 -47
- data/ext/poppler/rbpoppler-page-transition.c +0 -59
- data/ext/poppler/rbpoppler-page.c +0 -322
- data/ext/poppler/rbpoppler-private.h +0 -77
- data/ext/poppler/rbpoppler-ps-file.c +0 -66
- data/ext/poppler/rbpoppler-rectangle.c +0 -92
- data/ext/poppler/rbpoppler-text-field.c +0 -91
- data/ext/poppler/rbpoppler.c +0 -110
- data/ext/poppler/rbpoppler.h +0 -61
- data/ext/poppler/rbpopplerconversions.h +0 -105
- data/extconf.rb +0 -49
- data/lib/2.2/poppler.so +0 -0
- data/lib/2.3/poppler.so +0 -0
- data/lib/2.4/poppler.so +0 -0
- data/test/fixtures/image.png +0 -0
- data/test/test_annotation.rb +0 -86
- data/test/test_constants.rb +0 -30
- data/test/test_page.rb +0 -51
@@ -1,47 +0,0 @@
|
|
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 cLinkMapping
|
24
|
-
|
25
|
-
void
|
26
|
-
rectangle_set(PopplerRectangle *rect, VALUE rb_rect)
|
27
|
-
{
|
28
|
-
*rect = *(RVAL2POPPLERRECTANGLE(rb_rect));
|
29
|
-
}
|
30
|
-
|
31
|
-
DEF_ACCESSOR_WITH_SETTER(link_mapping, area,
|
32
|
-
RVAL2POPPLERLINKMAPPING, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
|
33
|
-
DEF_ACCESSOR(link_mapping, action, RVAL2POPPLERLINKMAPPING,
|
34
|
-
POPPLERACTION2RVAL, RVAL2POPPLERACTION)
|
35
|
-
|
36
|
-
void
|
37
|
-
Init_poppler_link_mapping(VALUE mPoppler)
|
38
|
-
{
|
39
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_LINK_MAPPING, "LinkMapping",
|
40
|
-
mPoppler);
|
41
|
-
|
42
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "area", link_mapping_get_area, 0);
|
43
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "action", link_mapping_get_action, 0);
|
44
|
-
|
45
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_area", link_mapping_set_area, 1);
|
46
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_action", link_mapping_set_action, 1);
|
47
|
-
}
|
@@ -1,59 +0,0 @@
|
|
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 cPageTransition
|
24
|
-
|
25
|
-
DEF_ACCESSOR(page_trans, type, RVAL2POPPLERPAGETRANSITION, RVAL2POPPLERPAGETRANSITIONTYPE, POPPLERPAGETRANSITIONTYPE2RVAL)
|
26
|
-
DEF_ACCESSOR(page_trans, alignment, RVAL2POPPLERPAGETRANSITION, RVAL2POPPLERPAGETRANSITIONALIGNMENT, POPPLERPAGETRANSITIONALIGNMENT2RVAL)
|
27
|
-
DEF_ACCESSOR(page_trans, direction, RVAL2POPPLERPAGETRANSITION, RVAL2POPPLERPAGETRANSITIONDIRECTION, POPPLERPAGETRANSITIONDIRECTION2RVAL)
|
28
|
-
DEF_ACCESSOR(page_trans, duration, RVAL2POPPLERPAGETRANSITION, NUM2INT, INT2NUM)
|
29
|
-
DEF_ACCESSOR(page_trans, angle, RVAL2POPPLERPAGETRANSITION, NUM2INT, INT2NUM)
|
30
|
-
DEF_ACCESSOR(page_trans, scale, RVAL2POPPLERPAGETRANSITION, NUM2DBL, rb_float_new)
|
31
|
-
DEF_ACCESSOR(page_trans, rectangular, RVAL2POPPLERPAGETRANSITION, RVAL2CBOOL, CBOOL2RVAL)
|
32
|
-
|
33
|
-
void
|
34
|
-
Init_poppler_page_transition(VALUE mPoppler)
|
35
|
-
{
|
36
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION,
|
37
|
-
"PageTransition", mPoppler);
|
38
|
-
|
39
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "type", page_trans_get_type, 0);
|
40
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "alignment", page_trans_get_alignment, 0);
|
41
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "direction", page_trans_get_direction, 0);
|
42
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "duration", page_trans_get_duration, 0);
|
43
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "angle", page_trans_get_angle, 0);
|
44
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "scale", page_trans_get_scale, 0);
|
45
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "rectangular",
|
46
|
-
page_trans_get_rectangular, 0);
|
47
|
-
|
48
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_type", page_trans_set_type, 1);
|
49
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_alignment",
|
50
|
-
page_trans_set_alignment, 1);
|
51
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_direction",
|
52
|
-
page_trans_set_direction, 1);
|
53
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_duration",
|
54
|
-
page_trans_set_duration, 1);
|
55
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_angle", page_trans_set_angle, 1);
|
56
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_scale", page_trans_set_scale, 1);
|
57
|
-
rbg_define_method(RG_TARGET_NAMESPACE, "set_rectangular",
|
58
|
-
page_trans_set_rectangular, 1);
|
59
|
-
}
|
@@ -1,322 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2006-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 cPage
|
25
|
-
#define SELF(self) (RVAL2POPPLERPAGE(self))
|
26
|
-
|
27
|
-
static VALUE cRectangle;
|
28
|
-
static VALUE cPSFile;
|
29
|
-
|
30
|
-
static VALUE
|
31
|
-
page_render(VALUE self, VALUE cairo)
|
32
|
-
{
|
33
|
-
poppler_page_render(SELF(self), RVAL2CRCONTEXT(cairo));
|
34
|
-
return Qnil;
|
35
|
-
}
|
36
|
-
|
37
|
-
static VALUE
|
38
|
-
page_render_to_ps(VALUE self, VALUE ps_file)
|
39
|
-
{
|
40
|
-
poppler_page_render_to_ps(SELF(self), RVAL2POPPLERPSFILE(ps_file));
|
41
|
-
return Qnil;
|
42
|
-
}
|
43
|
-
|
44
|
-
static VALUE
|
45
|
-
rg_render(VALUE self, VALUE ps_file_or_cairo)
|
46
|
-
{
|
47
|
-
if (RVAL2CBOOL(rb_obj_is_kind_of(ps_file_or_cairo, cPSFile))) {
|
48
|
-
return page_render_to_ps(self, ps_file_or_cairo);
|
49
|
-
} else {
|
50
|
-
return page_render(self, ps_file_or_cairo);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
static VALUE
|
55
|
-
page_render_for_printing(VALUE self, VALUE cairo)
|
56
|
-
{
|
57
|
-
poppler_page_render_for_printing(SELF(self), RVAL2CRCONTEXT(cairo));
|
58
|
-
return Qnil;
|
59
|
-
}
|
60
|
-
|
61
|
-
static VALUE
|
62
|
-
rg_render_for_printing(VALUE self, VALUE cairo)
|
63
|
-
{
|
64
|
-
return page_render_for_printing(self, cairo);
|
65
|
-
}
|
66
|
-
|
67
|
-
static VALUE
|
68
|
-
page_render_selection(VALUE self, VALUE cairo,
|
69
|
-
VALUE selection, VALUE rb_old_selection,
|
70
|
-
VALUE style, VALUE glyph_color, VALUE background_color)
|
71
|
-
{
|
72
|
-
PopplerRectangle *old_selection = NULL;
|
73
|
-
|
74
|
-
if (!NIL_P(rb_old_selection))
|
75
|
-
old_selection = RVAL2POPPLERRECTANGLE(rb_old_selection);
|
76
|
-
poppler_page_render_selection(SELF(self), RVAL2CRCONTEXT(cairo),
|
77
|
-
RVAL2POPPLERRECTANGLE(selection),
|
78
|
-
old_selection,
|
79
|
-
RVAL2POPPLERSELECTIONSTYLE(style),
|
80
|
-
RVAL2POPPLERCOLOR(glyph_color),
|
81
|
-
RVAL2POPPLERCOLOR(background_color));
|
82
|
-
return Qnil;
|
83
|
-
}
|
84
|
-
|
85
|
-
static VALUE
|
86
|
-
rg_render_selection(VALUE self,
|
87
|
-
VALUE cairo, VALUE selection, VALUE old_selection,
|
88
|
-
VALUE style, VALUE glyph_color, VALUE background_color)
|
89
|
-
{
|
90
|
-
return page_render_selection(self, cairo, selection, old_selection,
|
91
|
-
style, glyph_color, background_color);
|
92
|
-
}
|
93
|
-
|
94
|
-
static VALUE
|
95
|
-
rg_size(VALUE self)
|
96
|
-
{
|
97
|
-
double width, height;
|
98
|
-
poppler_page_get_size(SELF(self), &width, &height);
|
99
|
-
return rb_ary_new3(2, rb_float_new(width), rb_float_new(height));
|
100
|
-
}
|
101
|
-
|
102
|
-
static VALUE
|
103
|
-
rg_index(VALUE self)
|
104
|
-
{
|
105
|
-
return INT2NUM(poppler_page_get_index(SELF(self)));
|
106
|
-
}
|
107
|
-
|
108
|
-
static VALUE
|
109
|
-
rg_duration(VALUE self)
|
110
|
-
{
|
111
|
-
return rb_float_new(poppler_page_get_duration(SELF(self)));
|
112
|
-
}
|
113
|
-
|
114
|
-
static VALUE
|
115
|
-
rg_transition(VALUE self)
|
116
|
-
{
|
117
|
-
return POPPLERPAGETRANSITION2RVAL(poppler_page_get_transition(SELF(self)));
|
118
|
-
}
|
119
|
-
|
120
|
-
static VALUE
|
121
|
-
rg_thumbnail(VALUE self)
|
122
|
-
{
|
123
|
-
return CRSURFACE2RVAL(poppler_page_get_thumbnail(SELF(self)));
|
124
|
-
}
|
125
|
-
|
126
|
-
static VALUE
|
127
|
-
rg_thumbnail_size(VALUE self)
|
128
|
-
{
|
129
|
-
int width, height;
|
130
|
-
|
131
|
-
if (poppler_page_get_thumbnail_size(SELF(self), &width, &height))
|
132
|
-
return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
|
133
|
-
else
|
134
|
-
return Qnil;
|
135
|
-
}
|
136
|
-
|
137
|
-
static VALUE
|
138
|
-
rg_find_text(VALUE self, VALUE text)
|
139
|
-
{
|
140
|
-
return GLIST2ARY2F(poppler_page_find_text(SELF(self), RVAL2CSTR(text)),
|
141
|
-
POPPLER_TYPE_RECTANGLE);
|
142
|
-
}
|
143
|
-
|
144
|
-
static VALUE
|
145
|
-
rg_get_text(int argc, VALUE *argv, VALUE self)
|
146
|
-
{
|
147
|
-
gchar *text;
|
148
|
-
PopplerSelectionStyle style = POPPLER_SELECTION_GLYPH;
|
149
|
-
VALUE rb_text, arg1, arg2, rb_rect;
|
150
|
-
PopplerPage *page;
|
151
|
-
|
152
|
-
rb_scan_args(argc, argv, "02", &arg1, &arg2);
|
153
|
-
|
154
|
-
page = SELF(self);
|
155
|
-
rb_rect = Qnil;
|
156
|
-
if (!NIL_P(arg1)) {
|
157
|
-
if (RTEST(rb_obj_is_kind_of(arg1, cRectangle))) {
|
158
|
-
rb_rect = arg1;
|
159
|
-
} else {
|
160
|
-
rb_raise(rb_eArgError, "wrong first arrument. selection rectangle is expected.");
|
161
|
-
}
|
162
|
-
|
163
|
-
if (!NIL_P(arg2)) {
|
164
|
-
style = RVAL2POPPLERSELECTIONSTYLE(arg2);
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
if (NIL_P(rb_rect)) {
|
169
|
-
#if POPPLER_CHECK_VERSION(0, 15, 0)
|
170
|
-
text = poppler_page_get_text(page);
|
171
|
-
#else
|
172
|
-
PopplerRectangle rect;
|
173
|
-
double width, height;
|
174
|
-
|
175
|
-
rect.x1 = 0;
|
176
|
-
rect.y1 = 0;
|
177
|
-
poppler_page_get_size(page, &width, &height);
|
178
|
-
rect.x2 = width;
|
179
|
-
rect.y2 = height;
|
180
|
-
text = poppler_page_get_text(page,
|
181
|
-
style,
|
182
|
-
&rect);
|
183
|
-
#endif
|
184
|
-
} else {
|
185
|
-
PopplerRectangle *rect;
|
186
|
-
|
187
|
-
rect = RVAL2POPPLERRECTANGLE(rb_rect);
|
188
|
-
#if POPPLER_CHECK_VERSION(0, 15, 0)
|
189
|
-
text = poppler_page_get_selected_text(page, style, rect);
|
190
|
-
#else
|
191
|
-
text = poppler_page_get_text(page, style, rect);
|
192
|
-
#endif
|
193
|
-
}
|
194
|
-
|
195
|
-
rb_text = CSTR2RVAL(text);
|
196
|
-
g_free(text);
|
197
|
-
return rb_text;
|
198
|
-
}
|
199
|
-
|
200
|
-
#if POPPLER_CHECK_VERSION(0, 16, 0)
|
201
|
-
static VALUE
|
202
|
-
rg_text_layout(VALUE self)
|
203
|
-
{
|
204
|
-
PopplerRectangle *rectangles;
|
205
|
-
guint n_rectangles;
|
206
|
-
|
207
|
-
if (poppler_page_get_text_layout(SELF(self), &rectangles, &n_rectangles)) {
|
208
|
-
VALUE rb_rectangles;
|
209
|
-
guint i;
|
210
|
-
|
211
|
-
rb_rectangles = rb_ary_new2(n_rectangles);
|
212
|
-
for (i = 0; i < n_rectangles; i++) {
|
213
|
-
rb_ary_push(rb_rectangles,
|
214
|
-
POPPLERRECTANGLE2RVAL(&(rectangles[i])));
|
215
|
-
}
|
216
|
-
g_free(rectangles);
|
217
|
-
|
218
|
-
return rb_rectangles;
|
219
|
-
} else {
|
220
|
-
return Qnil;
|
221
|
-
}
|
222
|
-
}
|
223
|
-
#endif
|
224
|
-
|
225
|
-
static VALUE
|
226
|
-
rg_get_selection_region(VALUE self, VALUE scale, VALUE style, VALUE selection)
|
227
|
-
{
|
228
|
-
return GLIST2ARY2F(poppler_page_get_selection_region(SELF(self),
|
229
|
-
NUM2DBL(scale),
|
230
|
-
RVAL2POPPLERSELECTIONSTYLE(style),
|
231
|
-
RVAL2POPPLERRECTANGLE(selection)),
|
232
|
-
POPPLER_TYPE_RECTANGLE);
|
233
|
-
}
|
234
|
-
|
235
|
-
static VALUE
|
236
|
-
rg_link_mapping(VALUE self)
|
237
|
-
{
|
238
|
-
return GLIST2ARY2F(poppler_page_get_link_mapping(SELF(self)),
|
239
|
-
POPPLER_TYPE_LINK_MAPPING);
|
240
|
-
}
|
241
|
-
|
242
|
-
static VALUE
|
243
|
-
rg_image_mapping(VALUE self)
|
244
|
-
{
|
245
|
-
VALUE mappings;
|
246
|
-
GList *image_mapping, *node;
|
247
|
-
|
248
|
-
mappings = rb_ary_new();
|
249
|
-
image_mapping = poppler_page_get_image_mapping(SELF(self));
|
250
|
-
for (node = image_mapping; node; node = g_list_next(node)) {
|
251
|
-
PopplerImageMapping *image_mapping;
|
252
|
-
VALUE mapping;
|
253
|
-
|
254
|
-
image_mapping = node->data;
|
255
|
-
mapping = POPPLERIMAGEMAPPING2RVAL(image_mapping);
|
256
|
-
rb_iv_set(mapping, "@page", self);
|
257
|
-
}
|
258
|
-
poppler_page_free_image_mapping(image_mapping);
|
259
|
-
|
260
|
-
return mappings;
|
261
|
-
}
|
262
|
-
|
263
|
-
static VALUE
|
264
|
-
rg_get_image(VALUE self, VALUE image_id)
|
265
|
-
{
|
266
|
-
return CRSURFACE2RVAL(poppler_page_get_image(SELF(self), NUM2INT(image_id)));
|
267
|
-
}
|
268
|
-
|
269
|
-
static VALUE
|
270
|
-
rg_form_field_mapping(VALUE self)
|
271
|
-
{
|
272
|
-
return GLIST2ARY2F(poppler_page_get_form_field_mapping(SELF(self)),
|
273
|
-
POPPLER_TYPE_FORM_FIELD_MAPPING);
|
274
|
-
}
|
275
|
-
|
276
|
-
static VALUE
|
277
|
-
rg_annotation_mapping(VALUE self)
|
278
|
-
{
|
279
|
-
return GLIST2ARY2F(poppler_page_get_annot_mapping(SELF(self)),
|
280
|
-
POPPLER_TYPE_ANNOT_MAPPING);
|
281
|
-
}
|
282
|
-
|
283
|
-
static VALUE
|
284
|
-
rg_crop_box(VALUE self)
|
285
|
-
{
|
286
|
-
PopplerRectangle rect;
|
287
|
-
|
288
|
-
poppler_page_get_crop_box(SELF(self), &rect);
|
289
|
-
return POPPLERRECTANGLE2RVAL(&rect);
|
290
|
-
}
|
291
|
-
|
292
|
-
void
|
293
|
-
Init_poppler_page(VALUE mPoppler)
|
294
|
-
{
|
295
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PAGE, "Page", mPoppler);
|
296
|
-
cRectangle = rb_const_get(mPoppler, rb_intern("Rectangle"));
|
297
|
-
cPSFile = rb_const_get(mPoppler, rb_intern("PSFile"));
|
298
|
-
|
299
|
-
RG_DEF_METHOD(render, 1);
|
300
|
-
RG_DEF_METHOD(render_for_printing, 1);
|
301
|
-
RG_DEF_METHOD(size, 0);
|
302
|
-
RG_DEF_METHOD(index, 0);
|
303
|
-
RG_DEF_METHOD(duration, 0);
|
304
|
-
RG_DEF_METHOD(transition, 0);
|
305
|
-
|
306
|
-
RG_DEF_METHOD(thumbnail, 0);
|
307
|
-
RG_DEF_METHOD(thumbnail_size, 0);
|
308
|
-
RG_DEF_METHOD(find_text, 1);
|
309
|
-
RG_DEF_METHOD(get_text, -1);
|
310
|
-
#if POPPLER_CHECK_VERSION(0, 16, 0)
|
311
|
-
RG_DEF_METHOD(text_layout, 0);
|
312
|
-
#endif
|
313
|
-
RG_DEF_METHOD(get_selection_region, 3);
|
314
|
-
RG_DEF_METHOD(link_mapping, 0);
|
315
|
-
RG_DEF_METHOD(image_mapping, 0);
|
316
|
-
RG_DEF_METHOD(get_image, 1);
|
317
|
-
|
318
|
-
RG_DEF_METHOD(form_field_mapping, 0);
|
319
|
-
RG_DEF_METHOD(annotation_mapping, 0);
|
320
|
-
RG_DEF_METHOD(render_selection, 6);
|
321
|
-
RG_DEF_METHOD(crop_box, 0);
|
322
|
-
}
|
@@ -1,77 +0,0 @@
|
|
1
|
-
#ifndef __RBPOPPLER_PRIVATE_H__
|
2
|
-
#define __RBPOPPLER_PRIVATE_H__
|
3
|
-
|
4
|
-
#include "rbpoppler.h"
|
5
|
-
|
6
|
-
#define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o)))
|
7
|
-
|
8
|
-
G_GNUC_INTERNAL void Init_poppler_index_iter(VALUE mPoppler);
|
9
|
-
G_GNUC_INTERNAL void Init_poppler_font_info(VALUE mPoppler);
|
10
|
-
G_GNUC_INTERNAL void Init_poppler_document(VALUE mPoppler);
|
11
|
-
G_GNUC_INTERNAL void Init_poppler_fonts_iter(VALUE mPoppler);
|
12
|
-
G_GNUC_INTERNAL void Init_poppler_ps_file(VALUE mPoppler);
|
13
|
-
G_GNUC_INTERNAL void Init_poppler_rectangle(VALUE mPoppler);
|
14
|
-
G_GNUC_INTERNAL void Init_poppler_page(VALUE mPoppler);
|
15
|
-
G_GNUC_INTERNAL void Init_poppler_color(VALUE mPoppler);
|
16
|
-
G_GNUC_INTERNAL void Init_poppler_link_mapping(VALUE mPoppler);
|
17
|
-
G_GNUC_INTERNAL void Init_poppler_page_transition(VALUE mPoppler);
|
18
|
-
G_GNUC_INTERNAL void Init_poppler_image_mapping(VALUE mPoppler);
|
19
|
-
G_GNUC_INTERNAL void Init_poppler_form_field_mapping(VALUE mPoppler);
|
20
|
-
G_GNUC_INTERNAL void Init_poppler_annotation_mapping(VALUE mPoppler);
|
21
|
-
G_GNUC_INTERNAL void Init_poppler_attachment(VALUE mPoppler);
|
22
|
-
G_GNUC_INTERNAL void Init_poppler_action(VALUE mPoppler);
|
23
|
-
G_GNUC_INTERNAL void Init_poppler_annotation(VALUE mPoppler);
|
24
|
-
G_GNUC_INTERNAL void Init_poppler_annotation_markup(VALUE mPoppler);
|
25
|
-
G_GNUC_INTERNAL void Init_poppler_annotation_text(VALUE mPoppler);
|
26
|
-
G_GNUC_INTERNAL void Init_poppler_annotation_free_text(VALUE mPoppler);
|
27
|
-
G_GNUC_INTERNAL void Init_poppler_annotation_callout_line(VALUE mPoppler);
|
28
|
-
G_GNUC_INTERNAL void Init_poppler_form_field(VALUE mPoppler);
|
29
|
-
G_GNUC_INTERNAL void Init_poppler_button_field(VALUE mPoppler, VALUE cFormField);
|
30
|
-
G_GNUC_INTERNAL void Init_poppler_text_field(VALUE mPoppler, VALUE cFormField);
|
31
|
-
G_GNUC_INTERNAL void Init_poppler_choice_field(VALUE mPoppler, VALUE cFormField);
|
32
|
-
|
33
|
-
G_GNUC_INTERNAL void rectangle_set(PopplerRectangle *rect, VALUE rb_rect);
|
34
|
-
|
35
|
-
#define RECT_ENTITY2RVAL(rect) POPPLERRECTANGLE2RVAL(&(rect))
|
36
|
-
#define RECT_ENTITY_SET(rect, rb_rect) rectangle_set(&(rect), rb_rect)
|
37
|
-
|
38
|
-
#define DEF_READER(prefix, name, member, self_to_c, member_to_rb) \
|
39
|
-
static VALUE \
|
40
|
-
prefix ## _get_ ## name(VALUE self) \
|
41
|
-
{ \
|
42
|
-
return member_to_rb((self_to_c(self))->member); \
|
43
|
-
}
|
44
|
-
|
45
|
-
#define DEF_WRITER(prefix, name, member, self_to_c, value_to_c) \
|
46
|
-
static VALUE \
|
47
|
-
prefix ## _set_ ## name(VALUE self, VALUE value) \
|
48
|
-
{ \
|
49
|
-
(self_to_c(self))->member = value_to_c(value); \
|
50
|
-
return Qnil; \
|
51
|
-
}
|
52
|
-
|
53
|
-
#define DEF_WRITER_WITH_SETTER(prefix, name, member, \
|
54
|
-
self_to_c, value_setter) \
|
55
|
-
static VALUE \
|
56
|
-
prefix ## _set_ ## name(VALUE self, VALUE value) \
|
57
|
-
{ \
|
58
|
-
value_setter((self_to_c(self))->member, value); \
|
59
|
-
return Qnil; \
|
60
|
-
}
|
61
|
-
|
62
|
-
#define DEF_ACCESSOR(prefix, member, self_to_c, member_to_rb, value_to_c) \
|
63
|
-
DEF_READER(prefix, member, member, self_to_c, member_to_rb) \
|
64
|
-
DEF_WRITER(prefix, member, member, self_to_c, value_to_c) \
|
65
|
-
|
66
|
-
#define DEF_ACCESSOR_WITH_SETTER(prefix, member, self_to_c, \
|
67
|
-
member_to_rb, value_setter) \
|
68
|
-
DEF_READER(prefix, member, member, self_to_c, member_to_rb) \
|
69
|
-
DEF_WRITER_WITH_SETTER(prefix, member, member, self_to_c, value_setter)
|
70
|
-
|
71
|
-
#define DEF_ACCESSOR_WITH_NAME(prefix, name, member, self_to_c, \
|
72
|
-
member_to_rb, value_to_c) \
|
73
|
-
DEF_READER(prefix, name, member, self_to_c, member_to_rb) \
|
74
|
-
DEF_WRITER(prefix, name, member, self_to_c, value_to_c)
|
75
|
-
|
76
|
-
|
77
|
-
#endif
|