https://bugs.documentfoundation.org/show_bug.cgi?id=173407

            Bug ID: 173407
           Summary: Create a temp queue in CUPS to correctly read the
                    options of driverless printers
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: Printing and PDF export
          Assignee: [email protected]
          Reporter: [email protected]

Description:
LibreOffice can currently recognize driverless printers without directly adding
them to the system. However, in this case, it seems to assume a standard set of
options. For example, duplex is always considered available.

This is because calling cupsGetPPD in GetPPDAttribs::executeCall (cupsmrg.cxx)
for such printers returns nullptr. For auto-discovered IPP printers without a
local CUPS queue, CUPS doesn't have a PPD yet. A workaround is to create a
temporary queue by calling cupsCopyDestInfo and then calling cupsGetPPD again.
This solution was recently introduced in Qt
(https://codereview.qt-project.org/c/qt/qtbase/+/747637)and, apparently, a
similar solution is also used in GTK.

Is it possible to implement a similar solution in LO? Something like the
following code:

struct GetPPDAttribs
{
...
    cups_dest_t*        m_pDest;
...
    void executeCall()
    {
    ...
        const char* pResult = cupsGetPPD(m_pDest->name);
        if (pResult == nullptr)
        {
            if (cups_dinfo_t *destInfo = cupsCopyDestInfo(CUPS_HTTP_DEFAULT,
m_pDest))
            {
                cupsFreeDestInfo(destInfo);
                pResult = cupsGetPPD(m_pDest->name);
            }
        }
    ...
    }
...
}

This change was tested with an HP Designjet T920 over WiFi, and resulted in a
device-specific options set. It would be good to check the behavior on other
devices if anyone can join the tests to avoid regression.

A positive aspect of this change is that printers connected using IPP will
receive the correct options set without having to add devices to the system.

A negative aspect is that this appears to be an undocumented behavior of CUPS,
although it is actively used to work around the issue with IPP printers. Also,
the cupsGetPPD method itself does not seem to be included in CUPS 3 and in a
year or two this code will still have to be changed

Steps to Reproduce:
1. Connect a driverless printer to the device (via WiFi or IPP-over-USB)
2. Open or create a document
3. Open the print dialog (File - Print...)
4. Select the printer connected in step 1
5. Open Properties...

Actual Results:
The Paper tab has the Duplex option available for any device. The Device tab
does not display device-specific options.

Expected Results:
The Paper and Device tabs display options that match the actual capabilities of
the device.


Reproducible: Always


User Profile Reset: No

Additional Info:

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to