Open callumgare opened 2 years ago
@Ljzd-PRO Thanks for approving this. Were you expecting me to merge it? Unfortunately I do not have write permissions to this repo so I can't merge.
I would suggest using attrs.get(...)
instead.
Traceback (most recent call last):
File "/opt/./airprint-generate.py", line 289, in <module>
apg.generate()
File "/opt/./airprint-generate.py", line 184, in generate
if attrs['color-supported']:
KeyError: 'color-supported'
Traceback (most recent call last):
File "/opt/./airprint-generate.py", line 289, in <module>
apg.generate()
File "/opt/./airprint-generate.py", line 189, in generate
if attrs['media-default'] == 'iso_a4_210x297mm':
KeyError: 'media-default'
To be honest, it’s been so long since i wrote this and I no longer have a printer set up using this, so it would be difficult for me to make those changes and test it. Happy for anyone else to make those changes if desired.
Tested ok from iPad with cups-pdf virtual printer on Rocky Linux 9.3. Before applying the patch, iPad would only print in monochrome resulting in a monochrome PDF. After the patch was applied, color is available.
Currently the avahi service file generated doesn't include whether the printer can print colour or not which causes iOS to assume the printer can only print black and white. It also doesn't include the default paper size which causes iOS to default to US letter size. This PR will cause it to add the colour flag if the printer supports colour and set the paper size to A4 if that's the default paper size of the printer.