Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate attributes for colour and paper size #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

callumgare
Copy link

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.

@callumgare
Copy link
Author

@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.

@Arnie97
Copy link

Arnie97 commented Feb 20, 2023

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'

@callumgare
Copy link
Author

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.

@sobjerke
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants