You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the CUPS user interface, you can set a custom paper size by selecting "Custom" for the media size, which adds fields for width and height, and a drop-down for units. When you submit the page, this results in a POST to the /admin endpoint with an OP of set-printer-options, a PageSize of Custom, and fields PageSize.Width, PageSize.Height, and PageSize.Units set to the values you had specified.
The way to customize printer defaults in PyCups seems to be a bit different. You can use cups.Connection.getServerPPD() to fetch a printer PPD, cups.PPD() to instantiate it as an object within Python, call e.g. ppd.setOption('PageSize','w432h576') to select the desired page size, and then pass that PPD object to cups.Connection.addPrinter() to add a new printer with adjusted options. Unfortunately, this doesn't work for custom page sizes; PageSize.Width, PageSize.Height and PageSize.Units don't seem to have any effect when used with cups.PPD.markOption(), and setting PageSize to e.g. Custom.576x432pt (the value that gets stored in the actual PPD for PageSize when you configure things via the CUPS UI) doesn't work either, you end up with the page size set to just Custom, with no actual width or height set.
The text was updated successfully, but these errors were encountered:
I also encountered this problem when setting options, may I ask, have you made other settings take effect? For example, if I want to change the default options in ppd, it doesn't work after using cups.PPD.markOption(). Is this the case where you are? choice = ppd.markOption('StpColorPrecision','Normal')
In the CUPS user interface, you can set a custom paper size by selecting "Custom" for the media size, which adds fields for width and height, and a drop-down for units. When you submit the page, this results in a POST to the
/admin
endpoint with anOP
ofset-printer-options
, aPageSize
ofCustom
, and fieldsPageSize.Width
,PageSize.Height
, andPageSize.Units
set to the values you had specified.The way to customize printer defaults in PyCups seems to be a bit different. You can use
cups.Connection.getServerPPD()
to fetch a printer PPD,cups.PPD()
to instantiate it as an object within Python, call e.g.ppd.setOption('PageSize','w432h576')
to select the desired page size, and then pass that PPD object tocups.Connection.addPrinter()
to add a new printer with adjusted options. Unfortunately, this doesn't work for custom page sizes;PageSize.Width
,PageSize.Height
andPageSize.Units
don't seem to have any effect when used withcups.PPD.markOption()
, and settingPageSize
to e.g.Custom.576x432pt
(the value that gets stored in the actual PPD forPageSize
when you configure things via the CUPS UI) doesn't work either, you end up with the page size set to justCustom
, with no actual width or height set.The text was updated successfully, but these errors were encountered: