Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending a print job but the page is blank #174

Closed
dustin-auby opened this issue Apr 24, 2024 · 8 comments
Closed

Sending a print job but the page is blank #174

dustin-auby opened this issue Apr 24, 2024 · 8 comments

Comments

@dustin-auby
Copy link

Hi,

I am trying to send a print job with this library but the page comes out blank. the printer im testing with doesnt support pdf but does support image/jpeg . the printer receives the job and starts printing but then nothing is on the page. Any assistance on this would be greatly appreciated.

This is the code im using to send the job
var transport = HttpIppClientTransport(true) val uri = URI.create("ipps://8C2279000000.local:631/ipp/print") println("Print job sent to $uri") val printRequest = IppPacket.printJob(uri) .putOperationAttributes(documentFormat.of("image/jpeg")) .build() transport.sendData(uri, IppPacketData(printRequest, FileInputStream(filePath)))

These are the printer attributes. i did not get them from this library but im sure they are the same
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

@dustin-auby
Copy link
Author

oh i forgot to mention when i send the same file through ios it works fine

@psoreide
Copy link
Contributor

Try using 'documentFormat.of("application/octet-stream")' which is telling the printer to auto-detect. I have experienced some printers only accept that document format.

@dustin-auby
Copy link
Author

il test again but i have already tried this. thanks

@dustin-auby
Copy link
Author

Ok tested with

var transport = HttpIppClientTransport(true) val uri = URI.create("ipps://8C2279000000.local:631/ipp/print") println("Print job sent to $uri") val printRequest = IppPacket.printJob(uri) .putOperationAttributes(documentFormat.of("application/octet-stream")) .build() transport.sendData(uri, IppPacketData(printRequest, FileInputStream(filePath)))

Same issue blank page

@dustin-auby
Copy link
Author

Ok tried on a seccond printer and still not luck. This printer is a brother printer. again i can print from ios but not android

@HPNavjot
Copy link
Collaborator

@dustin-auby What is the mimetype of file being sent via sendData ? is it a pdf file or jpeg file?

Since the printer does not support application/pdf document format, it cannot handle the pdf file. Even though the print job request is valid, so a job is created but the print is not able to handle data received via the sendData request hence the blank page.

The printer would require the client to render the pdf into a supported format like PWG raster and send it to printer via a send-document operation.

@dustin-auby
Copy link
Author

@dustin-auby What is the mimetype of file being sent via sendData ? is it a pdf file or jpeg file?

Since the printer does not support application/pdf document format, it cannot handle the pdf file. Even though the print job request is valid, so a job is created but the print is not able to handle data received via the sendData request hence the blank page.

The printer would require the client to render the pdf into a supported format like PWG raster and send it to printer via a send-document operation.

I have tried sending Jpeg (image/jpeg) with a jpg image, application/octet-stream with a jpg,png and pdf and i have now also tried PWG raster . none of them work on either printer.

i have also tried the sample scripts for print and render and get the same results. surely one of those formats would work on at least one printer ?

@HPSudip
Copy link
Collaborator

HPSudip commented May 3, 2024

Hi @dustin-auby Are you getting any IPP error code as part of the printer response? Can you try like below and check and provide the request and response packets?

I am using the code below and haven't encountered any issues when testing it with some HP printers.

@Test
fun documentFormatTest() {
    val transport = HttpIppClientTransport(true)
    val uri = URI.create("ipps://192.168.5.38:443/ipp/print")
    println("Print job sent to $uri")
    val printRequest = IppPacket.printJob(uri)
        .putOperationAttributes(Types.documentFormat.of("image/jpeg"))  // or "application/octet-stream" also works
        .build()
    val path = javaClass.classLoader.getResource("sample.jpg")?.path ?: Assert.fail("Resource not found")
    println(path)
    println("Sending ${printRequest.prettyPrint(100, "  ")}")

    val response = transport.sendData(uri, IppPacketData(printRequest, FileInputStream(path as String)))
    println("Received: ${response.packet.prettyPrint(100, "  ")}")
}

the printer targeted above supports the below attributes for document-format

document-format-default = "application/octet-stream" (mimeMediaType),
document-format-supported = [
  "application/vnd.hp-PCL" (mimeMediaType),
  "image/jpeg" (mimeMediaType),
  "application/PCLm" (mimeMediaType),
  "image/urf" (mimeMediaType),
  "image/pwg-raster" (mimeMediaType),
  "application/octet-stream" (mimeMediaType) ],

You can also try not putting any operation attributes because in that case printer suppose to use the default which is "application/octet-stream" , same as in your printer as well.
so like val printRequest = IppPacket.printJob(uri).build();

"image/jpeg" or "application/octet-stream" should work directly, like this code, but for PCLm or pwg-raster we need to render and generate separate pclm or pwg streams.

@HPSudip HPSudip closed this as completed Aug 14, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants