# Cuts every media size except one out of a CUPS PPD. # # macOS and Windows add this printer driverless: they never see this PPD, they # see the IPP media-supported list cupsd derives from it. Trimming here is # therefore the only way to make 4x6 the single choice a client can offer -- # there is no lpadmin option that restricts the media list. # # Regenerated from the driver's own PPD on every deploy, so a driver version # bump carries its new PPD through this filter rather than being pinned to a # fork. # # awk -v keep=w288h432 -f trim-ppd-media.awk tspl-label.ppd # # The four families below are keyed by the PPD page-size keyword in field 2, # which reads as "w288h432/4 x 6 in:" -- hence the split on "/". /^\*(PageSize|PageRegion|ImageableArea|PaperDimension) / { split($2, f, "/") if (f[1] != keep) next } # Custom sizes would put "Manage Custom Sizes" back in the client's paper menu # and let a job arrive at any dimension, which is the thing being prevented. /^\*(CustomPageSize|ParamCustomPageSize|MaxMediaWidth|MaxMediaHeight)/ { next } { print }