pdfrb 0.7.18 → 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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pdfrb/model/type/action_go_to_3d_view.rb +1 -0
  3. data/lib/pdfrb/model/type/action_go_to_dp.rb +1 -0
  4. data/lib/pdfrb/model/type/action_go_to_r.rb +1 -0
  5. data/lib/pdfrb/model/type/action_goto.rb +15 -3
  6. data/lib/pdfrb/model/type/action_hide.rb +1 -0
  7. data/lib/pdfrb/model/type/action_import_data.rb +1 -0
  8. data/lib/pdfrb/model/type/action_java_script.rb +1 -0
  9. data/lib/pdfrb/model/type/action_launch.rb +1 -0
  10. data/lib/pdfrb/model/type/action_movie.rb +1 -0
  11. data/lib/pdfrb/model/type/action_named.rb +1 -0
  12. data/lib/pdfrb/model/type/action_nop.rb +1 -0
  13. data/lib/pdfrb/model/type/action_rendition.rb +1 -0
  14. data/lib/pdfrb/model/type/action_reset_form.rb +1 -0
  15. data/lib/pdfrb/model/type/action_set_ocg_state.rb +1 -0
  16. data/lib/pdfrb/model/type/action_set_state.rb +1 -0
  17. data/lib/pdfrb/model/type/action_submit_form.rb +1 -0
  18. data/lib/pdfrb/model/type/action_trans.rb +1 -0
  19. data/lib/pdfrb/model/type/action_uri.rb +1 -0
  20. data/lib/pdfrb/model/type/caret_annotation.rb +1 -0
  21. data/lib/pdfrb/model/type/circle_annotation.rb +1 -0
  22. data/lib/pdfrb/model/type/file_attachment_annotation.rb +1 -0
  23. data/lib/pdfrb/model/type/free_text_annotation.rb +1 -0
  24. data/lib/pdfrb/model/type/highlight_annotation.rb +1 -0
  25. data/lib/pdfrb/model/type/ink_annotation.rb +1 -0
  26. data/lib/pdfrb/model/type/line_annotation.rb +17 -4
  27. data/lib/pdfrb/model/type/link_annotation.rb +1 -0
  28. data/lib/pdfrb/model/type/polygon_annotation.rb +1 -0
  29. data/lib/pdfrb/model/type/polyline_annotation.rb +1 -0
  30. data/lib/pdfrb/model/type/popup_annotation.rb +1 -0
  31. data/lib/pdfrb/model/type/printer_mark_annotation.rb +1 -0
  32. data/lib/pdfrb/model/type/redact_annotation.rb +1 -0
  33. data/lib/pdfrb/model/type/rich_media_annotation.rb +1 -0
  34. data/lib/pdfrb/model/type/screen_annotation.rb +1 -0
  35. data/lib/pdfrb/model/type/sound_annotation.rb +1 -0
  36. data/lib/pdfrb/model/type/square_annotation.rb +1 -0
  37. data/lib/pdfrb/model/type/squiggly_annotation.rb +1 -0
  38. data/lib/pdfrb/model/type/stamp_annotation.rb +1 -0
  39. data/lib/pdfrb/model/type/strikeout_annotation.rb +1 -0
  40. data/lib/pdfrb/model/type/text_annotation.rb +1 -0
  41. data/lib/pdfrb/model/type/underline_annotation.rb +1 -0
  42. data/lib/pdfrb/model/type/watermark_annotation.rb +1 -0
  43. data/lib/pdfrb/version.rb +1 -1
  44. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10ae262fc764f359b2eebcfa7384fd94fb41094fc906987fcba0f254fecd0e11
4
- data.tar.gz: 6ca04beff81f5a83621caeeff912aa0d4dd4268e1141a8aa8b49479a0efa2465
3
+ metadata.gz: 4ceb6a2eec5eb948c98085aaca1c41b6101dd5970201fd9fd93af5d4a749dfe6
4
+ data.tar.gz: 15b493786db9a355ee20c35a4975ceb81a36118c294a90fc429398f5029086da
5
5
  SHA512:
