Use OperandGrouper whitelist

This commit is contained in:
James R. Barlow
2018-05-24 22:52:33 -07:00
parent 0a04a60f69
commit 6d0461435f
+3 -1
View File
@@ -150,8 +150,10 @@ def _interpret_contents(contentstream, initial_shorthand=UNIT_SQUARE):
found_text = False
text_operators = tuple(
pikepdf.Operator(op) for op in ('Tj', 'TJ', '"', "'"))
operator_whitelist = """q Q Do cm TJ Tj " ' BI ID EI"""
for n, op in enumerate(pikepdf.parse_content_stream(contentstream)):
for n, op in enumerate(
pikepdf.parse_content_stream(contentstream, operator_whitelist)):
operands, command = op
if command == pikepdf.Operator('q'):
stack.append(ctm)