pdf-reader 2.4.2 → 2.8.0

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