gmuth / ipp-client-kotlin

A client implementation of the ipp protocol written in kotlin
MIT License
66 stars 9 forks source link

Sending a print job but nothing happens #20

Closed dustin-auby closed 1 month ago

dustin-auby commented 2 months ago

Hi,

I am getting this following issue. i send a print job to the printer and is says success but nothing happens. i have tried the same url from an iPhone and it works fine its just android with this plugin that has the issue. here are the logs that i receive.

D/TrafficStats(23100): tagSocket(148) with statsTag=0xffffffff, statsUid=-1
I/IppJob  (23100): Wait for termination of job #19
I/IppJob  (23100): Job #19, state=processing (reasons=job-printing), uri=ipp://10.0.2.159/jobs?19
I/IppJob  (23100): Job #19, state=completed (reasons=job-completed-successfully), name=Test, impressions-completed=0, originating-host-name=10.0.2.159, originating-user-name=root, 1 documents, 
printer-uri=ipp://10.0.2.159/ipp/print, uri=ipp://10.0.2.159/jobs?19
dustin-auby commented 2 months ago

I have also tried using the JmDNS method

val jmDns = JmDNS.create() jmDns.list("_ipp._tcp.local.").forEach { val printerName = it.name val printerUri = with(it) { URI.create("ipps://$server:$port/${getPropertyString("rp")}") } // val ippPrinter = IppPrinter(printerUri) println("** $printerName") println("** $printerUri") // println("** $ippPrinter") } jmDns.close()

it returns these results

I/System.out(14496): ** Canon TR4500 series I/System.out(14496): ** ipp://8C2279000000.local.:631/ipp/print

i then get the following error when printing to this url

Error printing file: java.net.UnknownHostException: Unable to resolve host "8c2279000000.local.": No address associated with hostname

dustin-auby commented 2 months ago

ok finally got it to connect but it still wont print. i have tried a jpg and a pdf

I/StandaloneCoroutine( 9265): PRINTER TR4500 series (Canon TR4500 series) I/StandaloneCoroutine( 9265): queued-job-count (integer) = 0 I/StandaloneCoroutine( 9265): copies-default (integer) = 1 I/StandaloneCoroutine( 9265): document-format-supported (1setOf mimeMediaType) = application/octet-stream,image/jpeg,image/urf,image/pwg-raster I/StandaloneCoroutine( 9265): document-format-default (mimeMediaType) = application/octet-stream I/StandaloneCoroutine( 9265): document-format-preferred (mimeMediaType) = image/urf I/StandaloneCoroutine( 9265): orientation-requested-supported (1setOf enum) = portrait I/StandaloneCoroutine( 9265): orientation-requested-default (enum) = portrait I/StandaloneCoroutine( 9265): jpeg-features-supported (1setOf keyword) = none I/StandaloneCoroutine( 9265): jpeg-k-octets-supported (rangeOfInteger) = 0-16384 I/StandaloneCoroutine( 9265): jpeg-x-dimension-supported (rangeOfInteger) = 16-19200 I/StandaloneCoroutine( 9265): jpeg-y-dimension-supported (rangeOfInteger) = 16-19200 I/StandaloneCoroutine( 9265): color-supported (boolean) = true I/StandaloneCoroutine( 9265): finishings-supported (1setOf enum) = none I/StandaloneCoroutine( 9265): finishings-default (1setOf enum) = none I/StandaloneCoroutine( 9265): output-bin-supported (1setOf keyword) = face-up I/StandaloneCoroutine( 9265): output-bin-default (keyword) = face-up I/StandaloneCoroutine( 9265): print-color-mode-supported (1setOf keyword) = color,monochrome,auto,auto-monochrome I/StandaloneCoroutine( 9265): output-mode-supported (1setOf keyword) = color,monochrome,auto,auto-monochrome I/StandaloneCoroutine( 9265): print-color-mode-default (keyword) = color I/StandaloneCoroutine( 9265): output-mode-default (keyword) = color I/StandaloneCoroutine( 9265): pages-per-minute (integer) = 6 I/StandaloneCoroutine( 9265): pages-per-minute-color (integer) = 2 I/StandaloneCoroutine( 9265): pdf-versions-supported (1setOf keyword) = none I/StandaloneCoroutine( 9265): printer-resolution-supported (1setOf resolution) = 600 dpi I/StandaloneCoroutine( 9265): printer-resolution-default (resolution) = 600 dpi I/StandaloneCoroutine( 9265): print-quality-supported (1setOf enum) = normal,high I/StandaloneCoroutine( 9265): print-quality-default (enum) = normal I/StandaloneCoroutine( 9265): sides-supported (1setOf keyword) = one-sided,two-sided-long-edge,two-sided-short-edge I/StandaloneCoroutine( 9265): sides-default (keyword) = one-sided I/StandaloneCoroutine( 9265): landscape-orientation-requested-preferred (enum) = 5 I/StandaloneCoroutine( 9265): charset-configured (charset) = us-ascii I/StandaloneCoroutine( 9265): charset-supported (1setOf charset) = us-ascii,utf-8 I/StandaloneCoroutine( 9265): compression-supported (1setOf keyword) = none I/StandaloneCoroutine( 9265): copies-supported (rangeOfInteger) = 1-99 I/StandaloneCoroutine( 9265): generated-natural-language-supported (1setOf naturalLanguage) = en-us I/StandaloneCoroutine( 9265): ipp-versions-supported (1setOf keyword) = 1.1,2.0 I/StandaloneCoroutine( 9265): mopria-certified (textWithoutLanguage) = 1.3 I/StandaloneCoroutine( 9265): job-creation-attributes-supported (1setOf keyword) = copies,finishings,sides,orientation-requested,media,print-quality,printer-resolution,output-bin,media-col,print-color-mode,ipp-attribute-fidelity,job-name I/StandaloneCoroutine( 9265): media-col-supported (1setOf keyword) = media-bottom-margin,media-left-margin,media-right-margin,media-size,media-source,media-top-margin,media-type I/StandaloneCoroutine( 9265): multiple-document-jobs-supported (boolean) = false I/StandaloneCoroutine( 9265): multiple-operation-time-out (integer) = 60 I/StandaloneCoroutine( 9265): multiple-operation-time-out-action (keyword) = abort-job I/StandaloneCoroutine( 9265): natural-language-configured (naturalLanguage) = en-us I/StandaloneCoroutine( 9265): operations-supported (1setOf enum) = Print-Job,Validate-Job,Create-Job,Send-Document,Cancel-Job,Get-Job-Attributes,Get-Jobs,Get-Printer-Attributes,Resubmit-Job,Identify-Printer I/StandaloneCoroutine( 9265): pdl-override-supported (keyword) = attempted I/StandaloneCoroutine( 9265): printer-config-change-time (integer) = 0 (1970-01-01T00:00Z) I/StandaloneCoroutine( 9265): printer-config-change-date-time (dateTime) = 1970-01-01T00:00:00.0+00:00 I/StandaloneCoroutine( 9265): printer-organization (1setOf textWithoutLanguage) = I/StandaloneCoroutine( 9265): printer-organizational-unit (1setOf textWithoutLanguage) = I/StandaloneCoroutine( 9265): which-jobs-supported (1setOf keyword) = completed,not-completed I/StandaloneCoroutine( 9265): printer-firmware-name (1setOf nameWithoutLanguage) = TR4500 series I/StandaloneCoroutine( 9265): printer-firmware-string-version (1setOf textWithoutLanguage) = 1.070 I/StandaloneCoroutine( 9265): printer-firmware-version (1setOf octetString) = 1.070 I/StandaloneCoroutine( 9265): printer-get-attributes-supported (1setOf keyword) = document-format I/StandaloneCoroutine( 9265): urf-supported (1setOf keyword) = V1.4,CP1,PQ4-5,RS600,SRGB24,W8,OB9,OFU0,DM3,IS1 I/StandaloneCoroutine( 9265): printer-kind (1setOf keyword) = document,envelope,photo,postcard I/StandaloneCoroutine( 9265): ipp-features-supported (1setOf keyword) = airprint-1.8 I/StandaloneCoroutine( 9265): identify-actions-supported (1setOf keyword) = flash,sound I/StandaloneCoroutine( 9265): identify-actions-default (1setOf keyword) = flash I/StandaloneCoroutine( 9265): print-content-optimize-supported (1setOf keyword) = auto I/StandaloneCoroutine( 9265): print-content-optimize-default (keyword) = auto I/StandaloneCoroutine( 9265): print-scaling-supported (1setOf keyword) = none,fill,fit,auto-fit,auto I/StandaloneCoroutine( 9265): print-scaling-default (keyword) = auto I/StandaloneCoroutine( 9265): pwg-raster-document-resolution-supported (1setOf resolution) = 600 dpi I/StandaloneCoroutine( 9265): pwg-raster-document-sheet-back (keyword) = rotated I/StandaloneCoroutine( 9265): pwg-raster-document-type-supported (1setOf keyword) = srgb_8,sgray_8 I/StandaloneCoroutine( 9265): media-size-supported (1setOf collection) = {x-dimension=14800 y-dimension=21000},{x-dimension=21000 y-dimension=29700},{x-dimension=18200 y-dimension=25700},{x-dimension=21590 y-dimension=27940},{x-dimension=21590 y-dimension=35560},{x-dimension=10000 y-dimension=14800},{x-dimension=10477 y-dimension=24130},{x-dimension=11000 y-dimension=22000},{x-dimension=10500 y-dimension=23500},{x-dimension=9800 y-dimension=19000},{x-dimension=12000 y-dimension=23500},{x-dimension=9000 y-dimension=20500},{x-dimension=8890 y-dimension=12700},{x-dimension=10160 y-dimension=15240},{x-dimension=12700 y-dimension=17780},{x-dimension=20320 y-dimension=25400},{x-dimension=8900..21590 y-dimension=12700..67600} I/StandaloneCoroutine( 9265): media-supported (1setOf keyword) = iso_a5_148x210mm,iso_a4_210x297mm,jis_b5_182x257mm,na_letter_8.5x11in,na_legal_8.5x14in,jpn_hagaki_100x148mm,na_number-10_4.125x9.5in,iso_dl_110x220mm,jpn_you4_105x235mm,jpn_you6_98x190mm,jpn_chou3_120x235mm,jpn_chou4_90x205mm,oe_photo-l_3.5x5in,na_index-4x6_4x6in,na_5x7_5x7in,na_govt-letter_8x10in,custom_min_89x127mm,custom_max_215.9x676mm I/StandaloneCoroutine( 9265): media-type-supported (1setOf keyword) = stationery,photographic,envelope I/StandaloneCoroutine( 9265): media-source-supported (1setOf keyword) = auto,main I/StandaloneCoroutine( 9265): media-top-margin-supported (1setOf integer) = 500,0,800 I/StandaloneCoroutine( 9265): media-left-margin-supported (1setOf integer) = 340,0,640,560 I/StandaloneCoroutine( 9265): media-right-margin-supported (1setOf integer) = 340,0,630,560 I/StandaloneCoroutine( 9265): media-bottom-margin-supported (1setOf integer) = 500,0,1270 I/StandaloneCoroutine( 9265): printer-input-tray (1setOf octetString) = type=other;mediafeed=-2;mediaxfeed=-2;maxcapacity=-2;level=-2;status=5;name=auto;,type=sheetFeedAutoRemovableTray;mediafeed=-2;mediaxfeed=-2;maxcapacity=-2;level=-2;status=5;name=main; I/StandaloneCoroutine( 9265): printer-output-tray (1setOf octetString) = type=unRemovableBin;maxcapacity=-2;remaining=-2;status=5;name=face-up;stackingorder=lastToFirst;pagedelivery=faceUp; I/StandaloneCoroutine( 9265): media-default (keyword) = iso_a4_210x297mm I/StandaloneCoroutine( 9265): media-col-default (collection) = {media-size={x-dimension=21000 y-dimension=29700} media-bottom-margin=500 media-left-margin=340 media-right-margin=340 media-top-margin=500 media-source=main media-type=stationery} I/StandaloneCoroutine( 9265): printer-is-accepting-jobs (boolean) = true I/StandaloneCoroutine( 9265): printer-location (textWithoutLanguage) = I/StandaloneCoroutine( 9265): printer-geo-location (uri) = geo:0.00000,0.00000,0 I/StandaloneCoroutine( 9265): printer-make-and-model (textWithoutLanguage) = Canon TR4500 series I/StandaloneCoroutine( 9265): printer-info (textWithoutLanguage) = Canon TR4500 series I/StandaloneCoroutine( 9265): printer-dns-sd-name (nameWithoutLanguage) = Canon TR4500 series I/StandaloneCoroutine( 9265): printer-name (nameWithoutLanguage) = TR4500 series I/StandaloneCoroutine( 9265): printer-alert (1setOf octetString) = code=other I/StandaloneCoroutine( 9265): printer-alert-description (1setOf textWithoutLanguage) = Non-alert I/StandaloneCoroutine( 9265): media-ready (1setOf keyword) = iso_a4_210x297mm I/StandaloneCoroutine( 9265): media-col-ready (1setOf collection) = {media-size={x-dimension=21000 y-dimension=29700} media-bottom-margin=500 media-left-margin=340 media-right-margin=340 media-top-margin=500 media-source=main media-type=stationery} I/StandaloneCoroutine( 9265): printer-state-reasons (1setOf keyword) = none I/StandaloneCoroutine( 9265): marker-names (1setOf nameWithoutLanguage) = Color,Black I/StandaloneCoroutine( 9265): marker-colors (1setOf nameWithoutLanguage) = #00CFFF#F200FF#FFDA00,#000000 I/StandaloneCoroutine( 9265): marker-types (1setOf keyword) = ink-cartridge,ink-cartridge I/StandaloneCoroutine( 9265): marker-high-levels (1setOf integer) = 100,100 I/StandaloneCoroutine( 9265): marker-low-levels (1setOf integer) = 15,15 I/StandaloneCoroutine( 9265): marker-levels (1setOf integer) = 30,60 I/StandaloneCoroutine( 9265): printer-state (enum) = idle I/StandaloneCoroutine( 9265): page-ranges-supported (boolean) = false I/StandaloneCoroutine( 9265): printer-device-id (textWithoutLanguage) = MFG:Canon;CMD:BJRaster3,NCCe,IVEC,URF;SOJ:CHMP;MDL:TR4500 series;CLS:PRINTER;DES:Canon TR4500 series;VER:1.070;STA:10;PSE:KNPE38956;CID:CA_IVEC1TYPE4_IJP;URF:V1.4,CP1,PQ4-5,RS600,SRGB24,W8,OB9,OFU0,DM3,IS1; I/StandaloneCoroutine( 9265): printer-up-time (integer) = 4912992 (1970-02-26T20:43:12Z) I/StandaloneCoroutine( 9265): printer-current-time (dateTime) = 1970-02-26T20:43:12.0+00:00 I/StandaloneCoroutine( 9265): printer-state-change-time (integer) = 4760303 (1970-02-25T02:18:23Z) I/StandaloneCoroutine( 9265): printer-state-change-date-time (dateTime) = 1970-02-25T02:18:23.0+00:00 I/StandaloneCoroutine( 9265): printer-uri-supported (1setOf uri) = ipp://8c2279000000.local./ipp/print,ipps://8c2279000000.local./ipp/print I/StandaloneCoroutine( 9265): uri-security-supported (1setOf keyword) = none,tls I/StandaloneCoroutine( 9265): uri-authentication-supported (1setOf keyword) = none,tls I/StandaloneCoroutine( 9265): printer-uuid (uri) = urn:uuid:00000000-0000-1000-8000-001854601048 I/StandaloneCoroutine( 9265): printer-icons (1setOf uri) = http://8c2279000000.local./icon/printer_icon.png,http://8c2279000000.local./icon/printer_icon_large.png I/StandaloneCoroutine( 9265): printer-more-info (uri) = http://8c2279000000.local./index.html?page=PAGE_AAP I/StandaloneCoroutine( 9265): printer-supply-info-uri (uri) = http://8c2279000000.local./index.html?page=PAGE_INK

when printing i get this

I/IppJob (14243): Wait for termination of job #22 I/IppJob (14243): Job #22, state=processing (reasons=job-printing), uri=ipp://8c2279000000.local./jobs?22 I/IppJob (14243): Job #22, state=processing (reasons=job-printing), name=Test, impressions-completed=0, originating-host-name=8c2279000000.local., originating-user-name=root, 1 documents, printer-uri=ipp://8c2279000000.local./ipp/print, uri=ipp://8c2279000000.local./jobs?22 I/IppJob (14243): Job #22, state=completed (reasons=job-completed-successfully), name=Test, impressions-completed=0, originating-host-name=8c2279000000.local., originating-user-name=root, 1 documents, printer-uri=ipp://8c2279000000.local./ipp/print, uri=ipp://8c2279000000.local./jobs?22

dustin-auby commented 2 months ago

ok so i managed to get it to print a blank page, i can confirm the image has content but the page is blank. any ideas ?

gmuth commented 2 months ago

It looks like you had some issues when trying to establish a connection to the printer. When using discovery methods you need to look after the correct entries. Printers usually announce different protocols on various tcp ports. This library only supports IPP and IPPS. I understand you managed to get this solved looking at the logs the printer uri is ipp://8c2279000000.local./ipp/print.

The next step is to provide a printable document. The IppInspector tries to print PDF. I could add a raster format as well. What document formats does the printer support? According to your logs PDF is not supported. document-format-supported (1setOf mimeMediaType) = application/octet-stream,image/jpeg,image/urf,image/pwg-raster What document format did you send? Did you tell the printer what document format you send by using parameter DocumentFormat? If you don't tell the printer it needs to autodetect the format. Best approach here ist to print a jpeg. You could also render PDF to PWG. It's up to you and your application to produce a printable document the printer can deal with. Please provide the code that shows how you setup this library and how the program invokes the provided operations along with logs and stacktraces properly formatted.

IPP Communication with the printer seems to works fine. The printer even allows job monitoring. However there is some inconsistency in the final job state. It says job-completed-successfully while impressions-completed is zero. If the printer does not support the document format you send it should respond with ClientErrorDocumentFormatNotSupported

gmuth commented 2 months ago

@dustin-auby, please provide the requested feedback.

gmuth commented 1 month ago

Sending a question to reporter but nothing happens.