poppler 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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
- metadata +53 -27
@@ -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/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
metadata
CHANGED
@@ -1,16 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poppler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- The Ruby-GNOME2 Project Team
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
-
dependencies:
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cairo
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.12.8
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.12.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gdk_pixbuf2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.3
|
14
41
|
description: Ruby/Poppler is a Ruby binding of poppler-glib.
|
15
42
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
16
43
|
executables: []
|
@@ -26,30 +53,30 @@ files:
|
|
26
53
|
- ext/poppler/extconf.rb
|
27
54
|
- ext/poppler/poppler.def
|
28
55
|
- ext/poppler/rbpoppler-action.c
|
56
|
+
- ext/poppler/rbpoppler-annotation-callout-line.c
|
57
|
+
- ext/poppler/rbpoppler-annotation-free-text.c
|
58
|
+
- ext/poppler/rbpoppler-annotation-mapping.c
|
59
|
+
- ext/poppler/rbpoppler-annotation-markup.c
|
60
|
+
- ext/poppler/rbpoppler-annotation-text.c
|
29
61
|
- ext/poppler/rbpoppler-annotation.c
|
30
|
-
- ext/poppler/rbpoppler-annotationcalloutline.c
|
31
|
-
- ext/poppler/rbpoppler-annotationfreetext.c
|
32
|
-
- ext/poppler/rbpoppler-annotationmapping.c
|
33
|
-
- ext/poppler/rbpoppler-annotationmarkup.c
|
34
|
-
- ext/poppler/rbpoppler-annotationtext.c
|
35
62
|
- ext/poppler/rbpoppler-attachment.c
|
36
|
-
- ext/poppler/rbpoppler-
|
37
|
-
- ext/poppler/rbpoppler-
|
63
|
+
- ext/poppler/rbpoppler-button-field.c
|
64
|
+
- ext/poppler/rbpoppler-choice-field.c
|
38
65
|
- ext/poppler/rbpoppler-color.c
|
39
66
|
- ext/poppler/rbpoppler-document.c
|
40
|
-
- ext/poppler/rbpoppler-
|
41
|
-
- ext/poppler/rbpoppler-
|
67
|
+
- ext/poppler/rbpoppler-font-info.c
|
68
|
+
- ext/poppler/rbpoppler-fonts-iter.c
|
69
|
+
- ext/poppler/rbpoppler-form-field-mapping.c
|
42
70
|
- ext/poppler/rbpoppler-form-field.c
|
43
|
-
- ext/poppler/rbpoppler-
|
44
|
-
- ext/poppler/rbpoppler-
|
45
|
-
- ext/poppler/rbpoppler-
|
46
|
-
- ext/poppler/rbpoppler-
|
71
|
+
- ext/poppler/rbpoppler-image-mapping.c
|
72
|
+
- ext/poppler/rbpoppler-index-iter.c
|
73
|
+
- ext/poppler/rbpoppler-link-mapping.c
|
74
|
+
- ext/poppler/rbpoppler-page-transition.c
|
47
75
|
- ext/poppler/rbpoppler-page.c
|
48
|
-
- ext/poppler/rbpoppler-pagetransition.c
|
49
76
|
- ext/poppler/rbpoppler-private.h
|
50
|
-
- ext/poppler/rbpoppler-
|
77
|
+
- ext/poppler/rbpoppler-ps-file.c
|
51
78
|
- ext/poppler/rbpoppler-rectangle.c
|
52
|
-
- ext/poppler/rbpoppler-
|
79
|
+
- ext/poppler/rbpoppler-text-field.c
|
53
80
|
- ext/poppler/rbpoppler.c
|
54
81
|
- ext/poppler/rbpoppler.h
|
55
82
|
- ext/poppler/rbpopplerconversions.h
|
@@ -70,26 +97,25 @@ files:
|
|
70
97
|
- test/test_page.rb
|
71
98
|
homepage: http://ruby-gnome2.sourceforge.jp/
|
72
99
|
licenses: []
|
100
|
+
metadata: {}
|
73
101
|
post_install_message:
|
74
102
|
rdoc_options: []
|
75
103
|
require_paths:
|
76
104
|
- lib
|
77
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
106
|
requirements:
|
80
|
-
- -
|
107
|
+
- - '>='
|
81
108
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
109
|
+
version: 1.9.3
|
83
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
111
|
requirements:
|
86
|
-
- -
|
112
|
+
- - '>='
|
87
113
|
- !ruby/object:Gem::Version
|
88
114
|
version: '0'
|
89
115
|
requirements: []
|
90
116
|
rubyforge_project:
|
91
|
-
rubygems_version:
|
117
|
+
rubygems_version: 2.0.14
|
92
118
|
signing_key:
|
93
|
-
specification_version:
|
119
|
+
specification_version: 4
|
94
120
|
summary: Ruby/Poppler is a Ruby binding of poppler-glib.
|
95
121
|
test_files: []
|