pdfrb 0.7.17 → 0.7.19
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 +4 -4
- data/lib/pdfrb/model/cos/dictionary.rb +28 -2
- data/lib/pdfrb/model/type/action_go_to_3d_view.rb +1 -0
- data/lib/pdfrb/model/type/action_go_to_dp.rb +1 -0
- data/lib/pdfrb/model/type/action_go_to_r.rb +1 -0
- data/lib/pdfrb/model/type/action_goto.rb +15 -3
- data/lib/pdfrb/model/type/action_hide.rb +1 -0
- data/lib/pdfrb/model/type/action_import_data.rb +1 -0
- data/lib/pdfrb/model/type/action_java_script.rb +1 -0
- data/lib/pdfrb/model/type/action_launch.rb +1 -0
- data/lib/pdfrb/model/type/action_movie.rb +1 -0
- data/lib/pdfrb/model/type/action_named.rb +1 -0
- data/lib/pdfrb/model/type/action_nop.rb +1 -0
- data/lib/pdfrb/model/type/action_rendition.rb +1 -0
- data/lib/pdfrb/model/type/action_reset_form.rb +1 -0
- data/lib/pdfrb/model/type/action_set_ocg_state.rb +1 -0
- data/lib/pdfrb/model/type/action_set_state.rb +1 -0
- data/lib/pdfrb/model/type/action_submit_form.rb +1 -0
- data/lib/pdfrb/model/type/action_trans.rb +1 -0
- data/lib/pdfrb/model/type/action_uri.rb +1 -0
- data/lib/pdfrb/model/type/caret_annotation.rb +1 -0
- data/lib/pdfrb/model/type/circle_annotation.rb +1 -0
- data/lib/pdfrb/model/type/file_attachment_annotation.rb +1 -0
- data/lib/pdfrb/model/type/free_text_annotation.rb +1 -0
- data/lib/pdfrb/model/type/highlight_annotation.rb +1 -0
- data/lib/pdfrb/model/type/ink_annotation.rb +1 -0
- data/lib/pdfrb/model/type/line_annotation.rb +17 -4
- data/lib/pdfrb/model/type/link_annotation.rb +1 -0
- data/lib/pdfrb/model/type/polygon_annotation.rb +1 -0
- data/lib/pdfrb/model/type/polyline_annotation.rb +1 -0
- data/lib/pdfrb/model/type/popup_annotation.rb +1 -0
- data/lib/pdfrb/model/type/printer_mark_annotation.rb +1 -0
- data/lib/pdfrb/model/type/redact_annotation.rb +1 -0
- data/lib/pdfrb/model/type/rich_media_annotation.rb +1 -0
- data/lib/pdfrb/model/type/screen_annotation.rb +1 -0
- data/lib/pdfrb/model/type/sound_annotation.rb +1 -0
- data/lib/pdfrb/model/type/square_annotation.rb +1 -0
- data/lib/pdfrb/model/type/squiggly_annotation.rb +1 -0
- data/lib/pdfrb/model/type/stamp_annotation.rb +1 -0
- data/lib/pdfrb/model/type/strikeout_annotation.rb +1 -0
- data/lib/pdfrb/model/type/text_annotation.rb +1 -0
- data/lib/pdfrb/model/type/underline_annotation.rb +1 -0
- data/lib/pdfrb/model/type/watermark_annotation.rb +1 -0
- data/lib/pdfrb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ceb6a2eec5eb948c98085aaca1c41b6101dd5970201fd9fd93af5d4a749dfe6
|
|
4
|
+
data.tar.gz: 15b493786db9a355ee20c35a4975ceb81a36118c294a90fc429398f5029086da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2c9c5c3253f4b0b9546ad908af4dfc5439c57de7d4fc669059144f4f1410255a6aaa9fffa68ee77233796a192e574398c02994f7fa558a760e16d7c79a44869
|
|
7
|
+
data.tar.gz: b9aa959023df3ec4ed99d65c05b26b4717cf5260a00a0781daa20fda52cb88b7d4e700ca6f94f0987d35f58bdd534a41b3e5a0649a0d7f6d3f0f9a2a7e2d20d5
|
|
@@ -95,8 +95,8 @@ module Pdfrb
|
|
|
95
95
|
end
|
|
96
96
|
private :own_fields
|
|
97
97
|
|
|
98
|
-
def arlington_loaded_for?(
|
|
99
|
-
@arlington_loaded_name ==
|
|
98
|
+
def arlington_loaded_for?(arlington_name)
|
|
99
|
+
@arlington_loaded_name == arlington_name
|
|
100
100
|
end
|
|
101
101
|
private :arlington_loaded_for?
|
|
102
102
|
|
|
@@ -113,11 +113,23 @@ module Pdfrb
|
|
|
113
113
|
end
|
|
114
114
|
private :arlington_available?
|
|
115
115
|
|
|
116
|
+
# Merge Arlington field metadata with any hand-coded
|
|
117
|
+
# define_field declaration. Hand-coded fields win: if the
|
|
118
|
+
# class already declares this key explicitly (with a type),
|
|
119
|
+
# we rebuild the Field preserving the hand-coded
|
|
120
|
+
# type/default/required and only attach the Arlington def
|
|
121
|
+
# for reference.
|
|
116
122
|
def define_field_from_arlington(field_def)
|
|
117
123
|
types = arlington_types_to_ruby(field_def)
|
|
118
124
|
return if types.empty?
|
|
119
125
|
|
|
120
126
|
key = arlington_key_to_symbol(field_def.key)
|
|
127
|
+
existing = own_fields[key]
|
|
128
|
+
if existing
|
|
129
|
+
own_fields[key] = merged_field(existing, field_def)
|
|
130
|
+
return
|
|
131
|
+
end
|
|
132
|
+
|
|
121
133
|
define_field(
|
|
122
134
|
key,
|
|
123
135
|
type: types.length == 1 ? types.first : types,
|
|
@@ -129,6 +141,20 @@ module Pdfrb
|
|
|
129
141
|
end
|
|
130
142
|
private :define_field_from_arlington
|
|
131
143
|
|
|
144
|
+
def merged_field(existing, field_def)
|
|
145
|
+
Fields::Field.new(
|
|
146
|
+
existing.pdf_name,
|
|
147
|
+
type: existing.type,
|
|
148
|
+
required: existing.required,
|
|
149
|
+
default: existing.default,
|
|
150
|
+
indirect: existing.indirect,
|
|
151
|
+
allowed_values: existing.allowed_values,
|
|
152
|
+
version: arlington_version(field_def),
|
|
153
|
+
arlington: field_def
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
private :merged_field
|
|
157
|
+
|
|
132
158
|
def arlington_types_to_ruby(field_def)
|
|
133
159
|
field_def.types.map { |t| arlington_one_type_to_ruby(t) }.flatten.compact.uniq
|
|
134
160
|
end
|
|
@@ -6,6 +6,7 @@ module Pdfrb
|
|
|
6
6
|
# GoToDp action (s12.6.4.2, PDF 2.0). Destination pointer variant
|
|
7
7
|
# of GoTo that supports /DP (destination page) over a /D array.
|
|
8
8
|
class ActionGoToDp < Action
|
|
9
|
+
arlington_object "ActionGoToDp"
|
|
9
10
|
register_subtype :GoToDp
|
|
10
11
|
|
|
11
12
|
def destination_page; self[:DP]; end
|
|
@@ -5,12 +5,14 @@ module Pdfrb
|
|
|
5
5
|
module Type
|
|
6
6
|
# GoTo action (s12.6.4.2). Navigate to a destination.
|
|
7
7
|
class ActionGoTo < Action
|
|
8
|
+
arlington_object "ActionGoTo"
|
|
8
9
|
register_subtype :GoTo
|
|
9
10
|
|
|
10
11
|
def destination; self[:D]; end
|
|
11
12
|
|
|
12
13
|
def page_index_destination?
|
|
13
|
-
|
|
14
|
+
d = destination_array
|
|
15
|
+
!d.nil? && d.first.is_a?(Integer)
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
def named_destination?
|
|
@@ -20,13 +22,23 @@ module Pdfrb
|
|
|
20
22
|
def target_page_number
|
|
21
23
|
return nil unless page_index_destination?
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
destination_array.first
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def display_option
|
|
27
29
|
return nil unless page_index_destination?
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
destination_array[1..]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def destination_array
|
|
37
|
+
d = destination
|
|
38
|
+
return d.to_a if d.is_a?(Pdfrb::Model::PdfArray)
|
|
39
|
+
return d if d.is_a?(::Array)
|
|
40
|
+
|
|
41
|
+
nil
|
|
30
42
|
end
|
|
31
43
|
end
|
|
32
44
|
end
|
|
@@ -6,6 +6,7 @@ module Pdfrb
|
|
|
6
6
|
# Movie action (s12.6.4.8). Deprecated in PDF 2.0 but still
|
|
7
7
|
# appears in legacy PDFs. Plays/stops a Movie annotation.
|
|
8
8
|
class ActionMovie < Action
|
|
9
|
+
arlington_object "ActionMovie"
|
|
9
10
|
register_subtype :Movie
|
|
10
11
|
|
|
11
12
|
def annotation; self[:Annotation]; end
|
|
@@ -6,6 +6,7 @@ module Pdfrb
|
|
|
6
6
|
# File-attachment annotation (s12.5.6.15). Embedded file displayed
|
|
7
7
|
# as a paper-clip icon.
|
|
8
8
|
class FileAttachmentAnnotation < MarkupAnnotation
|
|
9
|
+
arlington_object "AnnotFileAttachment"
|
|
9
10
|
def embedded_file; self[:FS]; end
|
|
10
11
|
def name; self[:Name]; end
|
|
11
12
|
|
|
@@ -5,6 +5,7 @@ module Pdfrb
|
|
|
5
5
|
module Type
|
|
6
6
|
# Free-text annotation (s12.5.6.6). Text shown directly on the page.
|
|
7
7
|
class FreeTextAnnotation < MarkupAnnotation
|
|
8
|
+
arlington_object "AnnotFreeText"
|
|
8
9
|
def default_appearance; self[:DA]; end
|
|
9
10
|
def q; self[:Q]; end
|
|
10
11
|
def rc; self[:RC]; end
|
|
@@ -5,6 +5,7 @@ module Pdfrb
|
|
|
5
5
|
module Type
|
|
6
6
|
# Line annotation (s12.5.6.7). Line between two coordinate pairs.
|
|
7
7
|
class LineAnnotation < MarkupAnnotation
|
|
8
|
+
arlington_object "AnnotLine"
|
|
8
9
|
def line; self[:L]; end
|
|
9
10
|
def le; self[:LE]; end
|
|
10
11
|
def line_endings; le; end
|
|
@@ -20,15 +21,17 @@ module Pdfrb
|
|
|
20
21
|
def it; self[:IT]; end
|
|
21
22
|
|
|
22
23
|
def start_point
|
|
23
|
-
|
|
24
|
+
l = line_array
|
|
25
|
+
return nil unless l && l.size >= 2
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
l[0..1]
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
def end_point
|
|
29
|
-
|
|
31
|
+
l = line_array
|
|
32
|
+
return nil unless l && l.size >= 4
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
l[2..3]
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
def has_caption?
|
|
@@ -38,6 +41,16 @@ module Pdfrb
|
|
|
38
41
|
def has_measure?
|
|
39
42
|
!!measure
|
|
40
43
|
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def line_array
|
|
48
|
+
l = line
|
|
49
|
+
return l.to_a if l.is_a?(Pdfrb::Model::PdfArray)
|
|
50
|
+
return l if l.is_a?(::Array)
|
|
51
|
+
|
|
52
|
+
nil
|
|
53
|
+
end
|
|
41
54
|
end
|
|
42
55
|
end
|
|
43
56
|
end
|
|
@@ -5,6 +5,7 @@ module Pdfrb
|
|
|
5
5
|
module Type
|
|
6
6
|
# Polygon annotation (s12.5.6.9). Closed polygon shape.
|
|
7
7
|
class PolygonAnnotation < MarkupAnnotation
|
|
8
|
+
arlington_object "AnnotPolygon"
|
|
8
9
|
def vertices; self[:Vertices]; end
|
|
9
10
|
def line_endings; self[:LE]; end
|
|
10
11
|
def interior_color; self[:IC]; end
|
|
@@ -5,6 +5,7 @@ module Pdfrb
|
|
|
5
5
|
module Type
|
|
6
6
|
# Polyline annotation (s12.5.6.9). Open polyline (not closed).
|
|
7
7
|
class PolylineAnnotation < MarkupAnnotation
|
|
8
|
+
arlington_object "AnnotPolyLine"
|
|
8
9
|
def vertices; self[:Vertices]; end
|
|
9
10
|
def line_endings; self[:LE]; end
|
|
10
11
|
def interior_color; self[:IC]; end
|
|
@@ -5,6 +5,7 @@ module Pdfrb
|
|
|
5
5
|
module Type
|
|
6
6
|
# Redaction annotation (s12.5.6.16). Marks content for removal.
|
|
7
7
|
class RedactAnnotation < MarkupAnnotation
|
|
8
|
+
arlington_object "AnnotRedact"
|
|
8
9
|
def overlay_text; self[:OverlayText]; end
|
|
9
10
|
def repeat_overlay?; truthy?(self[:Repeat]); end
|
|
10
11
|
def quadding; self[:Q]; end
|
|
@@ -6,6 +6,7 @@ module Pdfrb
|
|
|
6
6
|
# Rich Media annotation (s12.5.6.20, PDF 1.7 ExtensionLevel 3 +
|
|
7
7
|
# PDF 2.0). Hosts interactive rich media content (Flash, video).
|
|
8
8
|
class RichMediaAnnotation < Annotation
|
|
9
|
+
arlington_object "AnnotRichMedia"
|
|
9
10
|
def rich_media_settings; self[:RichMediaSettings]; end
|
|
10
11
|
def rich_media_content; self[:RichMediaContent]; end
|
|
11
12
|
|
|
@@ -6,6 +6,7 @@ module Pdfrb
|
|
|
6
6
|
# Screen annotation (s12.5.6.18). Holds media played via Action
|
|
7
7
|
# triggers. /Subtype /Screen.
|
|
8
8
|
class ScreenAnnotation < Annotation
|
|
9
|
+
arlington_object "AnnotScreen"
|
|
9
10
|
def attachment_point; self[:AP]; end
|
|
10
11
|
def media_type; self[:T]; end
|
|
11
12
|
def actions; self[:AA]; end
|
|
@@ -6,6 +6,7 @@ module Pdfrb
|
|
|
6
6
|
# Watermark annotation (s12.5.6.23). PDF 2.0. Non-printing,
|
|
7
7
|
# non-interactive visual watermark behind/over page content.
|
|
8
8
|
class WatermarkAnnotation < Annotation
|
|
9
|
+
arlington_object "AnnotWatermark"
|
|
9
10
|
def fixed_print?; !!value[:FixedPrint]; end
|
|
10
11
|
end
|
|
11
12
|
end
|
data/lib/pdfrb/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pdfrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|