[jcifs] writing a file to a printer queue.
Michael B. Allen
miallen at eskimo.com
Thu Oct 10 03:27:12 EST 2002
On Wed, 9 Oct 2002 09:07:27 +0200
frederic.kieffer at gerling.com wrote:
> Hi everybody!
> I'm sending this mail because I had a problem when writing a pcl file to a
> printer queue.
> You can see below the URL I'm using for creating the SmbFile object, and the
> code part under this dump
I have not looked at printing because there are terrible hardware
dependencies. There is no way to print anything but whatever flavor of
printer language *your* printer happens to use. It's just not portable at
all. If you do not care about portability at all and still want to write to
a printer, you would have to look at packet traces of clients accessing and
using shared printers. Then you could identify the proper semantics for
printing. It could be server/IPC$/pipe/...etc. I just don't know.
>
>
> [INFO,Default] [InvoicesPersonalPrinter] [sendToPrinter()] method called,
> aSmbFi
> le : smb://do-frpar02;U81422:poiaze@tafrpar0202/PHFRPAR0210/toto.pcl
>
> (tafrpar0202: NT printer server, PHFRPAR0210 : printer (PCL compliant)).
>
>
>
> private void sendToPrinter(byte[] bytesToBePrinted, SmbFile aSmbFile)
> throws Exception
> {
>
> log.debug("[InvoicesPersonalPrinter] [sendToPrinter()] method called,
> aSmbFile : " + aSmbFile.toString());
> System.out.println("[InvoicesPersonalPrinter] [sendToPrinter()] method
> called, aSmbFile : " + aSmbFile.toString());
>
> //Write data into the printing queue for the relevant printer
> SmbFileOutputStream aSmbFileOutputStream = new
> SmbFileOutputStream(aSmbFile);
> aSmbFileOutputStream.write(bytesToBePrinted);
> aSmbFileOutputStream.flush();
> aSmbFileOutputStream.close();
>
> log.debug("[InvoicesPersonalPrinter] [sendToPrinter()] end of method ");
> System.out.println("[InvoicesPersonalPrinter] [sendToPrinter()] end of
> method ");
>
>
> }
>
>
> Here is the stack trace :
>
>
> [ERROR,Default] [InvoicesPersonalPrinter] [sendToPrinter()] method raised an
> ex
> eption : Invalid parameter
> [ERROR,Default] jcifs.smb.SmbException: Invalid parameter
> [ERROR,Default] at
> jcifs.smb.SmbTransport.send(SmbTransport.java:494)
> [ERROR,Default]
> [ERROR,Default] at jcifs.smb.SmbSession.send(SmbSession.java:97)
> [ERROR,Default]
> [ERROR,Default] at jcifs.smb.SmbTree.send(SmbTree.java:92)
> [ERROR,Default]
> [ERROR,Default] at jcifs.smb.SmbFile.send(SmbFile.java:532)
> [ERROR,Default]
> [ERROR,Default] at jcifs.smb.SmbFile.open(SmbFile.java:578)
> [ERROR,Default]
> [ERROR,Default] at
> jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputSt
> eam.java:107)
> [ERROR,Default]
> [ERROR,Default] at
> jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputSt
> eam.java:92)
> [ERROR,Default]
> [ERROR,Default] at
> jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputSt
> eam.java:62)
> [ERROR,Default]
> [ERROR,Default] at
> gerling.invoices.InvoicesPersonalPrinter.sendToPrint
> r(InvoicesPersonalPrinter.java:83)
> [ERROR,Default]
> [ERROR,Default] at
> gerling.invoices.InvoicesPersonalPrinter.<init>(Invo
> cesPersonalPrinter.java:65)
> [ERROR,Default]
> [ERROR,Default] at
> gerling.invoices.InvoicesPrinter.transformToPDF(Invo
> cesPrinter.java:273)
> [ERROR,Default]
> [ERROR,Default] at
> gerling.invoices.InvoicesPrinter.print(InvoicesPrint
> r.java:236)
> [ERROR,Default]
> [ERROR,Default] at
> gerling.invoices.InvoicesPrinter.onMessage(InvoicesP
> inter.java:188)
> [ERROR,Default]
> [ERROR,Default] at
> org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsum
> r.java:490)
> [ERROR,Default]
> [ERROR,Default] at java.lang.Thread.run(Thread.java:484)
>
>
>
> Thanks for any help!
> Frédéric Kieffer
> Gerling France
>
--
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not
yet been conceived.
More information about the jcifs
mailing list