TheHeadlessSourceMan / virtualPrinter

Easily create a windows virtual printer device using python.
MIT License
43 stars 17 forks source link

IndexError: list index out of range #3

Open Megidd opened 7 months ago

Megidd commented 7 months ago

The following error is received when a test page is sent to the printer by Windows:

(virtual_env) C:\Users\m3\repos\virtualPrinter>python myPrinter.py
GHOSTSCRIPT_APP="C:\Program Files\gs\gs10.03.0\bin\gswin64c.exe"
Starting printer... [CTRL+C to stop]
Opening 127.0.0.1:51349
b'Microsoft (R) Windows Script Host Version 5.812\r\nCopyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nCreated/updated port Print to Image Port\r\n'
['rundll32', 'printui.dll,PrintUIEntry', '/if', '/b', 'Print to Image', '/r', 'Print to Image Port', '/m', 'HP Color LaserJet 2800 Series PS', '/Z']
b''
b''

Listening for incoming print job...
Incoming job... spooling...
Traceback (most recent call last):
  File "C:\Users\m3\repos\virtualPrinter\myPrinter.py", line 97, in <module>
    p.run()
  File "C:\Users\m3\repos\virtualPrinter\printer.py", line 140, in run
    self._server.run()
  File "C:\Users\m3\repos\virtualPrinter\printServer.py", line 157, in run
    header='@'+combinedBuf.split('%!PS-',1)[0].split('@',1)[1]
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
Megidd commented 7 months ago

The error is thrown while printing both image documents and text documents.

Image document

2024-04-17 12_36_30-printServer py - virtualPrinter - Visual Studio Code

Text document

2024-04-17 12_43_19-printServer py - virtualPrinter - Visual Studio Code