@@ -3467,23 +3467,23 @@ def remove_hidden(cont_lines):
34673467 suppress = False # indicate text suppression active
34683468 make_return = False
34693469 for line in cont_lines :
3470- if line == "BT" : # start of text object
3470+ if line == b "BT" : # start of text object
34713471 in_text = True # switch on
34723472 out_lines .append (line ) # output it
34733473 continue
3474- if line == "ET" : # end of text object
3474+ if line == b "ET" : # end of text object
34753475 in_text = False # switch off
34763476 out_lines .append (line ) # output it
34773477 continue
3478- if line == "3 Tr" : # text suppression operator
3478+ if line == b "3 Tr" : # text suppression operator
34793479 suppress = True # switch on
34803480 make_return = True
34813481 continue
3482- if line [- 2 :] == "Tr" and line [0 ] != "3" :
3482+ if line [- 2 :] == b "Tr" and line [0 ] != b "3" :
34833483 suppress = False # text rendering changed
34843484 out_lines .append (line )
34853485 continue
3486- if line == "Q" : # unstack command also switches off
3486+ if line == b "Q" : # unstack command also switches off
34873487 suppress = False
34883488 out_lines .append (line )
34893489 continue
@@ -3578,10 +3578,10 @@ def remove_hidden(cont_lines):
35783578
35793579 if hidden_text :
35803580 xref = page .getContents ()[0 ] # only one b/o cleaning!
3581- cont = doc .xrefStream (xref ). decode () # /Contents converted to str
3581+ cont = doc .xrefStream (xref ) # /Contents as bytes
35823582 cont_lines = remove_hidden (cont .splitlines ()) # remove hidden text
35833583 if cont_lines : # something was actually removed
3584- cont = "\n " .join (cont_lines ). encode ( )
3584+ cont = b "\n " .join (cont_lines )
35853585 doc .updateStream (xref , cont ) # rewrite the page /Contents
35863586
35873587
0 commit comments