Important: Please read the Qt Code of Conduct -

CUPS for WebAssembly

  • Hi, I'm new to QT and I'm trying to run the CUPS API in my QT app and compile it with WebAssembly. However, it seems that an exception "getpwnam: TODO" was thrown.

    I tried to run this code below in 5.14.1 but it seems to fail after QPrinterInfo::availablePrinters() was called.

        int count = 0;
        qDebug() << "before QPrinterInfo";
        QList<QPrinterInfo> info_list = QPrinterInfo::availablePrinters();
        qDebug() << "after QPrinterInfo";
        foreach ( QPrinterInfo info, info_list )
            qDebug()<< "Printer_"<< count<< ": " << info.printerName() << "State: " << info.state();
            if(info.printerName() == "YOUR_PRINTER_NAME")
                if (info.state() == 0)
                    qDebug()<< "Printer Idle";
                else if (info.state() == 1)
                    qDebug()<< "Printer Active";
                else if (info.state() == 2)
                    qDebug()<< "Printer Aborted";
                else if (info.state() == 3)
                    qDebug()<< "Printer Error";
                    qDebug()<< "Printer Undefined Error";

    I also tried the code provided by the cups API documentation but failed after calling the function cupsGetDests

    cups_dest_t *dests;
    int num_dests = cupsGetDests(&dests); // exception getpwnam: TODO is thrown 

    Is there a way to determine the number of printers installed and access their corresponding information?

  • @wild-linkle said in CUPS for WebAssembly:


    Wasm lives in the same sandbox as javascript. Accessing printers and other hardware is not supported at this time.

Log in to reply