jipp icon indicating copy to clipboard operation
jipp copied to clipboard

overrides appears to be ignored

Open andygarratt opened this issue 1 year ago • 3 comments

Hi,

We are trying to apply overrides in a print job, for example to use a different media for the first page or to apply sides to the first page, we are able to add the command but it appears ignored, the only difference between what we are doing and what PWG suggest is we are using job-attributes and not job-template

https://ftp.pwg.org/pub/pwg/candidates/cs-ipppageoverride10-20031031-5100.6.pdf

Has anyone had success with this and is job-template supported by jipp?

Get-Attributes confirms the device supports overrides and sides within overrides.

andygarratt avatar Mar 09 '23 16:03 andygarratt

Here is an example of what we are sending to have the first page simplex

(v=0x200, c=Print-Job(2), r=0x1) {
operation-attributes {
   attributes-charset = utf-8,
   attributes-natural-language = en-us,
   printer-uri = ipp://192.168.0.161:631/ipp/print,
   requesting-user-name = "Cirros-C4-J13165" (name),
   document-format = application/pdf },
job-attributes {
   copies = 1,
   print-color-mode = color,
   sides = two-sided-long-edge,
   print-scaling = none,
   media-col = 
   {
     media-size = { x-dimension = 21000, y-dimension = 29700 },
     media-source = auto,
     media-type = auto },
   finishings = [ punch(3), staple(3) ],
   multiple-document-handling = separate-documents-collated-copies,
   overrides = { pages = 1..1, sides = one-sided } } }

andygarratt avatar Mar 09 '23 16:03 andygarratt

This is the example from PWG

Print-Job
job template attributes group
media: letter
overrides: {
pages: 1:1
media: letterhead }
end-of-attributes
 Document A 

andygarratt avatar Mar 09 '23 16:03 andygarratt

I can confirm, Overrides ignore everything else besides the three documented members (document-copies, document-numbers, pages). Looks like genTypes.py is ignoring the definition "<Any Job Template attribute>" of https://www.pwg.org/ipp/ipp-registrations.xml. I was able to workaround it by providing an Implementation of AttributeCollection:

public class SimpleAttributeCollection implements AttributeCollection {
    private final List<Attribute<?>> attributes;

    public SimpleAttributeCollection(List<Attribute<?>> attributes) {
        this.attributes = attributes;
    }

    @NonNull
    @Override
    public List<Attribute<?>> getAttributes() {
        return attributes;
    }

    @Override
    public void print(@NonNull PrettyPrinter printer) {
        printer.open(PrettyPrinter.OBJECT);
        printer.addAll(attributes);
        printer.close();
    }
}

and then adding the Override as an UnknownAttribute packed with above class:

new UnknownAttribute(overrides.getName(),
    new SimpleAttributeCollection(List.of(
        new UnknownAttribute(Types.pages.getName(), new IntRange(1, 1)),
        mediaCol.of(MediaCol.Companion.convert(List.of(MediaCol.mediaSource.of(MediaSource.tray4))))
)));

paaw2023 avatar Feb 22 '24 13:02 paaw2023

@andygarratt we have added a fix for overrides attributes in Release v0.7.16-beta1. Can you try reproducing the issue with library version v0.7.16-beta1

HPNavjot avatar Jul 30 '24 03:07 HPNavjot

Fix present in v0.7.16. Hence closing.

HPSudip avatar Aug 14 '24 00:08 HPSudip