pdf-reader 2.4.1 → 2.7.0

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