Giter Club home page Giter Club logo

Comments (8)

dustin-auby avatar dustin-auby commented on July 16, 2024

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

from jipp.

psoreide avatar psoreide commented on July 16, 2024

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.

from jipp.

dustin-auby avatar dustin-auby commented on July 16, 2024

il test again but i have already tried this. thanks

from jipp.

dustin-auby avatar dustin-auby commented on July 16, 2024

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

from jipp.

dustin-auby avatar dustin-auby commented on July 16, 2024

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

from jipp.

HPNavjot avatar HPNavjot commented on July 16, 2024

@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.

from jipp.

dustin-auby avatar dustin-auby commented on July 16, 2024

@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 ?

from jipp.

HPSudip avatar HPSudip commented on July 16, 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.

from jipp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.