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

Class PDFStreamParser

pattern/web/pdf/pdfparser.py:760–791  ·  view source on GitHub ↗

PDFStreamParser is used to parse PDF content streams that is contained in each page and has instructions for rendering the page. A reference to a PDF document is needed because a PDF content stream can also have indirect references to other objects in the same document.

Source from the content-addressed store, hash-verified

758## PDFStreamParser
759##
760class PDFStreamParser(PDFParser):
761
762 """
763 PDFStreamParser is used to parse PDF content streams
764 that is contained in each page and has instructions
765 for rendering the page. A reference to a PDF document is
766 needed because a PDF content stream can also have
767 indirect references to other objects in the same document.
768 """
769
770 def __init__(self, data):
771 PDFParser.__init__(self, StringIO(data))
772 return
773
774 def flush(self):
775 self.add_results(*self.popall())
776 return
777
778 def do_keyword(self, pos, token):
779 if token is self.KEYWORD_R:
780 # reference to indirect object
781 try:
782 ((_,objid), (_,genno)) = self.pop(2)
783 (objid, genno) = (int(objid), int(genno))
784 obj = PDFObjRef(self.doc, objid, genno)
785 self.push((pos, obj))
786 except PSSyntaxError:
787 pass
788 return
789 # others
790 self.push((pos, token))
791 return

Callers 1

getobjMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…