Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. cups "Print file was not accepted" when using QPrinter
Qt 6.11 is out! See what's new in the release blog

cups "Print file was not accepted" when using QPrinter

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 974 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wthung
    wrote on last edited by
    #1

    Hi,

    We are running cups 1.5.3 on Ubuntu 12.04. When using QPrinter to print an image file, the cups shows the error "Print file was not accepted" in the error_log. The sample code is very simple as below:

    QPrinter printer;
    printer.setPrinterName("HP");
    
    QImage image("/usr/local/test/test.bmp");
    QPainter painter;
    painter.begin(&printer);
    
    painter.drawImage(0, 0, image);
    
    painter.end();
    

    The Qt documentation says QPrinter sends PDF to the printer in X11 cups system. However in the error_log, we saw the cups received "application/octet-stream" in the print job. It is different to the documentation.

    We try to use "lpr test.pdf" to print a PDF file and it's no problem. It is obvious that the cups is able to print a PDF file directly by lpr. So what's the problem when using QPrinter?

    Below is a part of error_log:

    D [05/Jun/2017:09:28:01 +0800] [Job 14] Getting supported attributes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Get-Printer-Attributes: successful-ok (successful-ok)
    D [05/Jun/2017:09:28:01 +0800] [Job 14] document-format-supported (5 values)
    D [05/Jun/2017:09:28:01 +0800] [Job 14] [0] = "text/plain"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] [1] = "text/plain; charset=US-ASCII"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] [2] = "application/postscript"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] [3] = "application/vnd.hp-PCL"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] [4] = "application/octet-stream"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Printer supports Create-Job but not Send-Document.
    D [05/Jun/2017:09:28:01 +0800] [Job 14] update_reasons(attr=1(none), s="(null)")
    D [05/Jun/2017:09:28:01 +0800] [Job 14] STATE: -none
    D [05/Jun/2017:09:28:01 +0800] [Job 14] final_content_type="application/octet-stream", document_format="application/octet-stream"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Validate-Job IPP/1.1
    D [05/Jun/2017:09:28:01 +0800] [Job 14] printer-uri="ipp://172.16.196.7:631/"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] requesting-user-name="root"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] job-name="14 - "
    D [05/Jun/2017:09:28:01 +0800] [Job 14] document-format="application/octet-stream"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] update_reasons(attr=1(none), s="(null)")
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Get-Printer-Attributes: successful-ok (successful-ok)
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Validate-Job: client-error-bad-request (client-error-bad-request)
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Print-Job IPP/1.1
    D [05/Jun/2017:09:28:01 +0800] [Job 14] printer-uri="ipp://172.16.196.7:631/"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] requesting-user-name="root"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] job-name="14 - "
    D [05/Jun/2017:09:28:01 +0800] [Job 14] document-format="application/octet-stream"
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Sending file using HTTP/1.1 chunking...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Get-Jobs: client-error-bad-request (client-error-bad-request)
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:01 +0800] [Job 14] Read 16384 bytes...
    D [05/Jun/2017:09:28:02 +0800] [Job 14] Read 6015 bytes...
    D [05/Jun/2017:09:28:02 +0800] [Job 14] Print-Job: client-error-bad-request (client-error-bad-request)
    E [05/Jun/2017:09:28:02 +0800] [Job 14] Print file was not accepted.

    Thanks.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved