pdf-reader 2.2.0 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +90 -0
  3. data/README.md +18 -3
  4. data/Rakefile +1 -1
  5. data/bin/pdf_callbacks +1 -1
  6. data/bin/pdf_text +1 -1
  7. data/examples/extract_fonts.rb +12 -7
  8. data/examples/rspec.rb +1 -0
  9. data/lib/pdf/reader/aes_v2_security_handler.rb +41 -0
  10. data/lib/pdf/reader/aes_v3_security_handler.rb +38 -0
  11. data/lib/pdf/reader/afm/Courier-Bold.afm +342 -342
  12. data/lib/pdf/reader/afm/Courier-BoldOblique.afm +342 -342
  13. data/lib/pdf/reader/afm/Courier-Oblique.afm +342 -342
  14. data/lib/pdf/reader/afm/Courier.afm +342 -342
  15. data/lib/pdf/reader/afm/Helvetica-Bold.afm +2827 -2827
  16. data/lib/pdf/reader/afm/Helvetica-BoldOblique.afm +2827 -2827
  17. data/lib/pdf/reader/afm/Helvetica-Oblique.afm +3051 -3051
  18. data/lib/pdf/reader/afm/Helvetica.afm +3051 -3051
  19. data/lib/pdf/reader/afm/MustRead.html +19 -0
  20. data/lib/pdf/reader/afm/Symbol.afm +213 -213
  21. data/lib/pdf/reader/afm/Times-Bold.afm +2588 -2588
  22. data/lib/pdf/reader/afm/Times-BoldItalic.afm +2384 -2384
  23. data/lib/pdf/reader/afm/Times-Italic.afm +2667 -2667
  24. data/lib/pdf/reader/afm/Times-Roman.afm +2419 -2419
  25. data/lib/pdf/reader/afm/ZapfDingbats.afm +225 -225
  26. data/lib/pdf/reader/bounding_rectangle_runs_filter.rb +16 -0
  27. data/lib/pdf/reader/buffer.rb +91 -47
  28. data/lib/pdf/reader/cid_widths.rb +7 -4
  29. data/lib/pdf/reader/cmap.rb +83 -59
  30. data/lib/pdf/reader/encoding.rb +17 -14
  31. data/lib/pdf/reader/error.rb +15 -3
  32. data/lib/pdf/reader/filter/ascii85.rb +7 -1
  33. data/lib/pdf/reader/filter/ascii_hex.rb +6 -1
  34. data/lib/pdf/reader/filter/depredict.rb +12 -10
  35. data/lib/pdf/reader/filter/flate.rb +30 -16
  36. data/lib/pdf/reader/filter/lzw.rb +2 -0
  37. data/lib/pdf/reader/filter/null.rb +1 -1
  38. data/lib/pdf/reader/filter/run_length.rb +19 -13
  39. data/lib/pdf/reader/filter.rb +11 -11
  40. data/lib/pdf/reader/font.rb +89 -26
  41. data/lib/pdf/reader/font_descriptor.rb +22 -18
  42. data/lib/pdf/reader/form_xobject.rb +18 -5
  43. data/lib/pdf/reader/glyph_hash.rb +28 -13
  44. data/lib/pdf/reader/glyphlist-zapfdingbats.txt +245 -0
  45. data/lib/pdf/reader/key_builder_v5.rb +138 -0
  46. data/lib/pdf/reader/lzw.rb +28 -11
  47. data/lib/pdf/reader/no_text_filter.rb +14 -0
  48. data/lib/pdf/reader/null_security_handler.rb +1 -4
  49. data/lib/pdf/reader/object_cache.rb +1 -0
  50. data/lib/pdf/reader/object_hash.rb +292 -63
  51. data/lib/pdf/reader/object_stream.rb +3 -2
  52. data/lib/pdf/reader/overlapping_runs_filter.rb +72 -0
  53. data/lib/pdf/reader/page.rb +143 -16
  54. data/lib/pdf/reader/page_layout.rb +43 -39
  55. data/lib/pdf/reader/page_state.rb +26 -17
  56. data/lib/pdf/reader/page_text_receiver.rb +74 -4
  57. data/lib/pdf/reader/pages_strategy.rb +1 -0
  58. data/lib/pdf/reader/parser.rb +34 -14
  59. data/lib/pdf/reader/point.rb +25 -0
  60. data/lib/pdf/reader/print_receiver.rb +1 -0
  61. data/lib/pdf/reader/rc4_security_handler.rb +38 -0
  62. data/lib/pdf/reader/rectangle.rb +113 -0
  63. data/lib/pdf/reader/reference.rb +3 -1
  64. data/lib/pdf/reader/register_receiver.rb +1 -0
  65. data/lib/pdf/reader/{resource_methods.rb → resources.rb} +17 -9
  66. data/lib/pdf/reader/security_handler_factory.rb +79 -0
  67. data/lib/pdf/reader/{standard_security_handler.rb → standard_key_builder.rb} +23 -94
  68. data/lib/pdf/reader/stream.rb +3 -2
  69. data/lib/pdf/reader/synchronized_cache.rb +1 -0
  70. data/lib/pdf/reader/text_run.rb +40 -5
  71. data/lib/pdf/reader/token.rb +1 -0
  72. data/lib/pdf/reader/transformation_matrix.rb +8 -7
  73. data/lib/pdf/reader/type_check.rb +98 -0
  74. data/lib/pdf/reader/unimplemented_security_handler.rb +1 -0
  75. data/lib/pdf/reader/validating_receiver.rb +262 -0
  76. data/lib/pdf/reader/width_calculator/built_in.rb +27 -17
  77. data/lib/pdf/reader/width_calculator/composite.rb +6 -1
  78. data/lib/pdf/reader/width_calculator/true_type.rb +10 -11
  79. data/lib/pdf/reader/width_calculator/type_one_or_three.rb +6 -4
  80. data/lib/pdf/reader/width_calculator/type_zero.rb +6 -2
  81. data/lib/pdf/reader/width_calculator.rb +1 -0
  82. data/lib/pdf/reader/xref.rb +37 -11
  83. data/lib/pdf/reader/zero_width_runs_filter.rb +13 -0
  84. data/lib/pdf/reader.rb +49 -24
  85. data/lib/pdf-reader.rb +1 -0
  86. data/rbi/pdf-reader.rbi +2048 -0
  87. metadata +39 -23
  88. data/lib/pdf/hash.rb +0 -20
  89. data/lib/pdf/reader/orientation_detector.rb +0 -34
  90. data/lib/pdf/reader/standard_security_handler_v5.rb +0 -91
@@ -0,0 +1,2048 @@
1
+ # typed: strong
2
+ module PDF
3
+ class Reader
4
+ sig { returns(PDF::Reader::ObjectHash) }
5
+ attr_reader :objects
6
+
7
+ sig { params(input: T.any(String, Tempfile, IO), opts: T::Hash[T.untyped, T.untyped]).void }
8
+ def initialize(input, opts = {})
9
+ @cache = T.let(T.unsafe(nil), PDF::Reader::ObjectCache)
10
+ @objects = T.let(T.unsafe(nil), PDF::Reader::ObjectHash)
11
+ @page_count = T.let(T.unsafe(nil), T.nilable(Integer))
12
+ @root = T.let(T.unsafe(nil), T.nilable(T.nilable(T::Hash[Symbol, T.untyped])))
13
+ end
14
+
15
+ sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
16
+ def info; end
17
+
18
+ sig { returns(T.nilable(String)) }
19
+ def metadata; end
20
+
21
+ sig { returns(Integer) }
22
+ def page_count; end
23
+
24
+ sig { returns(Float) }
25
+ def pdf_version; end
26
+
27
+ sig { params(input: T.any(String, Tempfile, IO), opts: T::Hash[T.untyped, T.untyped], block: T.proc.params(arg0: PDF::Reader).void).returns(T.untyped) }
28
+ def self.open(input, opts = {}, &block); end
29
+
30
+ sig { returns(T::Array[PDF::Reader::Page]) }
31
+ def pages; end
32
+
33
+ sig { params(num: Integer).returns(PDF::Reader::Page) }
34
+ def page(num); end
35
+
36
+ sig { params(obj: T.untyped).returns(T.untyped) }
37
+ def doc_strings_to_utf8(obj); end
38
+
39
+ sig { params(str: String).returns(T::Boolean)}
40
+ def has_utf16_bom?(str); end
41
+
42
+ sig { params(obj: String).returns(String) }
43
+ def pdfdoc_to_utf8(obj); end
44
+
45
+ sig { params(obj: String).returns(String) }
46
+ def utf16_to_utf8(obj); end
47
+
48
+ sig { returns(T::Hash[Symbol, T.untyped]) }
49
+ def root; end
50
+
51
+ class AesV2SecurityHandler
52
+ sig { params(key: String).void }
53
+ def initialize(key)
54
+ @encrypt_key = T.let(T.unsafe(nil), String)
55
+ end
56
+
57
+ sig { params(buf: String, ref: PDF::Reader::Reference).returns(String) }
58
+ def decrypt(buf, ref); end
59
+ end
60
+
61
+ class AesV3SecurityHandler
62
+ sig { params(key: String).void }
63
+ def initialize(key)
64
+ @encrypt_key = T.let(T.unsafe(nil), String)
65
+ @cipher = T.let(T.unsafe(nil), String)
66
+ end
67
+
68
+ sig { params(buf: String, ref: PDF::Reader::Reference).returns(String) }
69
+ def decrypt(buf, ref); end
70
+ end
71
+
72
+ class BoundingRectangleRunsFilter
73
+ sig { params(runs: T::Array[PDF::Reader::TextRun], rect: PDF::Reader::Rectangle).returns(T::Array[PDF::Reader::TextRun]) }
74
+ def self.runs_within_rect(runs, rect); end
75
+ end
76
+
77
+ class Buffer
78
+ TOKEN_WHITESPACE = T.let(T.unsafe(nil), T::Array[Integer])
79
+ TOKEN_DELIMITER = T.let(T.unsafe(nil), T::Array[Integer])
80
+ LEFT_PAREN = T.let(T.unsafe(nil), String)
81
+ LESS_THAN = T.let(T.unsafe(nil), String)
82
+ STREAM = T.let(T.unsafe(nil), String)
83
+ ID = T.let(T.unsafe(nil), String)
84
+ FWD_SLASH = T.let(T.unsafe(nil), String)
85
+ NULL_BYTE = T.let(T.unsafe(nil), String)
86
+ CR = T.let(T.unsafe(nil), String)
87
+ LF = T.let(T.unsafe(nil), String)
88
+ CRLF = T.let(T.unsafe(nil), String)
89
+ WHITE_SPACE = T.let(T.unsafe(nil), T::Array[String])
90
+ TRAILING_BYTECOUNT = T.let(T.unsafe(nil), Integer)
91
+ DIGITS_ONLY = T.let(T.unsafe(nil), Regexp)
92
+
93
+ sig { returns(Integer) }
94
+ attr_reader :pos
95
+
96
+ sig { params(io: T.any(StringIO, Tempfile, IO), opts: T::Hash[Symbol, T.untyped]).void }
97
+ def initialize(io, opts = {})
98
+ @pos = T.let(T.unsafe(nil), Integer)
99
+ @tokens = T.let(T.unsafe(nil), T::Array[T.any(String, PDF::Reader::Reference)])
100
+ @io = T.let(T.unsafe(nil), T.any(StringIO, Tempfile, IO))
101
+ @in_content_stream = T.let(T.unsafe(nil), T::Boolean)
102
+ end
103
+
104
+ sig { returns(T::Boolean) }
105
+ def empty?; end
106
+
107
+ sig { params(bytes: Integer, opts: T::Hash[Symbol, T.untyped]).returns(T.nilable(String)) }
108
+ def read(bytes, opts = {}); end
109
+
110
+ sig { returns(T.any(NilClass, String, PDF::Reader::Reference)) }
111
+ def token; end
112
+
113
+ sig { returns(Integer) }
114
+ def find_first_xref_offset; end
115
+
116
+ sig { void }
117
+ def check_size_is_non_zero; end
118
+
119
+ sig { returns(T::Boolean) }
120
+ def in_content_stream?; end
121
+
122
+ sig { void }
123
+ def reset_pos; end
124
+
125
+ sig { void }
126
+ def save_pos; end
127
+
128
+ sig { void }
129
+ def prepare_tokens; end
130
+
131
+ sig { returns(Symbol) }
132
+ def state; end
133
+
134
+ sig { void }
135
+ def merge_indirect_reference; end
136
+
137
+ sig { void }
138
+ def prepare_inline_token; end
139
+
140
+ sig { void }
141
+ def prepare_hex_token; end
142
+
143
+ sig { void }
144
+ def prepare_literal_token; end
145
+
146
+ sig { void }
147
+ def prepare_regular_token; end
148
+
149
+ sig { returns(T.nilable(Integer)) }
150
+ def peek_byte; end
151
+ end
152
+
153
+ class CidWidths
154
+ sig { params(default: Numeric, array: T::Array[Numeric]).void }
155
+ def initialize(default, array)
156
+ @widths = T.let(T.unsafe(nil), T::Hash[Numeric, Numeric])
157
+ end
158
+
159
+ sig { params(default: Numeric, array: T::Array[Numeric]).returns(T::Hash[Numeric, Numeric]) }
160
+ def parse_array(default, array); end
161
+
162
+ sig { params(first: Integer, widths: T::Array[Numeric]).returns(T::Hash[Numeric, Numeric]) }
163
+ def parse_first_form(first, widths); end
164
+
165
+ sig { params(first: Integer, final: Integer, width: Numeric).returns(T::Hash[Numeric, Numeric]) }
166
+ def parse_second_form(first, final, width); end
167
+ end
168
+
169
+ class CMap
170
+ CMAP_KEYWORDS = T.let(T.unsafe(nil), T::Hash[String, Symbol])
171
+
172
+ sig { returns(T.untyped) }
173
+ attr_reader :map
174
+
175
+ sig { params(data: String).void }
176
+ def initialize(data)
177
+ @map = T.let(T.unsafe(nil), T::Hash[Integer, T::Array[Integer]])
178
+ end
179
+
180
+ sig { params(data: String, initial_mode: Symbol).void }
181
+ def process_data(data, initial_mode = :none); end
182
+
183
+ sig { returns(Integer) }
184
+ def size; end
185
+
186
+ sig { params(c: Integer).returns(T::Array[Integer]) }
187
+ def decode(c); end
188
+
189
+ sig { params(instructions: String).returns(PDF::Reader::Parser) }
190
+ def build_parser(instructions); end
191
+
192
+ sig { params(str: String).returns(T::Array[Integer]) }
193
+ def str_to_int(str); end
194
+
195
+ sig { params(instructions: T::Array[String]).void }
196
+ def process_bfchar_instructions(instructions); end
197
+
198
+ sig { params(instructions: T::Array[T.any(T::Array[String], String)]).void }
199
+ def process_bfrange_instructions(instructions); end
200
+
201
+ sig { params(start_code: String, end_code: String, dst: String).void }
202
+ def bfrange_type_one(start_code, end_code, dst); end
203
+
204
+ sig { params(start_code: String, end_code: String, dst: T::Array[String]).void }
205
+ def bfrange_type_two(start_code, end_code, dst); end
206
+ end
207
+
208
+ class Encoding
209
+ CONTROL_CHARS = T.let(T.unsafe(nil), T::Array[Integer])
210
+ UNKNOWN_CHAR = T.let(T.unsafe(nil), Integer)
211
+
212
+ sig { returns(String) }
213
+ attr_reader :unpack
214
+
215
+ sig { params(enc: T.untyped).void }
216
+ def initialize(enc)
217
+ @mapping = T.let(T.unsafe(nil), T::Hash[Integer, Integer])
218
+ @unpack = T.let(T.unsafe(nil), String)
219
+ @enc_name = T.let(T.unsafe(nil), Symbol)
220
+ @string_cache = T.let(T.unsafe(nil), T::Hash[Integer, String])
221
+ @map_file = T.let(T.unsafe(nil), T.nilable(String))
222
+ @differences = T.let(T.unsafe(nil), T.nilable(T::Hash[Integer, Integer]))
223
+ @glyphlist = T.let(T.unsafe(nil), T.nilable(PDF::Reader::GlyphHash))
224
+ end
225
+
226
+ sig { params(diff: T::Array[T.any(Integer, Symbol)]).returns(T::Hash[Integer, Integer]) }
227
+ def differences=(diff); end
228
+
229
+ sig { returns(T::Hash[Integer, Integer]) }
230
+ def differences; end
231
+
232
+ sig { params(str: String).returns(String) }
233
+ def to_utf8(str); end
234
+
235
+ sig { params(glyph_code: Integer).returns(String) }
236
+ def int_to_utf8_string(glyph_code); end
237
+
238
+ sig { params(glyph_code: Integer).returns(T::Array[Symbol]) }
239
+ def int_to_name(glyph_code); end
240
+
241
+ sig { returns(T::Hash[Integer, Integer]) }
242
+ def default_mapping; end
243
+
244
+ sig { params(glyph_code: Integer).returns(String) }
245
+ def internal_int_to_utf8_string(glyph_code); end
246
+
247
+ sig { returns(T::Boolean) }
248
+ def utf8_conversion_impossible?; end
249
+
250
+ sig { params(times: Integer).returns(String) }
251
+ def little_boxes(times); end
252
+
253
+ sig { params(str: String).returns(String) }
254
+ def convert_to_utf8(str); end
255
+
256
+ sig { params(enc: T.untyped).returns(String) }
257
+ def get_unpack(enc); end
258
+
259
+ sig { params(enc: T.untyped).returns(T.nilable(String)) }
260
+ def get_mapping_file(enc); end
261
+
262
+ sig { returns(PDF::Reader::GlyphHash) }
263
+ def glyphlist; end
264
+
265
+ sig { params(file: String).void }
266
+ def load_mapping(file); end
267
+ end
268
+
269
+ class Error
270
+ sig { params(lvalue: T.untyped, rvalue: T.untyped, chars: T.untyped).returns(T.untyped) }
271
+ def self.str_assert(lvalue, rvalue, chars = nil); end
272
+
273
+ sig { params(lvalue: T.untyped, rvalue: T.untyped, chars: T.untyped).returns(T.untyped) }
274
+ def self.str_assert_not(lvalue, rvalue, chars = nil); end
275
+
276
+ sig { params(lvalue: T.untyped, rvalue: T.untyped).returns(T.untyped) }
277
+ def self.assert_equal(lvalue, rvalue); end
278
+
279
+ sig { params(object: Object, name: String, klass: Module).void }
280
+ def self.validate_type(object, name, klass); end
281
+
282
+ sig { params(object: Object, name: String, klass: Module).void }
283
+ def self.validate_type_as_malformed(object, name, klass); end
284
+
285
+ sig { params(object: Object, name: String).void }
286
+ def self.validate_not_nil(object, name); end
287
+ end
288
+
289
+ class MalformedPDFError < RuntimeError
290
+ end
291
+
292
+ class InvalidPageError < ArgumentError
293
+ end
294
+
295
+ class InvalidObjectError < MalformedPDFError
296
+ end
297
+
298
+ class UnsupportedFeatureError < RuntimeError
299
+ end
300
+
301
+ class EncryptedPDFError < UnsupportedFeatureError
302
+ end
303
+
304
+ class Font
305
+ sig { returns(T.nilable(Symbol)) }
306
+ attr_accessor :subtype
307
+
308
+ sig { returns(PDF::Reader::Encoding) }
309
+ attr_accessor :encoding
310
+
311
+ sig { returns(T::Array[PDF::Reader::Font]) }
312
+ attr_accessor :descendantfonts
313
+
314
+ sig { returns(PDF::Reader::CMap) }
315
+ attr_accessor :tounicode
316
+
317
+ sig { returns(T::Array[Integer]) }
318
+ attr_reader :widths
319
+
320
+ sig { returns(T.nilable(Integer)) }
321
+ attr_reader :first_char
322
+
323
+ sig { returns(T.nilable(Integer)) }
324
+ attr_reader :last_char
325
+
326
+ sig { returns(T.nilable(Symbol)) }
327
+ attr_reader :basefont
328
+
329
+ sig { returns(T.nilable(PDF::Reader::FontDescriptor)) }
330
+ attr_reader :font_descriptor
331
+
332
+ sig { returns(T::Array[Numeric]) }
333
+ attr_reader :cid_widths
334
+
335
+ sig { returns(Numeric) }
336
+ attr_reader :cid_default_width
337
+
338
+ sig { params(ohash: PDF::Reader::ObjectHash, obj: T::Hash[Symbol, T.untyped]).void }
339
+ def initialize(ohash, obj); end
340
+
341
+ sig { params(params: T.any(Integer, String, T::Array[T.untyped])).returns(String) }
342
+ def to_utf8(params); end
343
+
344
+ sig { params(data: String).returns(T::Array[T.nilable(T.any(Numeric, String))]) }
345
+ def unpack(data); end
346
+
347
+ sig { params(code_point: T.any(String, Integer)).returns(T.untyped) }
348
+ def glyph_width(code_point); end
349
+
350
+ sig { params(font_name: Symbol).returns(PDF::Reader::Encoding) }
351
+ def default_encoding(font_name); end
352
+
353
+ sig {
354
+ returns(
355
+ T.any(
356
+ PDF::Reader::WidthCalculator::BuiltIn,
357
+ PDF::Reader::WidthCalculator::Composite,
358
+ PDF::Reader::WidthCalculator::TrueType,
359
+ PDF::Reader::WidthCalculator::TypeOneOrThree,
360
+ PDF::Reader::WidthCalculator::TypeZero,
361
+ )
362
+ )
363
+ }
364
+ def build_width_calculator; end
365
+
366
+ sig { params(obj: T.untyped).void }
367
+ def extract_base_info(obj); end
368
+
369
+ sig { params(obj: T.untyped).void }
370
+ def extract_descriptor(obj); end
371
+
372
+ sig { params(obj: T.untyped).void }
373
+ def extract_descendants(obj); end
374
+
375
+ sig { params(params: T.any(Integer, String, T::Array[T.untyped])).returns(String) }
376
+ def to_utf8_via_cmap(params); end
377
+
378
+ sig { params(params: T.any(Integer, String, T::Array[T.untyped])).returns(String) }
379
+ def to_utf8_via_encoding(params); end
380
+ end
381
+
382
+ class FontDescriptor
383
+ sig { returns(String) }
384
+ attr_reader :font_name
385
+
386
+ sig { returns(T.nilable(String)) }
387
+ attr_reader :font_family
388
+
389
+ sig { returns(Symbol) }
390
+ attr_reader :font_stretch
391
+
392
+ sig { returns(Numeric) }
393
+ attr_reader :font_weight
394
+
395
+ sig { returns(T::Array[Numeric]) }
396
+ attr_reader :font_bounding_box
397
+
398
+ sig { returns(Numeric) }
399
+ attr_reader :cap_height
400
+
401
+ sig { returns(Numeric) }
402
+ attr_reader :ascent
403
+
404
+ sig { returns(Numeric) }
405
+ attr_reader :descent
406
+
407
+ sig { returns(Numeric) }
408
+ attr_reader :leading
409
+
410
+ sig { returns(Numeric) }
411
+ attr_reader :avg_width
412
+
413
+ sig { returns(Numeric) }
414
+ attr_reader :max_width
415
+
416
+ sig { returns(Numeric) }
417
+ attr_reader :missing_width
418
+
419
+ sig { returns(T.nilable(Numeric)) }
420
+ attr_reader :italic_angle
421
+
422
+ sig { returns(T.nilable(Numeric)) }
423
+ attr_reader :stem_v
424
+
425
+ sig { returns(T.nilable(Numeric)) }
426
+ attr_reader :x_height
427
+
428
+ sig { returns(Integer) }
429
+ attr_reader :font_flags
430
+
431
+ sig { params(ohash: PDF::Reader::ObjectHash, fd_hash: T::Hash[T.untyped, T.untyped]).void }
432
+ def initialize(ohash, fd_hash); end
433
+
434
+ sig { params(char_code: Integer).returns(Numeric) }
435
+ def glyph_width(char_code); end
436
+
437
+ sig { returns(Numeric) }
438
+ def glyph_to_pdf_scale_factor; end
439
+
440
+ sig { returns(TTFunk::File) }
441
+ def ttf_program_stream; end
442
+ end
443
+
444
+ class FormXObject
445
+ sig { returns(T.untyped) }
446
+ attr_reader :xobject
447
+
448
+ sig { params(page: T.untyped, xobject: T.untyped, options: T.untyped).void }
449
+ def initialize(page, xobject, options = {}); end
450
+
451
+ sig { returns(T.untyped) }
452
+ def font_objects; end
453
+
454
+ sig { params(receivers: T.untyped).returns(T.untyped) }
455
+ def walk(*receivers); end
456
+
457
+ sig { returns(T.untyped) }
458
+ def raw_content; end
459
+
460
+ sig { returns(T.untyped) }
461
+ def resources; end
462
+
463
+ sig { params(receivers: T.untyped, name: T.untyped, params: T.untyped).returns(T.untyped) }
464
+ def callback(receivers, name, params = []); end
465
+
466
+ sig { returns(T.untyped) }
467
+ def content_stream_md5; end
468
+
469
+ sig { returns(T.untyped) }
470
+ def cached_tokens_key; end
471
+
472
+ sig { returns(T.untyped) }
473
+ def tokens; end
474
+
475
+ sig { params(receivers: T.untyped, instructions: T.untyped).returns(T.untyped) }
476
+ def content_stream(receivers, instructions); end
477
+ end
478
+
479
+ class GlyphHash
480
+ @@by_name_cache = T.let(T.unsafe(nil), T.nilable(T::Hash[Symbol, Integer]))
481
+ @@by_codepoint_cache = T.let(T.unsafe(nil), T.nilable(T::Hash[Integer, T::Array[Symbol]]))
482
+
483
+ sig { void }
484
+ def initialize
485
+ @by_name = T.let(T.unsafe(nil), T::Hash[Symbol, Integer])
486
+ @by_codepoint = T.let(T.unsafe(nil), T::Hash[Integer, T::Array[Symbol]])
487
+ end
488
+
489
+ sig { params(name: T.nilable(Symbol)).returns(T.nilable(Integer)) }
490
+ def name_to_unicode(name); end
491
+
492
+ sig { params(codepoint: T.nilable(Integer)).returns(T::Array[Symbol]) }
493
+ def unicode_to_name(codepoint); end
494
+
495
+ sig { returns([T::Hash[Symbol, Integer], T::Hash[Integer, T::Array[Symbol]]]) }
496
+ def load_adobe_glyph_mapping; end
497
+ end
498
+
499
+ class KeyBuilderV5
500
+ sig { params(opts: T::Hash[Symbol, String]).void }
501
+ def initialize(opts = {})
502
+ @key_length = T.let(T.unsafe(nil), Integer)
503
+ @owner_key = T.let(T.unsafe(nil), String)
504
+ @user_key = T.let(T.unsafe(nil), String)
505
+ @owner_encryption_key = T.let(T.unsafe(nil), String)
506
+ @user_encryption_key = T.let(T.unsafe(nil), String)
507
+ end
508
+
509
+ sig { params(pass: String).returns(String) }
510
+ def key(pass); end
511
+
512
+ sig { params(password: T.untyped).returns(T.untyped) }
513
+ def auth_owner_pass(password); end
514
+
515
+ sig { params(password: T.untyped).returns(T.untyped) }
516
+ def auth_user_pass(password); end
517
+
518
+ sig { params(password: String).returns(T.nilable(String)) }
519
+ def auth_owner_pass_r6(password); end
520
+
521
+ sig { params(password: String).returns(T.nilable(String)) }
522
+ def auth_user_pass_r6(password); end
523
+
524
+ sig { params(password: String, salt: String, user_key: String).returns(String)}
525
+ def r6_digest(password, salt, user_key = ''); end
526
+
527
+ sig { params(str: String).returns(Integer)}
528
+ def unpack_128bit_bigendian_int(str); end
529
+ end
530
+
531
+ class LZW
532
+ CODE_EOD = 257
533
+ CODE_CLEAR_TABLE = 256
534
+
535
+ class BitStream
536
+ sig { params(data: String, bits_in_chunk: Integer).void }
537
+ def initialize(data, bits_in_chunk)
538
+ @data = T.let(T.unsafe(nil), String)
539
+ @bits_in_chunk = T.let(T.unsafe(nil), Integer)
540
+ @current_pos = T.let(T.unsafe(nil), Integer)
541
+ @bits_left_in_byte = T.let(T.unsafe(nil), Integer)
542
+
543
+ end
544
+
545
+ sig { params(bits_in_chunk: Integer).void }
546
+ def set_bits_in_chunk(bits_in_chunk); end
547
+
548
+ sig { returns(Integer) }
549
+ def read; end
550
+ end
551
+
552
+ class StringTable
553
+ sig { returns(Integer) }
554
+ attr_reader :string_table_pos
555
+
556
+ sig { void }
557
+ def initialize
558
+ @data = T.let(T.unsafe(nil), T::Hash[Integer, String])
559
+ @string_table_pos = T.let(T.unsafe(nil), Integer)
560
+ end
561
+
562
+ sig { params(key: Integer).returns(T.nilable(String)) }
563
+ def [](key); end
564
+
565
+ sig { params(string: String).void }
566
+ def add(string); end
567
+ end
568
+
569
+ sig { params(data: String).returns(String) }
570
+ def self.decode(data); end
571
+
572
+ sig { params(string_table: PDF::Reader::LZW::StringTable, some_code: T.nilable(Integer), other_code: T.nilable(Integer)).returns(String) }
573
+ def self.create_new_string(string_table, some_code, other_code); end
574
+ end
575
+
576
+ class NullSecurityHandler
577
+ sig { params(buf: T.untyped, _ref: T.untyped).returns(T.untyped) }
578
+ def decrypt(buf, _ref); end
579
+ end
580
+
581
+ class ObjectCache
582
+ CACHEABLE_TYPES = [:Catalog, :Page, :Pages]
583
+
584
+ sig { returns(T.untyped) }
585
+ attr_reader :hits
586
+
587
+ sig { returns(T.untyped) }
588
+ attr_reader :misses
589
+
590
+ sig { params(lru_size: T.untyped).void }
591
+ def initialize(lru_size = 1000); end
592
+
593
+ sig { params(key: T.untyped).returns(T.untyped) }
594
+ def [](key); end
595
+
596
+ sig { params(key: T.untyped, value: T.untyped).returns(T.untyped) }
597
+ def []=(key, value); end
598
+
599
+ sig { params(key: T.untyped, local_default: T.untyped).returns(T.untyped) }
600
+ def fetch(key, local_default = nil); end
601
+
602
+ sig { params(block: T.untyped).returns(T.untyped) }
603
+ def each(&block); end
604
+
605
+ sig { params(block: T.untyped).returns(T.untyped) }
606
+ def each_key(&block); end
607
+
608
+ sig { params(block: T.untyped).returns(T.untyped) }
609
+ def each_value(&block); end
610
+
611
+ sig { returns(T.untyped) }
612
+ def size; end
613
+
614
+ sig { returns(T.untyped) }
615
+ def empty?; end
616
+
617
+ sig { params(key: T.untyped).returns(T.untyped) }
618
+ def include?(key); end
619
+
620
+ sig { params(value: T.untyped).returns(T.untyped) }
621
+ def has_value?(value); end
622
+
623
+ sig { returns(T.untyped) }
624
+ def to_s; end
625
+
626
+ sig { returns(T.untyped) }
627
+ def keys; end
628
+
629
+ sig { returns(T.untyped) }
630
+ def values; end
631
+
632
+ sig { params(key: T.untyped).returns(T.untyped) }
633
+ def update_stats(key); end
634
+
635
+ sig { params(obj: T.untyped).returns(T.untyped) }
636
+ def cacheable?(obj); end
637
+ end
638
+
639
+ class ObjectHash
640
+ include Enumerable
641
+
642
+ sig { returns(T.untyped) }
643
+ attr_accessor :default
644
+
645
+ sig { returns(T::Hash[Symbol, T.untyped]) }
646
+ attr_reader :trailer
647
+
648
+ sig { returns(Float) }
649
+ attr_reader :pdf_version
650
+
651
+ sig { returns(
652
+ T.any(
653
+ PDF::Reader::NullSecurityHandler,
654
+ PDF::Reader::AesV2SecurityHandler,
655
+ PDF::Reader::AesV3SecurityHandler,
656
+ PDF::Reader::Rc4SecurityHandler,
657
+ )) }
658
+ attr_reader :sec_handler
659
+
660
+ sig { params(input: T.any(IO, Tempfile, StringIO, String), opts: T::Hash[Symbol, T.untyped]).void }
661
+ def initialize(input, opts = {})
662
+ @io = T.let(T.unsafe(nil), T.any(IO, Tempfile, StringIO))
663
+ @xref = T.let(T.unsafe(nil), PDF::Reader::XRef)
664
+ @pdf_version = T.let(T.unsafe(nil), Float)
665
+ @trailer = T.let(T.unsafe(nil), T::Hash[Symbol, T.untyped])
666
+ @cache = T.let(T.unsafe(nil), PDF::Reader::ObjectCache)
667
+ @sec_handler = T.let(T.unsafe(nil), T.any(
668
+ PDF::Reader::NullSecurityHandler,
669
+ PDF::Reader::AesV2SecurityHandler,
670
+ PDF::Reader::AesV3SecurityHandler,
671
+ PDF::Reader::Rc4SecurityHandler,
672
+ ))
673
+ @page_references = T.let(T.unsafe(nil), T.nilable(T::Array[T.any(PDF::Reader::Reference, T::Hash[Symbol, T.untyped])]))
674
+ @object_streams = T.let(T.unsafe(nil), T.nilable(T::Hash[PDF::Reader::Reference, PDF::Reader::ObjectStream]))
675
+ end
676
+
677
+ sig { params(ref: T.any(Integer, PDF::Reader::Reference)).returns(T.nilable(Symbol)) }
678
+ def obj_type(ref); end
679
+
680
+ sig { params(ref: T.any(Integer, PDF::Reader::Reference)).returns(T::Boolean) }
681
+ def stream?(ref); end
682
+
683
+ sig { params(key: T.any(Integer, PDF::Reader::Reference)).returns(T.untyped) }
684
+ def [](key); end
685
+
686
+ sig { params(key: T.untyped).returns(T.untyped) }
687
+ def object(key); end
688
+
689
+ sig { params(key: T.untyped).returns(T.nilable(T::Array[T.untyped])) }
690
+ def deref_array(key); end
691
+
692
+ sig { params(key: T.untyped).returns(T.nilable(T::Array[Numeric])) }
693
+ def deref_array_of_numbers(key); end
694
+
695
+ sig { params(key: T.untyped).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
696
+ def deref_hash(key); end
697
+
698
+ sig { params(key: T.untyped).returns(T.nilable(Symbol)) }
699
+ def deref_name(key); end
700
+
701
+ sig { params(key: T.untyped).returns(T.any(Symbol, T::Array[T.untyped], NilClass)) }
702
+ def deref_name_or_array(key); end
703
+
704
+ sig { params(key: T.untyped).returns(T.nilable(Integer)) }
705
+ def deref_integer(key); end
706
+
707
+ sig { params(key: T.untyped).returns(T.nilable(Numeric)) }
708
+ def deref_number(key); end
709
+
710
+ sig { params(key: T.untyped).returns(T.nilable(PDF::Reader::Stream)) }
711
+ def deref_stream(key); end
712
+
713
+ sig { params(key: T.untyped).returns(T.nilable(String)) }
714
+ def deref_string(key); end
715
+
716
+ sig { params(key: T.untyped).returns(T.any(PDF::Reader::Stream, T::Array[T.untyped], NilClass)) }
717
+ def deref_stream_or_array(key); end
718
+
719
+ sig { params(key: T.untyped).returns(T.untyped) }
720
+ def deref!(key); end
721
+
722
+ sig { params(key: T.untyped).returns(T.nilable(T::Array[T.untyped])) }
723
+ def deref_array!(key); end
724
+
725
+ sig { params(key: T.untyped).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
726
+ def deref_hash!(key); end
727
+
728
+ sig { params(key: T.untyped, local_default: T.untyped).returns(T.untyped) }
729
+ def fetch(key, local_default = nil); end
730
+
731
+ sig { params(block: T.untyped).returns(T.untyped) }
732
+ def each(&block); end
733
+
734
+ sig { params(block: T.untyped).returns(T.untyped) }
735
+ def each_key(&block); end
736
+
737
+ sig { params(block: T.untyped).returns(T.untyped) }
738
+ def each_value(&block); end
739
+
740
+ sig { returns(Integer) }
741
+ def size; end
742
+
743
+ sig { returns(T::Boolean) }
744
+ def empty?; end
745
+
746
+ sig { params(check_key: T.untyped).returns(T::Boolean) }
747
+ def has_key?(check_key); end
748
+
749
+ sig { params(value: T.untyped).returns(T::Boolean) }
750
+ def has_value?(value); end
751
+
752
+ sig { returns(String) }
753
+ def to_s; end
754
+
755
+ sig { returns(T::Array[PDF::Reader::Reference]) }
756
+ def keys; end
757
+
758
+ sig { returns(T.untyped) }
759
+ def values; end
760
+
761
+ sig { params(ids: T.untyped).returns(T.untyped) }
762
+ def values_at(*ids); end
763
+
764
+ sig { returns(T.untyped) }
765
+ def to_a; end
766
+
767
+ sig { returns(T::Array[T.any(PDF::Reader::Reference, T::Hash[Symbol, T.untyped])]) }
768
+ def page_references; end
769
+
770
+ sig { returns(T::Boolean) }
771
+ def encrypted?; end
772
+
773
+ sig { returns(T::Boolean) }
774
+ def sec_handler?; end
775
+
776
+ sig { params(key: T.untyped).returns(T.untyped) }
777
+ def fetch_object(key); end
778
+
779
+ sig { params(key: T.untyped).returns(T.untyped) }
780
+ def fetch_object_stream(key); end
781
+
782
+ sig { params(key: T.untyped, seen: T.untyped).returns(T.untyped) }
783
+ def deref_internal!(key, seen); end
784
+
785
+ sig { params(ref: T.untyped, obj: T.untyped).returns(T.untyped) }
786
+ def decrypt(ref, obj); end
787
+
788
+ sig { params(offset: Integer).returns(PDF::Reader::Buffer) }
789
+ def new_buffer(offset = 0); end
790
+
791
+ sig { returns(T.untyped) }
792
+ def xref; end
793
+
794
+ sig { returns(T.untyped) }
795
+ def object_streams; end
796
+
797
+ sig { params(obj: T.any(PDF::Reader::Reference, T::Hash[Symbol, T.untyped])).returns(T::Array[T.any(PDF::Reader::Reference, T::Hash[Symbol, T.untyped])]) }
798
+ def get_page_objects(obj); end
799
+
800
+ sig { returns(Float) }
801
+ def read_version; end
802
+
803
+ sig { params(input: T.any(IO, Tempfile, StringIO, String)).returns(T.any(IO, Tempfile, StringIO)) }
804
+ def extract_io_from(input); end
805
+
806
+ sig { params(input: String).returns(String) }
807
+ def read_as_binary(input); end
808
+ end
809
+
810
+ class ObjectStream
811
+ sig { params(stream: PDF::Reader::Stream).void }
812
+ def initialize(stream)
813
+ @dict = T.let(T.unsafe(nil), T::Hash[Symbol, T.untyped])
814
+ @data = T.let(T.unsafe(nil), String)
815
+ @offsets = T.let(T.unsafe(nil), T.nilable(T::Hash[Integer, Integer]))
816
+ @buffer = T.let(T.unsafe(nil), T.nilable(PDF::Reader::Buffer))
817
+ end
818
+
819
+ sig {
820
+ params(objid: Integer).returns(
821
+ T.any(PDF::Reader::Reference, PDF::Reader::Token, Numeric, String, Symbol, T::Array[T.untyped], T::Hash[T.untyped, T.untyped], NilClass)
822
+ )
823
+ }
824
+ def [](objid); end
825
+
826
+ sig { returns(Integer) }
827
+ def size; end
828
+
829
+ sig { returns(T::Hash[Integer, Integer]) }
830
+ def offsets; end
831
+
832
+ sig { returns(Integer) }
833
+ def first; end
834
+
835
+ sig { returns(PDF::Reader::Buffer) }
836
+ def buffer; end
837
+ end
838
+
839
+ class OverlappingRunsFilter
840
+ OVERLAPPING_THRESHOLD = T.let(T.unsafe(nil), Float)
841
+
842
+ sig { params(runs: T::Array[PDF::Reader::TextRun]).returns(T::Array[PDF::Reader::TextRun]) }
843
+ def self.exclude_redundant_runs(runs); end
844
+
845
+ sig { params(sweep_line_status: T::Array[PDF::Reader::TextRun], event_point: EventPoint).returns(T::Boolean) }
846
+ def self.detect_intersection(sweep_line_status, event_point); end
847
+ end
848
+
849
+ class NoTextFilter
850
+ sig { params(runs: T::Array[PDF::Reader::TextRun]).returns(T::Array[PDF::Reader::TextRun]) }
851
+ def self.exclude_empty_strings(runs); end
852
+ end
853
+
854
+ class EventPoint
855
+ sig { returns(Numeric) }
856
+ attr_reader :x
857
+
858
+ sig { returns(PDF::Reader::TextRun) }
859
+ attr_reader :run
860
+
861
+ sig { params(x: Numeric, run: PDF::Reader::TextRun).void }
862
+ def initialize(x, run)
863
+ @x = T.let(T.unsafe(nil), Numeric)
864
+ @run = T.let(T.unsafe(nil), PDF::Reader::TextRun)
865
+ end
866
+
867
+ sig { returns(T::Boolean) }
868
+ def start?; end
869
+ end
870
+
871
+ class Page
872
+ sig { returns(PDF::Reader::ObjectHash) }
873
+ attr_reader :objects
874
+
875
+ sig { returns(T::Hash[Symbol, T.untyped]) }
876
+ attr_reader :page_object
877
+
878
+ sig { returns(T.any(PDF::Reader::ObjectCache, T::Hash[T.untyped, T.untyped])) }
879
+ attr_reader :cache
880
+
881
+ sig { params(objects: PDF::Reader::ObjectHash, pagenum: Integer, options: T::Hash[Symbol, T.untyped]).void }
882
+ def initialize(objects, pagenum, options = {})
883
+ @objects = T.let(T.unsafe(nil), PDF::Reader::ObjectHash)
884
+ @pagenum = T.let(T.unsafe(nil), Integer)
885
+ @page_object = T.let(T.unsafe(nil), T::Hash[Symbol, T.untyped])
886
+ @cache = T.let(T.unsafe(nil), T.any(PDF::Reader::ObjectCache, T::Hash[T.untyped, T.untyped]))
887
+ @attributes = T.let(T.unsafe(nil), T.nilable(T::Hash[Symbol, T.untyped]))
888
+ @root = T.let(T.unsafe(nil), T.nilable(T::Hash[Symbol, T.untyped]))
889
+ @resources = T.let(T.unsafe(nil), T.nilable(PDF::Reader::Resources))
890
+ end
891
+
892
+ sig { returns(Integer) }
893
+ def number; end
894
+
895
+ sig { returns(String) }
896
+ def inspect; end
897
+
898
+ sig { returns(T::Hash[Symbol, T.untyped]) }
899
+ def attributes; end
900
+
901
+ sig { returns(Numeric) }
902
+ def height; end
903
+
904
+ sig { returns(Numeric) }
905
+ def width; end
906
+
907
+ sig { returns(String) }
908
+ def orientation; end
909
+
910
+ sig { returns(T::Array[Numeric]) }
911
+ def origin; end
912
+
913
+ sig { params(opts: T::Hash[Symbol, T.untyped]).returns(T::Array[PDF::Reader::TextRun]) }
914
+ def runs(opts = {}); end
915
+
916
+ sig { params(opts: T::Hash[Symbol, T.untyped]).returns(String) }
917
+ def text(opts = {}); end
918
+
919
+ sig { params(receivers: T.untyped).void }
920
+ def walk(*receivers); end
921
+
922
+ sig { returns(String) }
923
+ def raw_content; end
924
+
925
+ sig { returns(Integer) }
926
+ def rotate; end
927
+
928
+ sig { returns(T::Hash[Symbol, T::Array[Numeric]]) }
929
+ def boxes; end
930
+
931
+ sig { returns(T::Hash[Symbol, PDF::Reader::Rectangle]) }
932
+ def rectangles; end
933
+
934
+ sig { returns(T::Hash[Symbol, T.untyped]) }
935
+ def root; end
936
+
937
+ sig { returns(PDF::Reader::Resources) }
938
+ def resources; end
939
+
940
+ sig { params(receivers: T::Array[T.untyped], instructions: String).void }
941
+ def content_stream(receivers, instructions); end
942
+
943
+ sig { params(receivers: T::Array[Object], name: Symbol, params: T::Array[T.untyped]).void }
944
+ def callback(receivers, name, params = []); end
945
+
946
+ sig { returns(T.untyped) }
947
+ def page_with_ancestors; end
948
+
949
+ sig { params(origin: T.untyped).returns(T.untyped) }
950
+ def ancestors(origin = @page_object[:Parent]); end
951
+
952
+ sig { params(obj: T::Hash[Symbol, T.untyped]).returns(T::Hash[Symbol, T.untyped]) }
953
+ def select_inheritable(obj); end
954
+ end
955
+
956
+ class PageLayout
957
+ DEFAULT_FONT_SIZE = T.let(T.unsafe(nil), Numeric)
958
+
959
+ sig { params(runs: T::Array[PDF::Reader::TextRun], mediabox: T.any(T::Array[Numeric], PDF::Reader::Rectangle)).void }
960
+ def initialize(runs, mediabox)
961
+ @mediabox = T.let(T.unsafe(nil), PDF::Reader::Rectangle)
962
+ @runs = T.let(T.unsafe(nil), T::Array[PDF::Reader::TextRun])
963
+ @mean_font_size = T.let(T.unsafe(nil), Numeric)
964
+ @median_glyph_width = T.let(T.unsafe(nil), Numeric)
965
+ @x_offset = T.let(T.unsafe(nil), Numeric)
966
+ @y_offset = T.let(T.unsafe(nil), Numeric)
967
+ @row_count = T.let(T.unsafe(nil), T.nilable(Integer))
968
+ @col_count = T.let(T.unsafe(nil), T.nilable(Integer))
969
+ @row_multiplier = T.let(T.unsafe(nil), T.nilable(Numeric))
970
+ @col_multiplier = T.let(T.unsafe(nil), T.nilable(Numeric))
971
+ end
972
+
973
+ sig { returns(String) }
974
+ def to_s; end
975
+
976
+ sig { params(rows: T.untyped).returns(T.untyped) }
977
+ def interesting_rows(rows); end
978
+
979
+ sig { returns(T.untyped) }
980
+ def row_count; end
981
+
982
+ sig { returns(T.untyped) }
983
+ def col_count; end
984
+
985
+ sig { returns(T.untyped) }
986
+ def row_multiplier; end
987
+
988
+ sig { returns(T.untyped) }
989
+ def col_multiplier; end
990
+
991
+ sig { params(collection: T.untyped).returns(T.untyped) }
992
+ def mean(collection); end
993
+
994
+ sig { params(collection: T.untyped).returns(T.untyped) }
995
+ def median(collection); end
996
+
997
+ sig { params(runs: T.untyped).returns(T.untyped) }
998
+ def merge_runs(runs); end
999
+
1000
+ sig { params(chars: T::Array[PDF::Reader::TextRun]).returns(T::Array[PDF::Reader::TextRun]) }
1001
+ def group_chars_into_runs(chars); end
1002
+
1003
+ sig { params(haystack: T.untyped, needle: T.untyped, index: T.untyped).returns(T.untyped) }
1004
+ def local_string_insert(haystack, needle, index); end
1005
+
1006
+ sig { params(mediabox: T.untyped).returns(T.untyped) }
1007
+ def process_mediabox(mediabox); end
1008
+
1009
+ sig { returns(Numeric) }
1010
+ def page_width; end
1011
+
1012
+ sig { returns(Numeric) }
1013
+ def page_height; end
1014
+ end
1015
+
1016
+ class PageState
1017
+ DEFAULT_GRAPHICS_STATE = {
1018
+ :char_spacing => 0,
1019
+ :word_spacing => 0,
1020
+ :h_scaling => 1.0,
1021
+ :text_leading => 0,
1022
+ :text_font => nil,
1023
+ :text_font_size => nil,
1024
+ :text_mode => 0,
1025
+ :text_rise => 0,
1026
+ :text_knockout => 0
1027
+ }
1028
+
1029
+ sig { params(page: T.untyped).void }
1030
+ def initialize(page); end
1031
+
1032
+ sig { returns(T.untyped) }
1033
+ def save_graphics_state; end
1034
+
1035
+ sig { returns(T.untyped) }
1036
+ def restore_graphics_state; end
1037
+
1038
+ sig do
1039
+ params(
1040
+ a: T.untyped,
1041
+ b: T.untyped,
1042
+ c: T.untyped,
1043
+ d: T.untyped,
1044
+ e: T.untyped,
1045
+ f: T.untyped
1046
+ ).returns(T.untyped)
1047
+ end
1048
+ def concatenate_matrix(a, b, c, d, e, f); end
1049
+
1050
+ sig { returns(T.untyped) }
1051
+ def begin_text_object; end
1052
+
1053
+ sig { returns(T.untyped) }
1054
+ def end_text_object; end
1055
+
1056
+ sig { params(char_spacing: T.untyped).returns(T.untyped) }
1057
+ def set_character_spacing(char_spacing); end
1058
+
1059
+ sig { params(h_scaling: T.untyped).returns(T.untyped) }
1060
+ def set_horizontal_text_scaling(h_scaling); end
1061
+
1062
+ sig { params(label: T.untyped, size: T.untyped).returns(T.untyped) }
1063
+ def set_text_font_and_size(label, size); end
1064
+
1065
+ sig { returns(T.untyped) }
1066
+ def font_size; end
1067
+
1068
+ sig { params(leading: T.untyped).returns(T.untyped) }
1069
+ def set_text_leading(leading); end
1070
+
1071
+ sig { params(mode: T.untyped).returns(T.untyped) }
1072
+ def set_text_rendering_mode(mode); end
1073
+
1074
+ sig { params(rise: T.untyped).returns(T.untyped) }
1075
+ def set_text_rise(rise); end
1076
+
1077
+ sig { params(word_spacing: T.untyped).returns(T.untyped) }
1078
+ def set_word_spacing(word_spacing); end
1079
+
1080
+ sig { params(x: T.untyped, y: T.untyped).returns(T.untyped) }
1081
+ def move_text_position(x, y); end
1082
+
1083
+ sig { params(x: T.untyped, y: T.untyped).returns(T.untyped) }
1084
+ def move_text_position_and_set_leading(x, y); end
1085
+
1086
+ sig do
1087
+ params(
1088
+ a: T.untyped,
1089
+ b: T.untyped,
1090
+ c: T.untyped,
1091
+ d: T.untyped,
1092
+ e: T.untyped,
1093
+ f: T.untyped
1094
+ ).returns(T.untyped)
1095
+ end
1096
+ def set_text_matrix_and_text_line_matrix(a, b, c, d, e, f); end
1097
+
1098
+ sig { returns(T.untyped) }
1099
+ def move_to_start_of_next_line; end
1100
+
1101
+ sig { params(params: T.untyped).returns(T.untyped) }
1102
+ def show_text_with_positioning(params); end
1103
+
1104
+ sig { params(str: T.untyped).returns(T.untyped) }
1105
+ def move_to_next_line_and_show_text(str); end
1106
+
1107
+ sig { params(aw: T.untyped, ac: T.untyped, string: T.untyped).returns(T.untyped) }
1108
+ def set_spacing_next_line_show_text(aw, ac, string); end
1109
+
1110
+ sig { params(label: T.untyped).returns(T.untyped) }
1111
+ def invoke_xobject(label); end
1112
+
1113
+ sig { params(x: T.untyped, y: T.untyped).returns(T.untyped) }
1114
+ def ctm_transform(x, y); end
1115
+
1116
+ sig { params(x: T.untyped, y: T.untyped).returns(T.untyped) }
1117
+ def trm_transform(x, y); end
1118
+
1119
+ sig { returns(T.untyped) }
1120
+ def current_font; end
1121
+
1122
+ sig { params(label: T.untyped).returns(T.untyped) }
1123
+ def find_font(label); end
1124
+
1125
+ sig { params(label: T.untyped).returns(T.untyped) }
1126
+ def find_color_space(label); end
1127
+
1128
+ sig { params(label: T.untyped).returns(T.untyped) }
1129
+ def find_xobject(label); end
1130
+
1131
+ sig { returns(T.untyped) }
1132
+ def stack_depth; end
1133
+
1134
+ sig { returns(T.untyped) }
1135
+ def clone_state; end
1136
+
1137
+ sig { params(w0: T.untyped, tj: T.untyped, word_boundary: T.untyped).returns(T.untyped) }
1138
+ def process_glyph_displacement(w0, tj, word_boundary); end
1139
+
1140
+ sig { returns(T.untyped) }
1141
+ def text_rendering_matrix; end
1142
+
1143
+ sig { returns(T.untyped) }
1144
+ def ctm; end
1145
+
1146
+ sig { returns(T.untyped) }
1147
+ def state; end
1148
+
1149
+ sig { params(raw_fonts: T.untyped).returns(T.untyped) }
1150
+ def build_fonts(raw_fonts); end
1151
+
1152
+ sig { returns(T.untyped) }
1153
+ def identity_matrix; end
1154
+ end
1155
+
1156
+ class PageTextReceiver
1157
+ extend Forwardable
1158
+ SPACE = " "
1159
+
1160
+ sig { returns(T.untyped) }
1161
+ attr_reader :state
1162
+
1163
+ sig { returns(T.untyped) }
1164
+ attr_reader :options
1165
+
1166
+ sig { params(page: T.untyped).returns(T.untyped) }
1167
+ def page=(page); end
1168
+
1169
+ sig { returns(T.untyped) }
1170
+ def content; end
1171
+
1172
+ sig { params(string: String).void }
1173
+ def show_text(string); end
1174
+
1175
+ sig { params(params: T::Array[T.untyped]).void }
1176
+ def show_text_with_positioning(params); end
1177
+
1178
+ sig { params(str: String).void }
1179
+ def move_to_next_line_and_show_text(str); end
1180
+
1181
+ sig { params(opts: T::Hash[Symbol, T.untyped]).returns(T::Array[PDF::Reader::TextRun]) }
1182
+ def runs(opts = {}); end
1183
+
1184
+ sig { params(aw: Numeric, ac: Numeric, string: String).void }
1185
+ def set_spacing_next_line_show_text(aw, ac, string); end
1186
+
1187
+ sig { params(label: T.untyped).returns(T.untyped) }
1188
+ def invoke_xobject(label); end
1189
+
1190
+ sig { params(string: String).void }
1191
+ def internal_show_text(string); end
1192
+
1193
+ sig { params(x: T.untyped, y: T.untyped).returns(T.untyped) }
1194
+ def apply_rotation(x, y); end
1195
+ end
1196
+
1197
+ class PagesStrategy
1198
+ OPERATORS = T.let(T.unsafe(nil), T::Hash[String, Symbol])
1199
+ end
1200
+
1201
+ class Parser
1202
+ sig { params(buffer: PDF::Reader::Buffer, objects: T.nilable(PDF::Reader::ObjectHash)).void }
1203
+ def initialize(buffer, objects=nil); end
1204
+
1205
+ sig {
1206
+ params(
1207
+ operators: T::Hash[T.any(String, PDF::Reader::Token), Symbol]
1208
+ ).returns(
1209
+ T.any(PDF::Reader::Reference, PDF::Reader::Token, Numeric, String, Symbol, T::Array[T.untyped], T::Hash[T.untyped, T.untyped], NilClass)
1210
+ )
1211
+ }
1212
+ def parse_token(operators={}); end
1213
+
1214
+ sig {
1215
+ params(
1216
+ id: Integer,
1217
+ gen: Integer
1218
+ ).returns(
1219
+ T.any(PDF::Reader::Reference, PDF::Reader::Token, PDF::Reader::Stream, Numeric, String, Symbol, T::Array[T.untyped], T::Hash[T.untyped, T.untyped], NilClass)
1220
+ )
1221
+ }
1222
+ def object(id, gen); end
1223
+
1224
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1225
+ def dictionary; end
1226
+
1227
+ sig { returns(Symbol) }
1228
+ def pdf_name; end
1229
+
1230
+ sig { returns(T::Array[T.untyped]) }
1231
+ def array; end
1232
+
1233
+ sig { returns(String) }
1234
+ def hex_string; end
1235
+
1236
+ sig { returns(String) }
1237
+ def string; end
1238
+
1239
+ sig { params(dict: T::Hash[Symbol, T.untyped]).returns(PDF::Reader::Stream) }
1240
+ def stream(dict); end
1241
+ end
1242
+
1243
+ class Point
1244
+ sig do
1245
+ params(
1246
+ x: Numeric,
1247
+ y: Numeric,
1248
+ ).void
1249
+ end
1250
+ def initialize(x, y)
1251
+ @x = T.let(T.unsafe(nil), Numeric)
1252
+ @y = T.let(T.unsafe(nil), Numeric)
1253
+ end
1254
+
1255
+ sig { returns(Numeric) }
1256
+ def x; end
1257
+
1258
+ sig { returns(Numeric) }
1259
+ def y; end
1260
+
1261
+ sig { params(other: PDF::Reader::Point).returns(T::Boolean) }
1262
+ def ==(other); end
1263
+
1264
+ end
1265
+
1266
+ class PrintReceiver
1267
+ sig { returns(T.untyped) }
1268
+ attr_accessor :callbacks
1269
+
1270
+ sig { void }
1271
+ def initialize; end
1272
+
1273
+ sig { params(meth: T.untyped).returns(T.untyped) }
1274
+ def respond_to?(meth); end
1275
+
1276
+ sig { params(methodname: T.untyped, args: T.untyped).returns(T.untyped) }
1277
+ def method_missing(methodname, *args); end
1278
+ end
1279
+
1280
+ class Rc4SecurityHandler
1281
+ sig { params(key: String).void }
1282
+ def initialize(key)
1283
+ @encrypt_key = T.let(T.unsafe(nil), String)
1284
+ end
1285
+
1286
+ sig { params(buf: T.untyped, ref: T.untyped).returns(T.untyped) }
1287
+ def decrypt(buf, ref); end
1288
+ end
1289
+
1290
+ class Rectangle
1291
+
1292
+ sig { params(arr: T::Array[Numeric]).returns(PDF::Reader::Rectangle) }
1293
+ def self.from_array(arr); end
1294
+
1295
+ sig do
1296
+ params(
1297
+ x1: Numeric,
1298
+ y1: Numeric,
1299
+ x2: Numeric,
1300
+ y2: Numeric
1301
+ ).void
1302
+ end
1303
+
1304
+ def initialize(x1, y1, x2, y2)
1305
+ @bottom_left = T.let(T.unsafe(nil), PDF::Reader::Point)
1306
+ @bottom_right = T.let(T.unsafe(nil), PDF::Reader::Point)
1307
+ @top_left = T.let(T.unsafe(nil), PDF::Reader::Point)
1308
+ @top_right = T.let(T.unsafe(nil), PDF::Reader::Point)
1309
+ end
1310
+
1311
+ sig { returns(PDF::Reader::Point) }
1312
+ def bottom_left; end
1313
+
1314
+ sig { returns(PDF::Reader::Point) }
1315
+ def bottom_right; end
1316
+
1317
+ sig { returns(PDF::Reader::Point) }
1318
+ def top_left; end
1319
+
1320
+ sig { returns(PDF::Reader::Point) }
1321
+ def top_right; end
1322
+
1323
+ sig { returns(Numeric) }
1324
+ def height; end
1325
+
1326
+ sig { returns(Numeric) }
1327
+ def width; end
1328
+
1329
+ sig { returns(T::Array[Numeric]) }
1330
+ def to_a; end
1331
+
1332
+ sig { params(degrees: Integer).void }
1333
+ def apply_rotation(degrees); end
1334
+
1335
+ sig { params(point: PDF::Reader::Point).void }
1336
+ def contains?(point); end
1337
+
1338
+ sig { params(other: PDF::Reader::Rectangle).void }
1339
+ def ==(other); end
1340
+
1341
+ sig { params(x1: Numeric, y1: Numeric, x2: Numeric, y2: Numeric).void }
1342
+ def set_corners(x1, y1, x2, y2); end
1343
+ end
1344
+
1345
+ class Reference
1346
+ sig { returns(Integer) }
1347
+ attr_reader :id
1348
+
1349
+ sig { returns(Integer) }
1350
+ attr_reader :gen
1351
+
1352
+ sig { params(id: Integer, gen: Integer).void }
1353
+ def initialize(id, gen)
1354
+ @id = T.let(T.unsafe(nil), Integer)
1355
+ @gen = T.let(T.unsafe(nil), Integer)
1356
+ end
1357
+
1358
+ sig { returns(T::Array[PDF::Reader::Reference]) }
1359
+ def to_a; end
1360
+
1361
+ sig { returns(Integer) }
1362
+ def to_i; end
1363
+
1364
+ sig { params(obj: Object).returns(T::Boolean) }
1365
+ def ==(obj); end
1366
+
1367
+ sig { returns(Integer) }
1368
+ def hash; end
1369
+ end
1370
+
1371
+ class RegisterReceiver
1372
+ sig { returns(T.untyped) }
1373
+ attr_accessor :callbacks
1374
+
1375
+ sig { void }
1376
+ def initialize; end
1377
+
1378
+ sig { params(meth: T.untyped).returns(T.untyped) }
1379
+ def respond_to?(meth); end
1380
+
1381
+ sig { params(methodname: T.untyped, args: T.untyped).returns(T.untyped) }
1382
+ def method_missing(methodname, *args); end
1383
+
1384
+ sig { params(methodname: T.untyped).returns(T.untyped) }
1385
+ def count(methodname); end
1386
+
1387
+ sig { params(methodname: T.untyped).returns(T.untyped) }
1388
+ def all(methodname); end
1389
+
1390
+ sig { params(methodname: T.untyped).returns(T.untyped) }
1391
+ def all_args(methodname); end
1392
+
1393
+ sig { params(methodname: T.untyped).returns(T.untyped) }
1394
+ def first_occurance_of(methodname); end
1395
+
1396
+ sig { params(methodname: T.untyped).returns(T.untyped) }
1397
+ def final_occurance_of(methodname); end
1398
+
1399
+ sig { params(methods: T.untyped).returns(T.untyped) }
1400
+ def series(*methods); end
1401
+ end
1402
+
1403
+ class Resources
1404
+
1405
+ sig { params(objects: PDF::Reader::ObjectHash, resources: T::Hash[T.untyped, T.untyped]).void }
1406
+ def initialize(objects, resources)
1407
+ @objects = T.let(T.unsafe(nil), PDF::Reader::ObjectHash)
1408
+ @resources = T.let(T.unsafe(nil), T::Hash[Symbol, T.untyped])
1409
+ end
1410
+
1411
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1412
+ def color_spaces; end
1413
+
1414
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1415
+ def fonts; end
1416
+
1417
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1418
+ def graphic_states; end
1419
+
1420
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1421
+ def patterns; end
1422
+
1423
+ sig { returns(T::Array[Symbol]) }
1424
+ def procedure_sets; end
1425
+
1426
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1427
+ def properties; end
1428
+
1429
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1430
+ def shadings; end
1431
+
1432
+ sig { returns(T::Hash[Symbol, PDF::Reader::Stream]) }
1433
+ def xobjects; end
1434
+ end
1435
+
1436
+ class SecurityHandlerFactory
1437
+ sig { params(encrypt: T.untyped, doc_id: T.untyped, password: T.untyped).returns(T.untyped) }
1438
+ def self.build(encrypt, doc_id, password); end
1439
+
1440
+ sig { params(encrypt: T.untyped, doc_id: T.untyped, password: T.untyped).returns(T.untyped) }
1441
+ def self.build_standard_handler(encrypt, doc_id, password); end
1442
+
1443
+ sig { params(encrypt: T.untyped, doc_id: T.untyped, password: T.untyped).returns(T.untyped) }
1444
+ def self.build_v5_handler(encrypt, doc_id, password); end
1445
+
1446
+ sig { params(encrypt: T.untyped).returns(T.untyped) }
1447
+ def self.standard?(encrypt); end
1448
+
1449
+ sig { params(encrypt: T.untyped).returns(T.untyped) }
1450
+ def self.standard_v5?(encrypt); end
1451
+ end
1452
+
1453
+ class StandardKeyBuilder
1454
+ PassPadBytes = [ 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
1455
+ 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08,
1456
+ 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
1457
+ 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a ]
1458
+
1459
+ sig { params(opts: T::Hash[Symbol, T.untyped]).void }
1460
+ def initialize(opts = {}); end
1461
+
1462
+ sig { params(pass: String).returns(String) }
1463
+ def key(pass); end
1464
+
1465
+ sig { params(p: T.untyped).returns(T.untyped) }
1466
+ def pad_pass(p = ""); end
1467
+
1468
+ sig { params(buf: T.untyped, int: T.untyped).returns(T.untyped) }
1469
+ def xor_each_byte(buf, int); end
1470
+
1471
+ sig { params(pass: T.untyped).returns(T.untyped) }
1472
+ def auth_owner_pass(pass); end
1473
+
1474
+ sig { params(pass: T.untyped).returns(T.untyped) }
1475
+ def auth_user_pass(pass); end
1476
+
1477
+ sig { params(user_pass: T.untyped).returns(T.untyped) }
1478
+ def make_file_key(user_pass); end
1479
+ end
1480
+
1481
+ class Stream
1482
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1483
+ attr_accessor :hash
1484
+
1485
+ sig { returns(String) }
1486
+ attr_accessor :data
1487
+
1488
+ sig { params(hash: T::Hash[Symbol, T.untyped], data: String).void }
1489
+ def initialize(hash, data)
1490
+ @hash = T.let(T.unsafe(nil), T::Hash[Symbol, T.untyped])
1491
+ @data = T.let(T.unsafe(nil), String)
1492
+ @udata = T.let(T.unsafe(nil), T.nilable(String))
1493
+ end
1494
+
1495
+ sig { returns(String) }
1496
+ def unfiltered_data; end
1497
+ end
1498
+
1499
+ class SynchronizedCache
1500
+ sig { void }
1501
+ def initialize
1502
+ @cache = T.let(T.unsafe(nil), T::Hash[Object, T.untyped])
1503
+ @mutex = T.let(T.unsafe(nil), Mutex)
1504
+ end
1505
+
1506
+ sig { params(key: Object).returns(T.untyped) }
1507
+ def [](key); end
1508
+
1509
+ sig { params(key: Object, value: T.nilable(Object)).returns(T.untyped) }
1510
+ def []=(key, value); end
1511
+ end
1512
+
1513
+ class TextRun
1514
+ include Comparable
1515
+
1516
+ sig { returns(Numeric) }
1517
+ attr_reader :width
1518
+
1519
+ sig { returns(Numeric) }
1520
+ attr_reader :font_size
1521
+
1522
+ sig { returns(String) }
1523
+ attr_reader :text
1524
+
1525
+ sig { returns(PDF::Reader::Point) }
1526
+ attr_reader :origin
1527
+
1528
+ sig do
1529
+ params(
1530
+ x: Numeric,
1531
+ y: Numeric,
1532
+ width: Numeric,
1533
+ font_size: Numeric,
1534
+ text: String
1535
+ ).void
1536
+ end
1537
+ def initialize(x, y, width, font_size, text)
1538
+ @origin = T.let(T.unsafe(nil), PDF::Reader::Point)
1539
+ @width = T.let(T.unsafe(nil), Numeric)
1540
+ @font_size = T.let(T.unsafe(nil), Numeric)
1541
+ @text = T.let(T.unsafe(nil), String)
1542
+ @endx = T.let(T.unsafe(nil), T.nilable(Numeric))
1543
+ @endy = T.let(T.unsafe(nil), T.nilable(Numeric))
1544
+ @mergable_range = T.let(T.unsafe(nil), T.nilable(T::Range[Numeric]))
1545
+ end
1546
+
1547
+ sig { params(other: T.untyped).returns(T.untyped) }
1548
+ def <=>(other); end
1549
+
1550
+ sig { returns(Numeric) }
1551
+ def endx; end
1552
+
1553
+ sig { returns(Numeric) }
1554
+ def endy; end
1555
+
1556
+ sig { returns(Numeric) }
1557
+ def x; end
1558
+
1559
+ sig { returns(Numeric) }
1560
+ def y; end
1561
+
1562
+ sig { returns(Numeric) }
1563
+ def mean_character_width; end
1564
+
1565
+ sig { params(other: PDF::Reader::TextRun).returns(T::Boolean) }
1566
+ def mergable?(other); end
1567
+
1568
+ sig { params(other: PDF::Reader::TextRun).returns(PDF::Reader::TextRun) }
1569
+ def +(other); end
1570
+
1571
+ sig { returns(String) }
1572
+ def inspect; end
1573
+
1574
+ sig { params(other_run: T.untyped).returns(T::Boolean) }
1575
+ def intersect?(other_run); end
1576
+
1577
+ sig { params(other_run: T.untyped).returns(Numeric) }
1578
+ def intersection_area_percent(other_run); end
1579
+
1580
+ sig { returns(Numeric) }
1581
+ def area; end
1582
+
1583
+ sig { returns(T::Range[Numeric]) }
1584
+ def mergable_range; end
1585
+
1586
+ sig { returns(Numeric) }
1587
+ def character_count; end
1588
+ end
1589
+
1590
+ class Token < String
1591
+ sig { params(val: T.untyped).void }
1592
+ def initialize(val); end
1593
+ end
1594
+
1595
+ class TransformationMatrix
1596
+ sig { returns(Numeric) }
1597
+ attr_reader :a
1598
+
1599
+ sig { returns(Numeric) }
1600
+ attr_reader :b
1601
+
1602
+ sig { returns(Numeric) }
1603
+ attr_reader :c
1604
+
1605
+ sig { returns(Numeric) }
1606
+ attr_reader :d
1607
+
1608
+ sig { returns(Numeric) }
1609
+ attr_reader :e
1610
+
1611
+ sig { returns(Numeric) }
1612
+ attr_reader :f
1613
+
1614
+ sig do
1615
+ params(
1616
+ a: Numeric,
1617
+ b: Numeric,
1618
+ c: Numeric,
1619
+ d: Numeric,
1620
+ e: Numeric,
1621
+ f: Numeric
1622
+ ).void
1623
+ end
1624
+ def initialize(a, b, c, d, e, f)
1625
+ @a = T.let(T.unsafe(nil), Numeric)
1626
+ @b = T.let(T.unsafe(nil), Numeric)
1627
+ @c = T.let(T.unsafe(nil), Numeric)
1628
+ @d = T.let(T.unsafe(nil), Numeric)
1629
+ @e = T.let(T.unsafe(nil), Numeric)
1630
+ @f = T.let(T.unsafe(nil), Numeric)
1631
+ end
1632
+
1633
+ sig { returns(String) }
1634
+ def inspect; end
1635
+
1636
+ sig { returns(T::Array[Numeric]) }
1637
+ def to_a; end
1638
+
1639
+ sig do
1640
+ params(
1641
+ a: Numeric,
1642
+ b: Numeric,
1643
+ c: Numeric,
1644
+ d: Numeric,
1645
+ e: Numeric,
1646
+ f: Numeric
1647
+ ).returns(PDF::Reader::TransformationMatrix)
1648
+ end
1649
+ def multiply!(a, b, c, d, e, f); end
1650
+
1651
+ sig { params(e2: Numeric).void }
1652
+ def horizontal_displacement_multiply!(e2); end
1653
+
1654
+ sig do
1655
+ params(
1656
+ a2: Numeric,
1657
+ b2: Numeric,
1658
+ c2: Numeric,
1659
+ d2: Numeric,
1660
+ e2: Numeric,
1661
+ f2: Numeric
1662
+ ).void
1663
+ end
1664
+ def horizontal_displacement_multiply_reversed!(a2, b2, c2, d2, e2, f2); end
1665
+
1666
+ sig do
1667
+ params(
1668
+ a2: Numeric,
1669
+ b2: Numeric,
1670
+ c2: Numeric,
1671
+ d2: Numeric,
1672
+ e2: Numeric,
1673
+ f2: Numeric
1674
+ ).void
1675
+ end
1676
+ def xy_scaling_multiply!(a2, b2, c2, d2, e2, f2); end
1677
+
1678
+ sig do
1679
+ params(
1680
+ a2: Numeric,
1681
+ b2: Numeric,
1682
+ c2: Numeric,
1683
+ d2: Numeric,
1684
+ e2: Numeric,
1685
+ f2: Numeric
1686
+ ).void
1687
+ end
1688
+ def xy_scaling_multiply_reversed!(a2, b2, c2, d2, e2, f2); end
1689
+
1690
+ sig do
1691
+ params(
1692
+ a2: Numeric,
1693
+ b2: Numeric,
1694
+ c2: Numeric,
1695
+ d2: Numeric,
1696
+ e2: Numeric,
1697
+ f2: Numeric
1698
+ ).void
1699
+ end
1700
+ def regular_multiply!(a2, b2, c2, d2, e2, f2); end
1701
+
1702
+ sig do
1703
+ params(
1704
+ a2: Numeric,
1705
+ b2: Numeric,
1706
+ c2: Numeric,
1707
+ d2: Numeric,
1708
+ e2: Numeric,
1709
+ f2: Numeric
1710
+ ).void
1711
+ end
1712
+ def faster_multiply!(a2, b2, c2, d2, e2, f2); end
1713
+ end
1714
+
1715
+ class TypeCheck
1716
+
1717
+ sig { params(obj: T.untyped).returns(Integer) }
1718
+ def self.cast_to_int!(obj); end
1719
+
1720
+ sig { params(obj: T.untyped).returns(Numeric) }
1721
+ def self.cast_to_numeric!(obj); end
1722
+
1723
+ sig { params(string: T.untyped).returns(String) }
1724
+ def self.cast_to_string!(string); end
1725
+
1726
+ sig { params(obj: T.untyped).returns(T.nilable(Symbol)) }
1727
+ def self.cast_to_symbol(obj); end
1728
+
1729
+ sig { params(obj: T.untyped).returns(Symbol) }
1730
+ def self.cast_to_symbol!(obj); end
1731
+
1732
+ sig { params(obj: T.untyped).returns(T::Hash[Symbol, T.untyped]) }
1733
+ def self.cast_to_pdf_dict!(obj); end
1734
+
1735
+ sig { params(obj: T.untyped).returns(T::Hash[Symbol, PDF::Reader::Stream]) }
1736
+ def self.cast_to_pdf_dict_with_stream_values!(obj); end
1737
+ end
1738
+
1739
+ class ValidatingReceiver
1740
+ sig { params(wrapped: T.untyped).void }
1741
+ def initialize(wrapped)
1742
+ @wrapped = T.let(T.unsafe(nil), T.untyped)
1743
+ end
1744
+
1745
+ sig { params(page: PDF::Reader::Page).void }
1746
+ def page=(page); end
1747
+
1748
+ sig { params(args: T.untyped).void }
1749
+ def save_graphics_state(*args); end
1750
+
1751
+ sig { params(args: T.untyped).void }
1752
+ def restore_graphics_state(*args); end
1753
+
1754
+ sig { params(args: T.untyped).void }
1755
+ def concatenate_matrix(*args); end
1756
+
1757
+ sig { params(args: T.untyped).void }
1758
+ def begin_text_object(*args); end
1759
+
1760
+ sig { params(args: T.untyped).void }
1761
+ def end_text_object(*args); end
1762
+
1763
+ sig { params(args: T.untyped).void }
1764
+ def set_character_spacing(*args); end
1765
+
1766
+ sig { params(args: T.untyped).void }
1767
+ def set_horizontal_text_scaling(*args); end
1768
+
1769
+ sig { params(args: T.untyped).void }
1770
+ def set_text_font_and_size(*args); end
1771
+
1772
+ sig { params(args: T.untyped).void }
1773
+ def set_text_leading(*args); end
1774
+
1775
+ sig { params(args: T.untyped).void }
1776
+ def set_text_rendering_mode(*args); end
1777
+
1778
+ sig { params(args: T.untyped).void }
1779
+ def set_text_rise(*args); end
1780
+
1781
+ sig { params(args: T.untyped).void }
1782
+ def set_word_spacing(*args); end
1783
+
1784
+ sig { params(args: T.untyped).void }
1785
+ def move_text_position(*args); end
1786
+
1787
+ sig { params(args: T.untyped).void }
1788
+ def move_text_position_and_set_leading(*args); end
1789
+
1790
+ sig { params(args: T.untyped).void }
1791
+ def set_text_matrix_and_text_line_matrix(*args); end
1792
+
1793
+ sig { params(args: T.untyped).void }
1794
+ def move_to_start_of_next_line(*args); end
1795
+
1796
+ sig { params(args: T.untyped).void }
1797
+ def show_text(*args); end
1798
+
1799
+ sig { params(args: T.untyped).void }
1800
+ def show_text_with_positioning(*args); end
1801
+
1802
+ sig { params(args: T.untyped).void }
1803
+ def move_to_next_line_and_show_text(*args); end
1804
+
1805
+ sig { params(args: T.untyped).void }
1806
+ def set_spacing_next_line_show_text(*args); end
1807
+
1808
+ sig { params(args: T.untyped).void }
1809
+ def invoke_xobject(*args); end
1810
+
1811
+ sig { params(args: T.untyped).void }
1812
+ def begin_inline_image(*args); end
1813
+
1814
+ sig { params(args: T.untyped).void }
1815
+ def begin_inline_image_data(*args); end
1816
+
1817
+ sig { params(args: T.untyped).void }
1818
+ def end_inline_image(*args); end
1819
+
1820
+ sig { params(meth: T.untyped).returns(T::Boolean) }
1821
+ def respond_to?(meth); end
1822
+
1823
+ sig { params(methodname: Symbol, args: T.untyped).void }
1824
+ def method_missing(methodname, *args); end
1825
+
1826
+ sig { params(methodname: T.untyped, args: T.untyped).void }
1827
+ def call_wrapped(methodname, *args); end
1828
+ end
1829
+
1830
+ class UnimplementedSecurityHandler
1831
+ sig { params(encrypt: T.untyped).returns(T.untyped) }
1832
+ def self.supports?(encrypt); end
1833
+
1834
+ sig { params(buf: T.untyped, ref: T.untyped).returns(T.untyped) }
1835
+ def decrypt(buf, ref); end
1836
+ end
1837
+
1838
+ class XRef
1839
+ include Enumerable
1840
+ extend T::Generic # Provides `type_member` helper
1841
+
1842
+ sig { returns(T::Hash[Symbol, T.untyped]) }
1843
+ attr_reader :trailer
1844
+
1845
+ sig { params(io: T.any(IO, Tempfile, StringIO)).void }
1846
+ def initialize(io)
1847
+ @io = T.let(T.unsafe(nil), T.any(IO, Tempfile, StringIO))
1848
+ @junk_offset = T.let(T.unsafe(nil), Integer)
1849
+ @xref = T.let(T.unsafe(nil), T::Hash[Integer, T::Hash[Integer, Integer]])
1850
+ @trailer = T.let(T.unsafe(nil), T::Hash[Symbol, T.untyped])
1851
+ end
1852
+
1853
+ sig { returns(T.untyped) }
1854
+ def size; end
1855
+
1856
+ sig { params(ref: T.untyped).returns(T.untyped) }
1857
+ def [](ref); end
1858
+
1859
+ sig { params(block: T.untyped).returns(T.untyped) }
1860
+ def each(&block); end
1861
+
1862
+ sig { params(offset: T.untyped).returns(T.untyped) }
1863
+ def load_offsets(offset = nil); end
1864
+
1865
+ sig { params(buf: T.untyped).returns(T.untyped) }
1866
+ def load_xref_table(buf); end
1867
+
1868
+ sig { params(stream: T.untyped).returns(T.untyped) }
1869
+ def load_xref_stream(stream); end
1870
+
1871
+ sig { params(bytes: T.untyped).returns(T.untyped) }
1872
+ def unpack_bytes(bytes); end
1873
+
1874
+ sig { params(offset: T.untyped).returns(T.untyped) }
1875
+ def new_buffer(offset = 0); end
1876
+
1877
+ sig { params(id: T.untyped, gen: T.untyped, offset: T.untyped).returns(T.untyped) }
1878
+ def store(id, gen, offset); end
1879
+
1880
+ sig { params(io: T.untyped).returns(T.untyped) }
1881
+ def calc_junk_offset(io); end
1882
+ end
1883
+
1884
+ class ZeroWidthRunsFilter
1885
+ sig { params(runs: T::Array[PDF::Reader::TextRun]).returns(T::Array[PDF::Reader::TextRun]) }
1886
+ def self.exclude_zero_width_runs(runs); end
1887
+ end
1888
+
1889
+ module Filter
1890
+ sig { params(name: Symbol, options: T::Hash[T.untyped, T.untyped]).returns(T.untyped) }
1891
+ def self.with(name, options = {}); end
1892
+
1893
+ class Ascii85
1894
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1895
+ def initialize(options = {})
1896
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1897
+ end
1898
+
1899
+ sig { params(data: String).returns(String) }
1900
+ def filter(data); end
1901
+ end
1902
+
1903
+ class AsciiHex
1904
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1905
+ def initialize(options = {})
1906
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1907
+ end
1908
+
1909
+ sig { params(data: String).returns(String) }
1910
+ def filter(data); end
1911
+ end
1912
+
1913
+ class Depredict
1914
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1915
+ def initialize(options = {})
1916
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1917
+ end
1918
+
1919
+ sig { params(data: String).returns(String) }
1920
+ def filter(data); end
1921
+
1922
+ sig { params(data: T.untyped).returns(T.untyped) }
1923
+ def tiff_depredict(data); end
1924
+
1925
+ sig { params(data: T.untyped).returns(T.untyped) }
1926
+ def png_depredict(data); end
1927
+ end
1928
+
1929
+ class Flate
1930
+ ZLIB_AUTO_DETECT_ZLIB_OR_GZIP = 47
1931
+ ZLIB_RAW_DEFLATE = -15
1932
+
1933
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1934
+ def initialize(options = {})
1935
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1936
+ end
1937
+
1938
+ sig { params(data: String).returns(String) }
1939
+ def filter(data); end
1940
+
1941
+ sig { params(data: T.untyped).returns(T.untyped) }
1942
+ def zlib_inflate(data); end
1943
+ end
1944
+
1945
+ class Lzw
1946
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1947
+ def initialize(options = {})
1948
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1949
+ end
1950
+
1951
+ sig { params(data: String).returns(String) }
1952
+ def filter(data); end
1953
+ end
1954
+
1955
+ class Null
1956
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1957
+ def initialize(options = {})
1958
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1959
+ end
1960
+
1961
+ sig { params(data: T.untyped).returns(T.untyped) }
1962
+ def filter(data); end
1963
+ end
1964
+
1965
+ class RunLength
1966
+ sig { params(options: T::Hash[T.untyped, T.untyped]).void }
1967
+ def initialize(options = {})
1968
+ @options = T.let(T.unsafe(nil), T::Hash[T.untyped, T.untyped])
1969
+ end
1970
+
1971
+ sig { params(data: String).returns(String) }
1972
+ def filter(data); end
1973
+ end
1974
+ end
1975
+
1976
+ module WidthCalculator
1977
+ class BuiltIn
1978
+ BUILTINS = T.let(T.unsafe(nil), T::Array[Symbol])
1979
+
1980
+ @@all_metrics = T.let(T.unsafe(nil), T.nilable(PDF::Reader::SynchronizedCache))
1981
+
1982
+ sig { params(font: PDF::Reader::Font).void }
1983
+ def initialize(font)
1984
+ @font = T.let(T.unsafe(nil), PDF::Reader::Font)
1985
+ @metrics = T.let(T.unsafe(nil), AFM::Font)
1986
+ end
1987
+
1988
+ sig { params(code_point: T.nilable(Integer)).returns(Numeric) }
1989
+ def glyph_width(code_point); end
1990
+
1991
+ sig { params(code_point: Integer).returns(T::Boolean) }
1992
+ def control_character?(code_point); end
1993
+
1994
+ sig { params(font_name: T.nilable(Symbol)).returns(String) }
1995
+ def extract_basefont(font_name); end
1996
+ end
1997
+
1998
+ class Composite
1999
+ sig { params(font: PDF::Reader::Font).void }
2000
+ def initialize(font)
2001
+ @font = T.let(T.unsafe(nil), PDF::Reader::Font)
2002
+ @widths = T.let(T.unsafe(nil), PDF::Reader::CidWidths)
2003
+ end
2004
+
2005
+ sig { params(code_point: T.nilable(Integer)).returns(Numeric) }
2006
+ def glyph_width(code_point); end
2007
+ end
2008
+
2009
+ class TrueType
2010
+ sig { params(font: PDF::Reader::Font).void }
2011
+ def initialize(font)
2012
+ @font = T.let(T.unsafe(nil), PDF::Reader::Font)
2013
+ @missing_width = T.let(T.unsafe(nil), Numeric)
2014
+ end
2015
+
2016
+ sig { params(code_point: T.nilable(Integer)).returns(Numeric) }
2017
+ def glyph_width(code_point); end
2018
+
2019
+ sig { params(code_point: Integer).returns(T.nilable(Numeric)) }
2020
+ def glyph_width_from_font(code_point); end
2021
+
2022
+ sig { params(code_point: Integer).returns(T.nilable(Numeric)) }
2023
+ def glyph_width_from_descriptor(code_point); end
2024
+ end
2025
+
2026
+ class TypeOneOrThree
2027
+ sig { params(font: PDF::Reader::Font).void }
2028
+ def initialize(font)
2029
+ @font = T.let(T.unsafe(nil), PDF::Reader::Font)
2030
+ @missing_width = T.let(T.unsafe(nil), Numeric)
2031
+ end
2032
+
2033
+ sig { params(code_point: T.nilable(Integer)).returns(Numeric) }
2034
+ def glyph_width(code_point); end
2035
+ end
2036
+
2037
+ class TypeZero
2038
+ sig { params(font: PDF::Reader::Font).void }
2039
+ def initialize(font)
2040
+ @font = T.let(T.unsafe(nil), PDF::Reader::Font)
2041
+ end
2042
+
2043
+ sig { params(code_point: T.nilable(Integer)).returns(Numeric) }
2044
+ def glyph_width(code_point); end
2045
+ end
2046
+ end
2047
+ end
2048
+ end