poppler 2.2.4-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +35 -0
- data/Rakefile +75 -0
- data/ext/poppler/depend +6 -0
- data/ext/poppler/extconf.rb +70 -0
- data/ext/poppler/poppler.def +2 -0
- data/ext/poppler/rbpoppler-action.c +372 -0
- data/ext/poppler/rbpoppler-annotation-callout-line.c +127 -0
- data/ext/poppler/rbpoppler-annotation-free-text.c +46 -0
- data/ext/poppler/rbpoppler-annotation-mapping.c +72 -0
- data/ext/poppler/rbpoppler-annotation-markup.c +98 -0
- data/ext/poppler/rbpoppler-annotation-text.c +53 -0
- data/ext/poppler/rbpoppler-annotation.c +74 -0
- data/ext/poppler/rbpoppler-attachment.c +124 -0
- data/ext/poppler/rbpoppler-button-field.c +56 -0
- data/ext/poppler/rbpoppler-choice-field.c +131 -0
- data/ext/poppler/rbpoppler-color.c +107 -0
- data/ext/poppler/rbpoppler-document.c +224 -0
- data/ext/poppler/rbpoppler-font-info.c +59 -0
- data/ext/poppler/rbpoppler-fonts-iter.c +127 -0
- data/ext/poppler/rbpoppler-form-field-mapping.c +44 -0
- data/ext/poppler/rbpoppler-form-field.c +98 -0
- data/ext/poppler/rbpoppler-image-mapping.c +48 -0
- data/ext/poppler/rbpoppler-index-iter.c +128 -0
- data/ext/poppler/rbpoppler-link-mapping.c +47 -0
- data/ext/poppler/rbpoppler-page-transition.c +59 -0
- data/ext/poppler/rbpoppler-page.c +322 -0
- data/ext/poppler/rbpoppler-private.h +77 -0
- data/ext/poppler/rbpoppler-ps-file.c +66 -0
- data/ext/poppler/rbpoppler-rectangle.c +92 -0
- data/ext/poppler/rbpoppler-text-field.c +91 -0
- data/ext/poppler/rbpoppler.c +111 -0
- data/ext/poppler/rbpoppler.h +61 -0
- data/ext/poppler/rbpopplerconversions.h +105 -0
- data/extconf.rb +49 -0
- data/lib/2.0/poppler.so +0 -0
- data/lib/2.1/poppler.so +0 -0
- data/lib/2.2/poppler.so +0 -0
- data/lib/poppler.rb +105 -0
- data/sample/number-pdf.rb +32 -0
- data/sample/pdf2.rb +132 -0
- data/sample/pdf2svg.rb +26 -0
- data/sample/pdf2text.rb +16 -0
- data/sample/pdfcrop.rb +32 -0
- data/sample/pdfdiv.rb +36 -0
- data/test/fixtures/image.pdf +0 -0
- data/test/fixtures/image.png +0 -0
- data/test/poppler-test-utils.rb +58 -0
- data/test/run-test.rb +32 -0
- data/test/test_annotation.rb +86 -0
- data/test/test_color.rb +26 -0
- data/test/test_constants.rb +30 -0
- data/test/test_document.rb +41 -0
- data/test/test_page.rb +42 -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/libpoppler-48.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/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/include/jconfig.h +60 -0
- data/vendor/local/include/jerror.h +304 -0
- data/vendor/local/include/jmorecfg.h +446 -0
- data/vendor/local/include/jpeglib.h +1180 -0
- data/vendor/local/include/poppler/cpp/poppler-document.h +104 -0
- data/vendor/local/include/poppler/cpp/poppler-embedded-file.h +55 -0
- data/vendor/local/include/poppler/cpp/poppler-font.h +91 -0
- data/vendor/local/include/poppler/cpp/poppler-global.h +111 -0
- data/vendor/local/include/poppler/cpp/poppler-image.h +71 -0
- data/vendor/local/include/poppler/cpp/poppler-page-renderer.h +66 -0
- data/vendor/local/include/poppler/cpp/poppler-page-transition.h +82 -0
- data/vendor/local/include/poppler/cpp/poppler-page.h +76 -0
- data/vendor/local/include/poppler/cpp/poppler-rectangle.h +84 -0
- data/vendor/local/include/poppler/cpp/poppler-toc.h +74 -0
- data/vendor/local/include/poppler/cpp/poppler-version.h +39 -0
- data/vendor/local/include/poppler/glib/poppler-action.h +316 -0
- data/vendor/local/include/poppler/glib/poppler-annot.h +296 -0
- data/vendor/local/include/poppler/glib/poppler-attachment.h +87 -0
- data/vendor/local/include/poppler/glib/poppler-date.h +30 -0
- data/vendor/local/include/poppler/glib/poppler-document.h +299 -0
- data/vendor/local/include/poppler/glib/poppler-enums.h +116 -0
- data/vendor/local/include/poppler/glib/poppler-features.h +88 -0
- data/vendor/local/include/poppler/glib/poppler-form-field.h +111 -0
- data/vendor/local/include/poppler/glib/poppler-layer.h +43 -0
- data/vendor/local/include/poppler/glib/poppler-media.h +73 -0
- data/vendor/local/include/poppler/glib/poppler-movie.h +42 -0
- data/vendor/local/include/poppler/glib/poppler-page.h +377 -0
- data/vendor/local/include/poppler/glib/poppler-structure-element.h +357 -0
- data/vendor/local/include/poppler/glib/poppler.h +250 -0
- data/vendor/local/include/sqlite3.h +7494 -0
- data/vendor/local/include/sqlite3ext.h +487 -0
- data/vendor/local/lib/girepository-1.0/Poppler-0.18.typelib +0 -0
- data/vendor/local/lib/libjpeg.a +0 -0
- data/vendor/local/lib/libjpeg.dll.a +0 -0
- data/vendor/local/lib/libjpeg.la +41 -0
- data/vendor/local/lib/libpoppler-cpp.a +0 -0
- data/vendor/local/lib/libpoppler-cpp.dll.a +0 -0
- data/vendor/local/lib/libpoppler-cpp.la +41 -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-glib.la +41 -0
- data/vendor/local/lib/libpoppler.a +0 -0
- data/vendor/local/lib/libpoppler.dll.a +0 -0
- data/vendor/local/lib/libpoppler.la +41 -0
- data/vendor/local/lib/libsqlite3.a +0 -0
- data/vendor/local/lib/libsqlite3.dll.a +0 -0
- data/vendor/local/lib/libsqlite3.la +41 -0
- data/vendor/local/lib/pkgconfig/poppler-cairo.pc +9 -0
- data/vendor/local/lib/pkgconfig/poppler-cpp.pc +13 -0
- data/vendor/local/lib/pkgconfig/poppler-glib.pc +13 -0
- data/vendor/local/lib/pkgconfig/poppler-splash.pc +9 -0
- data/vendor/local/lib/pkgconfig/poppler.pc +11 -0
- data/vendor/local/lib/pkgconfig/sqlite3.pc +13 -0
- data/vendor/local/share/gir-1.0/Poppler-0.18.gir +8281 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerAnnot.html +3221 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerAttachment.html +267 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerDocument.html +3328 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerFormField.html +1403 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerLayer.html +307 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerMedia.html +381 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerMovie.html +197 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerPage.html +3002 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerStructureElement.html +3781 -0
- data/vendor/local/share/gtk-doc/html/poppler/annotation-glossary.html +63 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-12.html +123 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-14.html +102 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-16.html +180 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-18.html +72 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-20.html +39 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-22.html +64 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-deprecated.html +39 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-full.html +1830 -0
- data/vendor/local/share/gtk-doc/html/poppler/ch01.html +74 -0
- data/vendor/local/share/gtk-doc/html/poppler/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/index.html +85 -0
- data/vendor/local/share/gtk-doc/html/poppler/index.sgml +557 -0
- data/vendor/local/share/gtk-doc/html/poppler/left-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PDF-Utility-functions.html +107 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerAction.html +796 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerColor.html +201 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-Version-and-Features-Information.html +254 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler.html +169 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp2 +470 -0
- data/vendor/local/share/gtk-doc/html/poppler/right-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/style.css +476 -0
- data/vendor/local/share/gtk-doc/html/poppler/up-insensitive.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/up.png +0 -0
- data/vendor/local/share/license/poppler/AUTHORS +5 -0
- data/vendor/local/share/license/poppler/COPYING +339 -0
- data/vendor/local/share/man/man1/cjpeg.1 +387 -0
- data/vendor/local/share/man/man1/djpeg.1 +252 -0
- data/vendor/local/share/man/man1/jpegtran.1 +293 -0
- data/vendor/local/share/man/man1/pdfdetach.1 +86 -0
- data/vendor/local/share/man/man1/pdffonts.1 +119 -0
- data/vendor/local/share/man/man1/pdfimages.1 +260 -0
- data/vendor/local/share/man/man1/pdfinfo.1 +152 -0
- data/vendor/local/share/man/man1/pdfseparate.1 +49 -0
- data/vendor/local/share/man/man1/pdftocairo.1 +295 -0
- data/vendor/local/share/man/man1/pdftohtml.1 +107 -0
- data/vendor/local/share/man/man1/pdftoppm.1 +170 -0
- data/vendor/local/share/man/man1/pdftops.1 +217 -0
- data/vendor/local/share/man/man1/pdftotext.1 +137 -0
- data/vendor/local/share/man/man1/pdfunite.1 +33 -0
- data/vendor/local/share/man/man1/rdjpgcom.1 +63 -0
- data/vendor/local/share/man/man1/sqlite3.1 +279 -0
- data/vendor/local/share/man/man1/wrjpgcom.1 +103 -0
- metadata +254 -0
@@ -0,0 +1,47 @@
|
|
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
|
+
}
|
@@ -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 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
|
+
}
|
@@ -0,0 +1,322 @@
|
|
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_list, *p;
|
209
|
+
VALUE ary;
|
210
|
+
guint i;
|
211
|
+
rb_list = p = ALLOC_N(VALUE, n_rectangles);
|
212
|
+
for (i = 0; i < n_rectangles; i++, p++) {
|
213
|
+
*p = POPPLERRECTANGLE2RVAL(&rectangles[i]);
|
214
|
+
}
|
215
|
+
ary = rb_ary_new4(n_rectangles, rb_list);
|
216
|
+
free(rb_list);
|
217
|
+
free(rectangles);
|
218
|
+
return ary;
|
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
|
+
}
|
@@ -0,0 +1,77 @@
|
|
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
|