This is very tricky to do, and I seriously doubt you'll find a pure Java solution. I spent nearly a week trying, and gave up. I did find a nearly-pure way though ...
In effect, if your printer does not support, or have, a specific PDF driver, you must use the postscript driver.
First you need to convert the file to a postscript file. The best way I found to do this was use the "xpdf" (google it) C program - this is quick and keeps the file very small. This is the only non-Java bit to do. Invoke xpdf using the Runtime.getRuntime() call.
Once in PDF, print as normal.
(BTW There are no *real* pure Java solutions for any Java code, because Java is just built on top of C/C++ libraries anyway !)
I am trying to do this from the AS400. Will xpdf work from the AS400. I'm an RPG and Java programmer, so I have no idea how to run a C program from the AS400. Could someone point me in the right direction?
) you will see that they provide precompiled binaries for x86 processors running Linux OS, or Win32 OS, and also for SPARC processors running Solaris.
I've never used an "AS400", so I' not sure, but I guess its not got an x86 (AMD/Intel) processor ... which means you will need to download the source code and compile it yourself on the target machine type if you wish to use Xpdf.
Would I need a C or C++ compiler? It has been a long time since I have used C, so how would I go about compiling their code? Do they give instructions?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.