Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

Generate attributes for colour and paper size#34

Open
callumgare wants to merge 1 commit into
tjfontaine:masterfrom
callumgare:add-colour-and-size-attribs
Open

Generate attributes for colour and paper size#34
callumgare wants to merge 1 commit into
tjfontaine:masterfrom
callumgare:add-colour-and-size-attribs

Conversation

@callumgare

Copy link
Copy Markdown

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
Copy Markdown
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

Arnie97 commented Feb 20, 2023

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants