Cups4J.org

The Cups4J user Forum
It is currently Mon Nov 20, 2017 12:34 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Feb 24, 2012 8:16 pm 
Offline

Joined: Fri Feb 24, 2012 7:52 pm
Posts: 1
I had to add another Cups operation to retrieve the contents of the PPD file for a given printer-uri. This also involved modifying IppResult and IppResponse to let the CupsGetPPDOperation get at the entire returned buffer, which I couldn't find another way around.

I attached a zip of the CupsGetPPDOperation, the modified IppResult and IppResponse classes, and patches for both of them to show where changes were made.

Parsing out the PPD from the attributes in the response buffer could be a bit cleaner. Right now it just throws out everything before the first '*'. Also, the method only works on printer-uri, but I'm fairly CUPS also supports ppd-name.


Attachments:
CupsGetPPDOperation.zip [8.45 KiB]
Downloaded 3755 times
Top
 Profile  
 
PostPosted: Sun Oct 27, 2013 7:42 pm 
Offline

Joined: Sat Oct 26, 2013 5:03 pm
Posts: 1
I noticed a problem with this patch (which I've been using for some time - thanks) the other day.

If the printer is on a different CUPS server to the one addressed by printer_uri, the result contains a reference to the correct URL rather than a ppd file. You could for example:

Code:
    IppResult result = request(url, map);
    String urlStr = null;
    for (AttributeGroup group : result.getAttributeGroupList()){
        if (group.getTagName().equals("operation-attributes-tag")){
            for (Attribute attr : group.getAttribute()) {
                if (attr.getName().equals("printer-uri")){
                    urlStr = (attr.getAttributeValue().get(0).getValue());
                    break;
                }
            }
        }
    }


And repeat the request (changing ipp:// in urlStr for http) if urlStr is not null.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group