feat: PostScript stream processing with account code injection
This commit is contained in:
@@ -24,5 +24,24 @@ def get_account_code(options):
|
||||
return code.zfill(8)
|
||||
|
||||
|
||||
def process_stream(lines, account_code):
|
||||
if not account_code:
|
||||
yield from lines
|
||||
return
|
||||
|
||||
inject = f"({account_code}) statusdict /setmanagementnumber get exec\n".encode()
|
||||
injected = False
|
||||
|
||||
for line in lines:
|
||||
stripped = line.rstrip(b'\r\n')
|
||||
if not injected and (stripped == b'%%EndSetup' or stripped.startswith(b'%%Page:')):
|
||||
yield inject
|
||||
injected = True
|
||||
yield line
|
||||
|
||||
if not injected:
|
||||
sys.stderr.write("kyofilter: WARNING: no injection point found in PostScript stream\n")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user