6
- metadata.gz: c301c11937103aadbbc335c10649dd2bc8dd5d2b0b12d6673a8b43f5d3961f54362f4fcc8433e69a82fcabc7f2f9c4b123025b556892e9ba423f3af88a59695b
7
- data.tar.gz: f9a1cebbde8c0465ae6574d744aa0b4eb059e4e4f594aef81d59f377209fdbc11c7fcf7db2431ff460ea80e211e807b806fbf02b59e6ecd2167c4ee707dabbb7
6
+ metadata.gz: a2c9c5c3253f4b0b9546ad908af4dfc5439c57de7d4fc669059144f4f1410255a6aaa9fffa68ee77233796a192e574398c02994f7fa558a760e16d7c79a44869
7
+ data.tar.gz: b9aa959023df3ec4ed99d65c05b26b4717cf5260a00a0781daa20fda52cb88b7d4e700ca6f94f0987d35f58bdd534a41b3e5a0649a0d7f6d3f0f9a2a7e2d20d5
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # GoTo3DView action (s12.6.4.12, PDF 1.6+). Navigate within a 3D stream.
7
7
  class ActionGoTo3DView < Action
8
+ arlington_object "ActionGoTo3DView"
8
9
  register_subtype :GoTo3DView
9
10
 
10
11
  def target_view; self[:TA]; 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
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Remote GoTo action (s12.6.4.3). Navigate to a destination in
7
7
  # another PDF file.
8
8
  class ActionGoToR < Action
9
+ arlington_object "ActionGoToR"
9
10
  register_subtype :GoToR
10
11
 
11
12
  def file_spec; self[:F]; 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
- destination.is_a?(Array) && destination.first.is_a?(Integer)
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
- destination.first
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
- destination[1..]
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
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Hide action (s12.6.4.10). Show/hide annotations.
7
7
  class ActionHide < Action
8
+ arlington_object "ActionHide"
8
9
  register_subtype :Hide
9
10
 
10
11
  def targets; self[:T]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Import-data action (s12.7.6.4). Imports form data from an FDF/XFDF file.
7
7
  class ActionImportData < Action
8
+ arlington_object "ActionImportData"
8
9
  register_subtype :ImportData
9
10
 
10
11
  def file_spec; self[:F]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # JavaScript action (s12.6.4.16). Execute JavaScript code.
7
7
  class ActionJavaScript < Action
8
+ arlington_object "ActionECMAScript"
8
9
  register_subtype :JavaScript
9
10
 
10
11
  def script; self[:JS]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Launch action (s12.6.4.5). Launch an external application.
7
7
  class ActionLaunch < Action
8
+ arlington_object "ActionLaunch"
8
9
  register_subtype :Launch
9
10
 
10
11
  def file_spec; self[:F]; 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
  # Named action (s12.6.4.19). Pre-defined action by name (NextPage,
7
7
  # PrevPage, FirstPage, LastPage, Print, etc.).
8
8
  class ActionNamed < Action
9
+ arlington_object "ActionNamed"
9
10
  register_subtype :Named
10
11
 
11
12
  def action_name; self[:N]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # NOP action (PDF 1.2 deprecated). No-op placeholder.
7
7
  class ActionNOP < Action
8
+ arlington_object "ActionNOP"
8
9
  register_subtype :NOP
9
10
  end
10
11
  end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Rendition action (s12.6.4.12). Controls multimedia rendition
7
7
  # on screen annotations.
8
8
  class ActionRendition < Action
9
+ arlington_object "ActionRendition"
9
10
  register_subtype :Rendition
10
11
 
11
12
  def rendition; self[:R]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Reset-form action (s12.7.6.3). Resets form fields to defaults.
7
7
  class ActionResetForm < Action
8
+ arlington_object "ActionResetForm"
8
9
  register_subtype :ResetForm
9
10
 
10
11
  def fields; self[:Fields]; end
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Set OCG State action (s12.6.4.13). Toggle visibility of
7
7
  # optional-content groups.
8
8
  class ActionSetOCGState < Action
9
+ arlington_object "ActionSetOCGState"
9
10
  register_subtype :SetOCGState
10
11
 
11
12
  def state; self[:State]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Set-state action (deprecated in PDF 1.2, replaced by SetOCGState).
7
7
  class ActionSetState < Action
8
+ arlington_object "ActionSetState"
8
9
  register_subtype :SetState
9
10
 
10
11
  def state; self[:State]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Submit-form action (s12.7.6.2). Submits form values to a URL.
7
7
  class ActionSubmitForm < Action
8
+ arlington_object "ActionSubmitForm"
8
9
  register_subtype :SubmitForm
9
10
 
10
11
  def url; self[:F]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Transition action (s12.4.3). Specifies page transition for slide-show.
7
7
  class ActionTrans < Action
8
+ arlington_object "ActionTransition"
8
9
  register_subtype :Trans
9
10
 
10
11
  def transition; self[:Trans]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # URI action (s12.6.4.7). Opens a URL in the browser.
7
7
  class ActionURI < Action
