Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4464373

javax.print: Need a way to print binary raw data (non-PostScript).

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • 2d
    • beta2
    • generic
    • generic

      Printing a PCL binary raw data is not possible because none of the PrintServices report a DocFlavor that it supports this type data.

      Feedback from the beta release:

      Date: Mon, 28 May 2001 15:14:28 -0700
      From: Jim Adrig <###@###.###>
      X-Accept-Language: en
      To: Phil Race <###@###.###>
      CC: ###@###.###
      Subject: Re: Printing PCL in 1.4: bug or unsupported?
      Content-Transfer-Encoding: 7bit

      Phil Race wrote:
      >
      > Hi Jim,
      > I recall that we looked into how to do pass through to a PCL printer
      > but there wasn't a suitable win32 API to identify a PCL technology
      > printer in the same way that there are APIs to identify a printer
      > as having postscript technology. And that's even leaving aside the
      > question of what PCL means - eg PCL3, PCL5, PC5e, PCL6 ?
      >
      > Jennifer will likely recall more details and may have some ideas
      > if there is something legitimate and useful we can do or suggest
      > alternatives for you.
      >
      > -phil.

      Thanks for the quick response...

      I understand that to fit into the 'framework', you would have to
      identify the printer as a 'PCL' printer; and if that could be done, it
      would work for us.

      But sometimes the best solution is just to provide a way to let the
      programmers do things you can't anticipate: in this case, to just let us
      go 'under the covers' and send 'raw data' directly to the printer. The
      Win32 API has always provided this capability (see below).

      I would think that there could be lots of reasons to avoid all the
      platform-dependant printer driver issues. The ability to send 'raw' data
      to the printer, combined with all the info available through the new 1.4
      javax.print system, would be very powerful!

      When I first downloaded the 1.4 beta, I was hoping to find something
      like this: (and don't you want to do things the way programmers expect
      them to be ? ;^) ..)

      'Binary' DocFlavor's always available for all Win32 PrintServices:

         application/octet-stream; class="[B"

         application/octet-stream; class="java.io.InputStream"

         application/octet-stream; class="java.net.URL"

      And DocFlavor's to access them:

         DocFlavor.INPUT_STREAM.BYTES (or something like that?)
         etc.
         (or find them with 'AUTOSENSE' ?)


      Here is a link to the Win32 API info on 'Sending Data Directly to a
      Printer' (this link seems to work better in IE):

        http://msdn.microsoft.com/library/psdk/gdi/prntspol_93g2.htm

      And here is (abbreviated) Delphi code we use to do this; note the 'RAW'
      pDataType:

      %<------------------------------------------------------
       if OpenPrinter(PChar(PrinterName), PrinterHandle, nil) then
        with DocInfo1 do begin
          pDocName := PChar(JobName);
          pOutputFile := nil;
          pDataType := 'RAW'; // Here's the trick !?
        end;
        JobNo := StartDocPrinter(PrinterHandle, 1, @DocInfo1);
        if JobNo <> 0 then begin
          if StartPagePrinter(PrinterHandle) then begin
            WritePrinter(PrinterHandle,
                         PChar(PrintString),
                         Length(PrintString),
                         BytesWritten);
            if not(EndPagePrinter(PrinterHandle)) then GetErrorList (
      GetLastError );
          end else GetErrorList( GetLastError );
          if not(EndDocPrinter(PrinterHandle)) then GetErrorList (
      GetLastError );
        end else GetErrorList( GetLastError );
        ClosePrinter(PrinterHandle);
      %<------------------------------------------------------

                                       __o
      Jim Adrig _ \<,_
      ###@###.### ' `/ ' `
                        ___________ `-' `-'

            jgodinez Jennifer Godinez (Inactive)
            jgodinez Jennifer Godinez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: