feat: PostScript stream processing with account code injection

This commit is contained in:
Oliver Hofmann
2026-06-02 21:01:55 +02:00
parent e938e90284
commit ca895889f9
2 changed files with 61 additions and 0 deletions
+19
View File
@@ -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