8
+ arlington_object "ActionURI"
8
9
  register_subtype :URI
9
10
 
10
11
  def uri; self[:URI]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Caret annotation (s12.5.6.11). Text-insertion indicator.
7
7
  class CaretAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotCaret"
8
9
  def rd; self[:RD]; end
9
10
  def sy; self[:Sy]; end
10
11
 
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Circle / ellipse annotation (s12.5.6.8).
7
7
  class CircleAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotCircle"
8
9
  def border_effect; self[:BE]; end
9
10
  def interior_color; self[:IC]; end
10
11
  def border_style; self[:BS]; 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
  # Highlight annotation. /Subtype /Highlight.
7
7
  class HighlightAnnotation < TextMarkupAnnotation
8
+ arlington_object "AnnotHighlight"
8
9
  end
9
10
  end
10
11
  end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Ink annotation (s12.5.6.13). Freehand scribble path(s).
7
7
  class InkAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotInk"
8
9
  def ink_list; self[:InkList]; end
9
10
  def interior_color; self[:IC]; end
10
11
  def border_style; self[:BS]; 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
- return nil unless line.is_a?(Array) && line.size >= 2
24
+ l = line_array
25
+ return nil unless l && l.size >= 2
24
26
 
25
- line[0..1]
27
+ l[0..1]
26
28
  end
27
29
 
28
30
  def end_point
29
- return nil unless line.is_a?(Array) && line.size >= 4
31
+ l = line_array
32
+ return nil unless l && l.size >= 4
30
33
 
31
- line[2..3]
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
@@ -4,6 +4,7 @@ module Pdfrb
4
4
  module Model
5
5
  module Type
6
6
  class LinkAnnotation < Annotation
7
+ arlington_object "AnnotLink"
7
8
  def action; self[:A]; end
8
9
  def destination; self[:Dest]; end
9
10
  def highlight_mode; self[:H]; 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
  # Popup annotation (s12.5.6.14). Displays text/markup in a pop-up window.
7
7
  class PopupAnnotation < Annotation
8
+ arlington_object "AnnotPopup"
8
9
  def parent; self[:Parent]; end
9
10
  def open?; !!value[:Open]; end
10
11
 
@@ -6,6 +6,7 @@ module Pdfrb
6
6
  # Printer-mark annotation (s12.5.6.17). Marks page for trimming,
7
7
  # registration, etc.
8
8
  class PrinterMarkAnnotation < Annotation
9
+ arlington_object "AnnotPrinterMark"
9
10
  def mark_subtype; self[:MN]; end
10
11
  end
11
12
  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
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Sound annotation (s12.5.6.18). Sound clip embedded in the page.
7
7
  class SoundAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotSound"
8
9
  def sound; self[:Sound]; end
9
10
  def name; self[:Name]; end
10
11
 
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Square / rectangle annotation (s12.5.6.8).
7
7
  class SquareAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotSquare"
8
9
  def border_effect; self[:BE]; end
9
10
  def interior_color; self[:IC]; end
10
11
  def border_style; self[:BS]; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Squiggly annotation. /Subtype /Squiggly.
7
7
  class SquigglyAnnotation < TextMarkupAnnotation
8
+ arlington_object "AnnotSquiggly"
8
9
  end
9
10
  end
10
11
  end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Rubber-stamp annotation (s12.5.6.14).
7
7
  class StampAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotStamp"
8
9
  def name; self[:Name]; end
9
10
  def interior_color; self[:IC]; end
10
11
  def rotation; self[:Rotate] || 0; end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # StrikeOut annotation. /Subtype /StrikeOut.
7
7
  class StrikeOutAnnotation < TextMarkupAnnotation
8
+ arlington_object "AnnotStrikeOut"
8
9
  end
9
10
  end
10
11
  end
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Sticky note annotation (s12.5.6.10).
7
7
  class TextAnnotation < MarkupAnnotation
8
+ arlington_object "AnnotText"
8
9
  def state; self[:State]; end
9
10
  def state_model; self[:StateModel]; end
10
11
 
@@ -5,6 +5,7 @@ module Pdfrb
5
5
  module Type
6
6
  # Underline annotation. /Subtype /Underline.
7
7
  class UnderlineAnnotation < TextMarkupAnnotation
8
+ arlington_object "AnnotUnderline"
8
9
  end
9
10
  end
10
11
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pdfrb
4
- VERSION = "0.7.18"
4
+ VERSION = "0.7.19"
5
5
  end
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.18
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-16 00:00:00.000000000 Z
11
+ date: 2026-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor