@@ -3467,23 +3467,23 @@ def remove_hidden(cont_lines):
3467
3467
suppress = False # indicate text suppression active
3468
3468
make_return = False
3469
3469
for line in cont_lines :
3470
- if line == "BT" : # start of text object
3470
+ if line == b "BT" : # start of text object
3471
3471
in_text = True # switch on
3472
3472
out_lines .append (line ) # output it
3473
3473
continue
3474
- if line == "ET" : # end of text object
3474
+ if line == b "ET" : # end of text object
3475
3475
in_text = False # switch off
3476
3476
out_lines .append (line ) # output it
3477
3477
continue
3478
- if line == "3 Tr" : # text suppression operator
3478
+ if line == b "3 Tr" : # text suppression operator
3479
3479
suppress = True # switch on
3480
3480
make_return = True
3481
3481
continue
3482
- if line [- 2 :] == "Tr" and line [0 ] != "3" :
3482
+ if line [- 2 :] == b "Tr" and line [0 ] != b "3" :
3483
3483
suppress = False # text rendering changed
3484
3484
out_lines .append (line )
3485
3485
continue
3486
- if line == "Q" : # unstack command also switches off
3486
+ if line == b "Q" : # unstack command also switches off
3487
3487
suppress = False
3488
3488
out_lines .append (line )
3489
3489
continue
@@ -3578,10 +3578,10 @@ def remove_hidden(cont_lines):
3578
3578
3579
3579
if hidden_text :
3580
3580
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
3582
3582
cont_lines = remove_hidden (cont .splitlines ()) # remove hidden text
3583
3583
if cont_lines : # something was actually removed
3584
- cont = "\n " .join (cont_lines ). encode ( )
3584
+ cont = b "\n " .join (cont_lines )
3585
3585
doc .updateStream (xref , cont ) # rewrite the page /Contents
3586
3586
3587
3587
0 commit comments