Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print PDF

Status
Not open for further replies.

Grentis

Programmer
Aug 18, 2003
13
IT
Hi,
someone can help me to print a pdf file without open external tools?

I try setting my print as
Code:
DocFlavor myFormat = DocFlavor.INPUT_STREAM.PDF;
but it doesn't work

Thanks
Grentis
 
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?

Thanks,
Jon Mitchell
 
If you on the Xpdf site ( ) 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.

--------------------------------------------------
Free Database Connection Pooling Software
 
Sedj,

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?

Thanks,
Jon Mitchell
 
Go and have a look at the site sedj pointed you at. I'm sure they will.
 
This product has never been compiled on an IBM iSeries AS400 before. So their instructions do not really help. This sounds like a deadend to me...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top