MCPcopy Index your code
hub / github.com/clips/pattern / get_outlines

Method get_outlines

pattern/web/pdf/pdfparser.py:521–540  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

519 return
520
521 def get_outlines(self):
522 if 'Outlines' not in self.catalog:
523 raise PDFNoOutlines
524 def search(entry, level):
525 entry = dict_value(entry)
526 if 'Title' in entry:
527 if 'A' in entry or 'Dest' in entry:
528 title = decode_text(str_value(entry['Title']))
529 dest = entry.get('Dest')
530 action = entry.get('A')
531 se = entry.get('SE')
532 yield (level, title, dest, action, se)
533 if 'First' in entry and 'Last' in entry:
534 for x in search(entry['First'], level+1):
535 yield x
536 if 'Next' in entry:
537 for x in search(entry['Next'], level):
538 yield x
539 return
540 return search(self.catalog['Outlines'], 0)
541
542 def lookup_name(self, cat, key):
543 try:

Callers

nothing calls this directly

Calls 1

searchFunction · 0.85

Tested by

no test coverage detected