poppler 2.0.2-x86-mingw32 → 2.0.3-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +1 -1
- data/Rakefile +69 -9
- data/ext/poppler/extconf.rb +5 -2
- data/ext/poppler/rbpoppler-action.c +242 -86
- data/ext/poppler/{rbpoppler-annotationcalloutline.c → rbpoppler-annotation-callout-line.c} +2 -3
- data/ext/poppler/{rbpoppler-annotationfreetext.c → rbpoppler-annotation-free-text.c} +2 -3
- data/ext/poppler/{rbpoppler-annotationmapping.c → rbpoppler-annotation-mapping.c} +2 -3
- data/ext/poppler/{rbpoppler-annotationmarkup.c → rbpoppler-annotation-markup.c} +5 -4
- data/ext/poppler/{rbpoppler-annotationtext.c → rbpoppler-annotation-text.c} +2 -7
- data/ext/poppler/{rbpoppler-buttonfield.c → rbpoppler-button-field.c} +0 -0
- data/ext/poppler/{rbpoppler-choicefield.c → rbpoppler-choice-field.c} +0 -0
- data/ext/poppler/{rbpoppler-fontinfo.c → rbpoppler-font-info.c} +2 -8
- data/ext/poppler/{rbpoppler-fontsiter.c → rbpoppler-fonts-iter.c} +5 -6
- data/ext/poppler/{rbpoppler-formfieldmapping.c → rbpoppler-form-field-mapping.c} +2 -3
- data/ext/poppler/{rbpoppler-imagemapping.c → rbpoppler-image-mapping.c} +2 -7
- data/ext/poppler/{rbpoppler-indexiter.c → rbpoppler-index-iter.c} +2 -3
- data/ext/poppler/{rbpoppler-linkmapping.c → rbpoppler-link-mapping.c} +2 -3
- data/ext/poppler/{rbpoppler-pagetransition.c → rbpoppler-page-transition.c} +2 -3
- data/ext/poppler/rbpoppler-page.c +0 -29
- data/ext/poppler/rbpoppler-private.h +13 -13
- data/ext/poppler/{rbpoppler-psfile.c → rbpoppler-ps-file.c} +2 -3
- data/ext/poppler/{rbpoppler-textfield.c → rbpoppler-text-field.c} +0 -0
- data/ext/poppler/rbpoppler.c +14 -22
- data/ext/poppler/rbpoppler.h +3 -6
- data/ext/poppler/rbpopplerconversions.h +1 -1
- data/lib/1.9/poppler.so +0 -0
- data/lib/2.0/poppler.so +0 -0
- data/sample/pdf2.rb +46 -10
- data/test/fixtures/image.png +0 -0
- data/test/run-test.rb +7 -4
- data/test/test_page.rb +1 -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-44.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 +8 -0
- data/vendor/local/include/jerror.h +2 -2
- data/vendor/local/include/jmorecfg.h +28 -7
- data/vendor/local/include/jpeglib.h +46 -8
- data/vendor/local/include/poppler/glib/poppler-action.h +156 -2
- data/vendor/local/include/poppler/glib/poppler-annot.h +57 -1
- data/vendor/local/include/poppler/glib/poppler-attachment.h +17 -0
- data/vendor/local/include/poppler/glib/poppler-document.h +133 -26
- data/vendor/local/include/poppler/glib/poppler-enums.h +8 -0
- data/vendor/local/include/poppler/glib/poppler-features.h +58 -4
- data/vendor/local/include/poppler/glib/poppler-form-field.h +4 -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 +133 -44
- data/vendor/local/include/poppler/glib/poppler.h +125 -24
- data/vendor/local/include/sqlite3.h +7338 -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-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-glib.pc +3 -3
- data/vendor/local/lib/pkgconfig/poppler-splash.pc +2 -2
- data/vendor/local/lib/pkgconfig/poppler.pc +1 -1
- data/vendor/local/lib/pkgconfig/sqlite3.pc +13 -0
- data/vendor/local/share/gir-1.0/Poppler-0.18.gir +5452 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerAnnot.html +1671 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerAttachment.html +214 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerDocument.html +2587 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerFormField.html +1070 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerLayer.html +228 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerMedia.html +306 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerMovie.html +156 -0
- data/vendor/local/share/gtk-doc/html/poppler/PopplerPage.html +2132 -0
- data/vendor/local/share/gtk-doc/html/poppler/annotation-glossary.html +71 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-12.html +128 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-14.html +107 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-16.html +185 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-18.html +77 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-20.html +42 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-0-22.html +62 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-deprecated.html +42 -0
- data/vendor/local/share/gtk-doc/html/poppler/api-index-full.html +1352 -0
- data/vendor/local/share/gtk-doc/html/poppler/ch01.html +21 -19
- data/vendor/local/share/gtk-doc/html/poppler/home.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/index.html +35 -18
- data/vendor/local/share/gtk-doc/html/poppler/index.sgml +548 -300
- data/vendor/local/share/gtk-doc/html/poppler/left.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerAction.html +662 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-Version-and-Features-Information.html +145 -0
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler.html +319 -364
- data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp2 +506 -265
- data/vendor/local/share/gtk-doc/html/poppler/right.png +0 -0
- data/vendor/local/share/gtk-doc/html/poppler/style.css +153 -54
- 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 +51 -10
- data/vendor/local/share/man/man1/djpeg.1 +5 -4
- data/vendor/local/share/man/man1/jpegtran.1 +15 -2
- data/vendor/local/share/man/man1/pdfdetach.1 +86 -0
- data/vendor/local/share/man/man1/pdffonts.1 +16 -7
- data/vendor/local/share/man/man1/pdfimages.1 +114 -7
- data/vendor/local/share/man/man1/pdfinfo.1 +16 -7
- data/vendor/local/share/man/man1/pdfseparate.1 +49 -0
- data/vendor/local/share/man/man1/pdftocairo.1 +266 -0
- data/vendor/local/share/man/man1/pdftohtml.1 +30 -8
- data/vendor/local/share/man/man1/pdftoppm.1 +42 -12
- data/vendor/local/share/man/man1/pdftops.1 +26 -10
- data/vendor/local/share/man/man1/pdftotext.1 +18 -7
- data/vendor/local/share/man/man1/pdfunite.1 +33 -0
- data/vendor/local/share/man/man1/sqlite3.1 +229 -0
- metadata +107 -64
- data/vendor/local/bin/libgcc_s_dw2-1.dll +0 -0
- data/vendor/local/bin/libjpeg-7.dll +0 -0
- data/vendor/local/bin/libpng12-0.dll +0 -0
- data/vendor/local/bin/libpoppler-5.dll +0 -0
- data/vendor/local/bin/libpoppler-glib-4.dll +0 -0
- data/vendor/local/include/libpng12/png.h +0 -3726
- data/vendor/local/include/libpng12/pngconf.h +0 -1508
- data/vendor/local/include/png.h +0 -3726
- data/vendor/local/include/pngconf.h +0 -1508
- data/vendor/local/lib/libpng.def +0 -366
- data/vendor/local/lib/libpng.lib +0 -0
- data/vendor/local/lib/libpng12.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/libpng.pc +0 -11
- data/vendor/local/lib/pkgconfig/libpng12.pc +0 -11
- data/vendor/local/manifest/jpeg-dev_7-1_win32.mft +0 -18
- data/vendor/local/manifest/jpeg_7-1_win32.mft +0 -2
- data/vendor/local/manifest/libpng-dev_1.2.40-1_win32.mft +0 -15
- data/vendor/local/manifest/libpng_1.2.40-1_win32.mft +0 -2
- data/vendor/local/manifest/poppler-dev_0.12.0-1_win32.mft +0 -49
- data/vendor/local/manifest/poppler_0.12.0-1_win32.mft +0 -4
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-action.html +0 -386
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-annot.html +0 -854
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-attachment.html +0 -205
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-document.html +0 -1122
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-enums.html +0 -412
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-features.html +0 -143
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-form-field.html +0 -871
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-layer.html +0 -214
- data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-page.html +0 -1258
- data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp +0 -281
- data/vendor/local/share/man/man3/libpng.3 +0 -4349
- data/vendor/local/share/man/man3/libpngpf.3 +0 -790
- data/vendor/local/share/man/man5/png.5 +0 -74
- data/vendor/local/src/tml/packaging/jpeg_7-1_win32.log +0 -249
- data/vendor/local/src/tml/packaging/jpeg_7-1_win32.sh +0 -44
- data/vendor/local/src/tml/packaging/libpng_1.2.40-1_win32.log +0 -269
- data/vendor/local/src/tml/packaging/libpng_1.2.40-1_win32.sh +0 -63
@@ -1,7 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2006 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
|
5
4
|
*
|
6
5
|
* This library is free software; you can redistribute it and/or
|
7
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -56,7 +55,7 @@ rg_set_duplex(VALUE self, VALUE duplex)
|
|
56
55
|
}
|
57
56
|
|
58
57
|
void
|
59
|
-
|
58
|
+
Init_poppler_ps_file(VALUE mPoppler)
|
60
59
|
{
|
61
60
|
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_PS_FILE, "PSFile", mPoppler);
|
62
61
|
|
File without changes
|
data/ext/poppler/rbpoppler.c
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C)
|
4
|
-
* Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
|
3
|
+
* Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
|
5
4
|
*
|
6
5
|
* This library is free software; you can redistribute it and/or
|
7
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -40,11 +39,7 @@ rg_s_version(G_GNUC_UNUSED VALUE self)
|
|
40
39
|
static VALUE
|
41
40
|
rg_s_cairo_available_p(G_GNUC_UNUSED VALUE self)
|
42
41
|
{
|
43
|
-
#ifdef RB_POPPLER_CAIRO_AVAILABLE
|
44
42
|
return Qtrue;
|
45
|
-
#else
|
46
|
-
return Qfalse;
|
47
|
-
#endif
|
48
43
|
}
|
49
44
|
|
50
45
|
void
|
@@ -82,9 +77,6 @@ Init_poppler(void)
|
|
82
77
|
G_RENAME_NICK("3D", "TYPE_3D");
|
83
78
|
G_DEF_CLASS(POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE,
|
84
79
|
"AnnotationExternalDataType", RG_TARGET_NAMESPACE);
|
85
|
-
# if !POPPLER_CHECK_VERSION(0, 9, 0)
|
86
|
-
G_DEF_CLASS(POPPLER_TYPE_ANNOT_TEXT_ICON, "AnnotationTextIcon", RG_TARGET_NAMESPACE);
|
87
|
-
# endif
|
88
80
|
G_DEF_CLASS(POPPLER_TYPE_ANNOT_TEXT_STATE, "AnnotationTextState", RG_TARGET_NAMESPACE);
|
89
81
|
G_DEF_CLASS(POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING,
|
90
82
|
"AnnotationFreeTextQuadding", RG_TARGET_NAMESPACE);
|
@@ -95,25 +87,25 @@ Init_poppler(void)
|
|
95
87
|
RG_DEF_SMETHOD(version, 0);
|
96
88
|
RG_DEF_SMETHOD_P(cairo_available, 0);
|
97
89
|
|
98
|
-
|
99
|
-
|
90
|
+
Init_poppler_index_iter(RG_TARGET_NAMESPACE);
|
91
|
+
Init_poppler_font_info(RG_TARGET_NAMESPACE);
|
100
92
|
Init_poppler_document(RG_TARGET_NAMESPACE);
|
101
|
-
|
102
|
-
|
93
|
+
Init_poppler_fonts_iter(RG_TARGET_NAMESPACE);
|
94
|
+
Init_poppler_ps_file(RG_TARGET_NAMESPACE);
|
103
95
|
Init_poppler_rectangle(RG_TARGET_NAMESPACE);
|
104
96
|
Init_poppler_page(RG_TARGET_NAMESPACE);
|
105
97
|
Init_poppler_color(RG_TARGET_NAMESPACE);
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
98
|
+
Init_poppler_link_mapping(RG_TARGET_NAMESPACE);
|
99
|
+
Init_poppler_page_transition(RG_TARGET_NAMESPACE);
|
100
|
+
Init_poppler_image_mapping(RG_TARGET_NAMESPACE);
|
101
|
+
Init_poppler_form_field_mapping(RG_TARGET_NAMESPACE);
|
102
|
+
Init_poppler_annotation_mapping(RG_TARGET_NAMESPACE);
|
111
103
|
Init_poppler_attachment(RG_TARGET_NAMESPACE);
|
112
104
|
Init_poppler_action(RG_TARGET_NAMESPACE);
|
113
105
|
Init_poppler_annotation(RG_TARGET_NAMESPACE);
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
106
|
+
Init_poppler_annotation_markup(RG_TARGET_NAMESPACE);
|
107
|
+
Init_poppler_annotation_text(RG_TARGET_NAMESPACE);
|
108
|
+
Init_poppler_annotation_free_text(RG_TARGET_NAMESPACE);
|
109
|
+
Init_poppler_annotation_callout_line(RG_TARGET_NAMESPACE);
|
118
110
|
Init_poppler_form_field(RG_TARGET_NAMESPACE);
|
119
111
|
}
|
data/ext/poppler/rbpoppler.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2006-
|
3
|
+
* Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -47,18 +47,15 @@ extern GType poppler_dest_get_type (void) G_GNUC_CONST;
|
|
47
47
|
# define RB_POPPLER_TYPE_DEST_NOT_DEFINED
|
48
48
|
#endif
|
49
49
|
|
50
|
-
#
|
51
|
-
# define RB_POPPLER_CAIRO_AVAILABLE 1
|
52
|
-
# include <rb_cairo.h>
|
53
|
-
#endif
|
50
|
+
#include <rb_cairo.h>
|
54
51
|
|
55
52
|
#ifdef POPPLER_TYPE_COLOR
|
56
53
|
extern PopplerColor *rb_poppler_ruby_object_to_color(VALUE color);
|
57
54
|
extern VALUE rb_poppler_ruby_object_from_color_with_free(PopplerColor *color);
|
58
55
|
#endif
|
59
56
|
|
57
|
+
extern VALUE rb_poppler_ruby_object_from_form_field(PopplerFormField *field);
|
60
58
|
extern VALUE rb_poppler_ruby_object_from_action(PopplerAction *action);
|
61
59
|
extern PopplerAction *rb_poppler_action_from_ruby_object(VALUE action);
|
62
|
-
extern VALUE rb_poppler_ruby_object_from_form_field(PopplerFormField *field);
|
63
60
|
|
64
61
|
#endif
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2006-
|
3
|
+
* Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
data/lib/1.9/poppler.so
CHANGED
Binary file
|
data/lib/2.0/poppler.so
CHANGED
Binary file
|
data/sample/pdf2.rb
CHANGED
@@ -1,17 +1,53 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require "tempfile"
|
4
|
+
require "optparse"
|
4
5
|
require "poppler"
|
5
6
|
require "gdk_pixbuf2"
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
page = 0
|
9
|
+
scale = 1.0
|
10
|
+
rotate = 0
|
11
|
+
|
12
|
+
parser = OptionParser.new
|
13
|
+
parser.banner = <<-BANNER
|
14
|
+
Usage: #{parser.program_name} INPUT.PDF OUTPUT [options]
|
15
|
+
|
16
|
+
#{parser.program_name} coverts the target page in INPUT.PDF to an image file.
|
17
|
+
Many popular image formats such as PNG and JPEG are supported.
|
18
|
+
You can specify output image format by OUTPUT file extension.
|
19
|
+
For example, the following comand generates PNG file:
|
20
|
+
|
21
|
+
% #{$0} INPUT.PDF OUTPUT.png
|
22
|
+
|
23
|
+
BANNER
|
24
|
+
|
25
|
+
parser.on("--page=PAGE", Integer,
|
26
|
+
"Use PAGE as the target page",
|
27
|
+
"(0-origin)",
|
28
|
+
"[#{page}]") do |value|
|
29
|
+
page = value.to_i
|
10
30
|
end
|
11
31
|
|
12
|
-
|
13
|
-
|
14
|
-
|
32
|
+
parser.on("--scale=RATIO", Float,
|
33
|
+
"Scale the target page in INPUT.PDF RATIO times larger in OUTPUT",
|
34
|
+
"[#{scale}]") do |value|
|
35
|
+
scale = value.to_f
|
36
|
+
end
|
37
|
+
|
38
|
+
parser.on("--rotate=DEGREE", Integer,
|
39
|
+
"Rotate the target page in INPUT.PDF DEGREE degrees clockwise in OUTPUT",
|
40
|
+
"(available values: 0...360)",
|
41
|
+
"[#{rotate}]") do |value|
|
42
|
+
rotate = value.to_i % 360
|
43
|
+
end
|
44
|
+
|
45
|
+
rest_args = parser.parse!
|
46
|
+
if rest_args.size != 2
|
47
|
+
puts(parser.help)
|
48
|
+
exit(false)
|
49
|
+
end
|
50
|
+
input, output = rest_args
|
15
51
|
|
16
52
|
ext_name = File.extname(output)[1..-1]
|
17
53
|
if ext_name
|
@@ -52,9 +88,9 @@ def compute_size(width, height, rotate)
|
|
52
88
|
end
|
53
89
|
end
|
54
90
|
|
55
|
-
def to_pixbuf_with_cairo(input, scale, rotate)
|
91
|
+
def to_pixbuf_with_cairo(input, page_number, scale, rotate)
|
56
92
|
doc = Poppler::Document.new(input)
|
57
|
-
page = doc[
|
93
|
+
page = doc[page_number]
|
58
94
|
width, height = page.size.collect {|x| x * scale}
|
59
95
|
surface_width, surface_height = compute_size(width, height, rotate)
|
60
96
|
|
@@ -86,7 +122,7 @@ unless Poppler.cairo_available?
|
|
86
122
|
puts "cairo isn't available."
|
87
123
|
exit(false)
|
88
124
|
end
|
89
|
-
pixbuf = to_pixbuf_with_cairo(input, scale, rotate)
|
125
|
+
pixbuf = to_pixbuf_with_cairo(input, page, scale, rotate)
|
90
126
|
|
91
127
|
if pixbuf.nil?
|
92
128
|
puts "Is it a PDF file?: #{input}"
|
data/test/fixtures/image.png
CHANGED
Binary file
|
data/test/run-test.rb
CHANGED
@@ -2,21 +2,24 @@
|
|
2
2
|
|
3
3
|
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
4
4
|
|
5
|
-
|
6
|
-
system("cd #{base_dir.dump} && make > /dev/null") or exit(1)
|
7
|
-
end
|
5
|
+
have_make = system("which make > /dev/null")
|
8
6
|
|
9
7
|
glib_dir = File.expand_path(File.join(base_dir, "..", "glib2"))
|
10
8
|
gdk_pixbuf_dir = File.expand_path(File.join(base_dir, "..", "gdk_pixbuf2"))
|
9
|
+
pango_dir = File.join(File.join(base_dir, ".." , "pango"))
|
11
10
|
gtk_dir = File.expand_path(File.join(base_dir, "..", "gtk2"))
|
12
11
|
|
13
12
|
$LOAD_PATH.unshift(File.join(glib_dir, "test"))
|
14
13
|
require 'glib-test-init'
|
15
14
|
|
16
15
|
[[gtk_dir, "gtk2"],
|
17
|
-
[gdk_pixbuf_dir, "
|
16
|
+
[gdk_pixbuf_dir, "gdk_pixbuf2"],
|
17
|
+
[pango_dir, "pango"],
|
18
18
|
[glib_dir, "glib2"],
|
19
19
|
[base_dir, "poppler"]].each do |dir, module_name|
|
20
|
+
if have_make
|
21
|
+
system("cd #{dir.dump} && make > /dev/null") or exit(false)
|
22
|
+
end
|
20
23
|
$LOAD_PATH.unshift(File.join(dir, "ext", module_name))
|
21
24
|
$LOAD_PATH.unshift(File.join(dir, "lib"))
|
22
25
|
end
|
data/test/test_page.rb
CHANGED
data/vendor/local/bin/cjpeg.exe
CHANGED
Binary file
|
data/vendor/local/bin/djpeg.exe
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -18,6 +18,14 @@
|
|
18
18
|
/* Define this if you get warnings about undefined structures. */
|
19
19
|
/* #undef INCOMPLETE_TYPES_BROKEN */
|
20
20
|
|
21
|
+
/* Define "boolean" as unsigned char, not int, on Windows systems. */
|
22
|
+
#ifdef _WIN32
|
23
|
+
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
|
24
|
+
typedef unsigned char boolean;
|
25
|
+
#endif
|
26
|
+
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
|
27
|
+
#endif
|
28
|
+
|
21
29
|
#ifdef JPEG_INTERNALS
|
22
30
|
|
23
31
|
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* jerror.h
|
3
3
|
*
|
4
4
|
* Copyright (C) 1994-1997, Thomas G. Lane.
|
5
|
-
* Modified 1997-
|
5
|
+
* Modified 1997-2012 by Guido Vollbeding.
|
6
6
|
* This file is part of the Independent JPEG Group's software.
|
7
7
|
* For conditions of distribution and use, see the accompanying README file.
|
8
8
|
*
|
@@ -106,11 +106,11 @@ JMESSAGE(JERR_QUANT_COMPONENTS,
|
|
106
106
|
"Cannot quantize more than %d color components")
|
107
107
|
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
|
108
108
|
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
|
109
|
+
JMESSAGE(JERR_SOF_BEFORE, "Invalid JPEG file structure: %s before SOF")
|
109
110
|
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
|
110
111
|
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
|
111
112
|
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
|
112
113
|
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
|
113
|
-
JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF")
|
114
114
|
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
|
115
115
|
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
|
116
116
|
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* jmorecfg.h
|
3
3
|
*
|
4
4
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
5
|
-
* Modified 1997-
|
5
|
+
* Modified 1997-2012 by Guido Vollbeding.
|
6
6
|
* This file is part of the Independent JPEG Group's software.
|
7
7
|
* For conditions of distribution and use, see the accompanying README file.
|
8
8
|
*
|
@@ -160,11 +160,13 @@ typedef short INT16;
|
|
160
160
|
|
161
161
|
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
162
162
|
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
|
163
|
+
#ifndef _BASETSD_H /* MinGW is slightly different */
|
163
164
|
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
|
164
165
|
typedef long INT32;
|
165
166
|
#endif
|
166
167
|
#endif
|
167
168
|
#endif
|
169
|
+
#endif
|
168
170
|
|
169
171
|
/* Datatype used for image dimensions. The JPEG standard only supports
|
170
172
|
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
@@ -208,6 +210,26 @@ typedef unsigned int JDIMENSION;
|
|
208
210
|
#endif
|
209
211
|
|
210
212
|
|
213
|
+
/* The noreturn type identifier is used to declare functions
|
214
|
+
* which cannot return.
|
215
|
+
* Compilers can thus create more optimized code and perform
|
216
|
+
* better checks for warnings and errors.
|
217
|
+
* Static analyzer tools can make improved inferences about
|
218
|
+
* execution paths and are prevented from giving false alerts.
|
219
|
+
*
|
220
|
+
* Unfortunately, the proposed specifications of corresponding
|
221
|
+
* extensions in the Dec 2011 ISO C standard revision (C11),
|
222
|
+
* GCC, MSVC, etc. are not viable.
|
223
|
+
* Thus we introduce a user defined type to declare noreturn
|
224
|
+
* functions at least for clarity. A proper compiler would
|
225
|
+
* have a suitable noreturn type to match in place of void.
|
226
|
+
*/
|
227
|
+
|
228
|
+
#ifndef HAVE_NORETURN_T
|
229
|
+
typedef void noreturn_t;
|
230
|
+
#endif
|
231
|
+
|
232
|
+
|
211
233
|
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
212
234
|
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
213
235
|
* by just saying "FAR *" where such a pointer is needed. In a few places
|
@@ -230,15 +252,16 @@ typedef unsigned int JDIMENSION;
|
|
230
252
|
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
|
231
253
|
*/
|
232
254
|
|
233
|
-
#
|
234
|
-
typedef int boolean;
|
235
|
-
#endif
|
255
|
+
#ifdef HAVE_BOOLEAN
|
236
256
|
#ifndef FALSE /* in case these macros already exist */
|
237
257
|
#define FALSE 0 /* values of boolean */
|
238
258
|
#endif
|
239
259
|
#ifndef TRUE
|
240
260
|
#define TRUE 1
|
241
261
|
#endif
|
262
|
+
#else
|
263
|
+
typedef enum { FALSE = 0, TRUE = 1 } boolean;
|
264
|
+
#endif
|
242
265
|
|
243
266
|
|
244
267
|
/*
|
@@ -310,9 +333,7 @@ typedef int boolean;
|
|
310
333
|
* the offsets will also change the order in which colormap data is organized.
|
311
334
|
* RESTRICTIONS:
|
312
335
|
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
313
|
-
* 2.
|
314
|
-
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
|
315
|
-
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
336
|
+
* 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
316
337
|
* is not 3 (they don't understand about dummy color components!). So you
|
317
338
|
* can't use color quantization if you change that value.
|
318
339
|
*/
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* jpeglib.h
|
3
3
|
*
|
4
4
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
5
|
-
* Modified 2002-
|
5
|
+
* Modified 2002-2012 by Guido Vollbeding.
|
6
6
|
* This file is part of the Independent JPEG Group's software.
|
7
7
|
* For conditions of distribution and use, see the accompanying README file.
|
8
8
|
*
|
@@ -33,11 +33,13 @@ extern "C" {
|
|
33
33
|
#endif
|
34
34
|
#endif
|
35
35
|
|
36
|
-
/* Version
|
37
|
-
* Might be useful for tests like "#if JPEG_LIB_VERSION >=
|
36
|
+
/* Version IDs for the JPEG library.
|
37
|
+
* Might be useful for tests like "#if JPEG_LIB_VERSION >= 90".
|
38
38
|
*/
|
39
39
|
|
40
|
-
#define JPEG_LIB_VERSION
|
40
|
+
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
41
|
+
#define JPEG_LIB_VERSION_MAJOR 9
|
42
|
+
#define JPEG_LIB_VERSION_MINOR 0
|
41
43
|
|
42
44
|
|
43
45
|
/* Various constants determining the sizes of things.
|
@@ -45,7 +47,7 @@ extern "C" {
|
|
45
47
|
* if you want to be compatible.
|
46
48
|
*/
|
47
49
|
|
48
|
-
#define DCTSIZE 8 /* The basic DCT block is 8x8
|
50
|
+
#define DCTSIZE 8 /* The basic DCT block is 8x8 coefficients */
|
49
51
|
#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */
|
50
52
|
#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */
|
51
53
|
#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */
|
@@ -171,7 +173,7 @@ typedef struct {
|
|
171
173
|
int MCU_width; /* number of blocks per MCU, horizontally */
|
172
174
|
int MCU_height; /* number of blocks per MCU, vertically */
|
173
175
|
int MCU_blocks; /* MCU_width * MCU_height */
|
174
|
-
int MCU_sample_width;
|
176
|
+
int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_scaled_size */
|
175
177
|
int last_col_width; /* # of non-dummy blocks across in last MCU */
|
176
178
|
int last_row_height; /* # of non-dummy blocks down in last MCU */
|
177
179
|
|
@@ -219,6 +221,13 @@ typedef enum {
|
|
219
221
|
JCS_YCCK /* Y/Cb/Cr/K */
|
220
222
|
} J_COLOR_SPACE;
|
221
223
|
|
224
|
+
/* Supported color transforms. */
|
225
|
+
|
226
|
+
typedef enum {
|
227
|
+
JCT_NONE = 0,
|
228
|
+
JCT_SUBTRACT_GREEN = 1
|
229
|
+
} J_COLOR_TRANSFORM;
|
230
|
+
|
222
231
|
/* DCT/IDCT algorithm options. */
|
223
232
|
|
224
233
|
typedef enum {
|
@@ -367,7 +376,10 @@ struct jpeg_compress_struct {
|
|
367
376
|
UINT16 X_density; /* Horizontal pixel density */
|
368
377
|
UINT16 Y_density; /* Vertical pixel density */
|
369
378
|
boolean write_Adobe_marker; /* should an Adobe marker be written? */
|
370
|
-
|
379
|
+
|
380
|
+
J_COLOR_TRANSFORM color_transform;
|
381
|
+
/* Color transform identifier, writes LSE marker if nonzero */
|
382
|
+
|
371
383
|
/* State variable: index of next scanline to be written to
|
372
384
|
* jpeg_write_scanlines(). Application may use this to control its
|
373
385
|
* processing loop, e.g., "while (next_scanline < image_height)".
|
@@ -414,6 +426,10 @@ struct jpeg_compress_struct {
|
|
414
426
|
|
415
427
|
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
416
428
|
|
429
|
+
int block_size; /* the basic DCT block size: 1..16 */
|
430
|
+
const int * natural_order; /* natural-order position array */
|
431
|
+
int lim_Se; /* min( Se, DCTSIZE2-1 ) */
|
432
|
+
|
417
433
|
/*
|
418
434
|
* Links to compression subobjects (methods and private variables of modules)
|
419
435
|
*/
|
@@ -560,6 +576,7 @@ struct jpeg_decompress_struct {
|
|
560
576
|
jpeg_component_info * comp_info;
|
561
577
|
/* comp_info[i] describes component that appears i'th in SOF */
|
562
578
|
|
579
|
+
boolean is_baseline; /* TRUE if Baseline SOF0 encountered */
|
563
580
|
boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
|
564
581
|
boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */
|
565
582
|
|
@@ -582,6 +599,9 @@ struct jpeg_decompress_struct {
|
|
582
599
|
boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
|
583
600
|
UINT8 Adobe_transform; /* Color transform code from Adobe marker */
|
584
601
|
|
602
|
+
J_COLOR_TRANSFORM color_transform;
|
603
|
+
/* Color transform identifier derived from LSE marker, otherwise zero */
|
604
|
+
|
585
605
|
boolean CCIR601_sampling; /* TRUE=first samples are cosited */
|
586
606
|
|
587
607
|
/* Aside from the specific data retained from APPn markers known to the
|
@@ -633,6 +653,12 @@ struct jpeg_decompress_struct {
|
|
633
653
|
|
634
654
|
int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */
|
635
655
|
|
656
|
+
/* These fields are derived from Se of first SOS marker.
|
657
|
+
*/
|
658
|
+
int block_size; /* the basic DCT block size: 1..16 */
|
659
|
+
const int * natural_order; /* natural-order position array for entropy decode */
|
660
|
+
int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */
|
661
|
+
|
636
662
|
/* This field is shared between entropy decoder and marker parser.
|
637
663
|
* It is either zero or the code of a JPEG marker that has been
|
638
664
|
* read from the data source, but has not yet been processed.
|
@@ -668,7 +694,7 @@ struct jpeg_decompress_struct {
|
|
668
694
|
|
669
695
|
struct jpeg_error_mgr {
|
670
696
|
/* Error exit handler: does not return to caller */
|
671
|
-
JMETHOD(
|
697
|
+
JMETHOD(noreturn_t, error_exit, (j_common_ptr cinfo));
|
672
698
|
/* Conditionally emit a trace or warning message */
|
673
699
|
JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
|
674
700
|
/* Routine that actually outputs a trace or error message */
|
@@ -862,6 +888,8 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
|
862
888
|
#define jpeg_destroy_decompress jDestDecompress
|
863
889
|
#define jpeg_stdio_dest jStdDest
|
864
890
|
#define jpeg_stdio_src jStdSrc
|
891
|
+
#define jpeg_mem_dest jMemDest
|
892
|
+
#define jpeg_mem_src jMemSrc
|
865
893
|
#define jpeg_set_defaults jSetDefaults
|
866
894
|
#define jpeg_set_colorspace jSetColorspace
|
867
895
|
#define jpeg_default_colorspace jDefColorspace
|
@@ -894,6 +922,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
|
894
922
|
#define jpeg_input_complete jInComplete
|
895
923
|
#define jpeg_new_colormap jNewCMap
|
896
924
|
#define jpeg_consume_input jConsumeInput
|
925
|
+
#define jpeg_core_output_dimensions jCoreDimensions
|
897
926
|
#define jpeg_calc_output_dimensions jCalcDimensions
|
898
927
|
#define jpeg_save_markers jSaveMarkers
|
899
928
|
#define jpeg_set_marker_processor jSetMarker
|
@@ -938,6 +967,14 @@ EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
|
|
938
967
|
EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
|
939
968
|
EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
|
940
969
|
|
970
|
+
/* Data source and destination managers: memory buffers. */
|
971
|
+
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
|
972
|
+
unsigned char ** outbuffer,
|
973
|
+
unsigned long * outsize));
|
974
|
+
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
|
975
|
+
unsigned char * inbuffer,
|
976
|
+
unsigned long insize));
|
977
|
+
|
941
978
|
/* Default parameter setup for compression */
|
942
979
|
EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
|
943
980
|
/* Compression parameter setup aids */
|
@@ -1032,6 +1069,7 @@ EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo));
|
|
1032
1069
|
#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
|
1033
1070
|
|
1034
1071
|
/* Precalculate output dimensions for current decompression parameters. */
|
1072
|
+
EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo));
|
1035
1073
|
EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
|
1036
1074
|
|
1037
1075
|
/* Control saving of COM and APPn markers into marker_list. */
|