[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to print a PDF on an iSeries OUTQ?

Posted on 2011-10-11
Medium Priority
Last Modified: 2012-05-12
I have several PDFs that are created using the iText package in Java. This creates the PDF files, stores them on the iSeries IFS, but doesn't offer any functionality for printing them.

We want the PDFs to be printable directly from the iSeries on user request using the OUTQ system. (None of our printers can print PDFs natively.) I have found several ways of doing it, but most require commercial packages and/or Windows servers to print them.

I have tried using Ghostscript (v8.54 running on the PASE system) but GS has a bug that prevents printing in Duplex and I can not find any updated versions since 8.54 where that bug may have been fixed. I have also tried a java class from Sun called PDFRenderer but that wouldn't work.

Can anyone suggest a method (preferably free) for printing duplex PDFs on user request from an iSeries using an iSeries OUTQ? It is essential that the iSeries is the only computer used in the whole process, but we do have AIX (PASE for i) and Java (on the iSeries) as additional tools if options are available using them.
Question by:Paul-Bailey
  • 4
  • 3
LVL 36

Accepted Solution

Gary Patterson earned 1200 total points
ID: 36949729
What AS/400 OS version are you running?
What types of attached printers do you have, specifically?
Can you describe the specific Ghostscript Duplex printing bug that you are experiencing?  I've used this successfully, though I haven't tested duplex printing.
Can you describe the problem that you experienced with using the PDFRender class?  I've used this successfully (without duplex).

One though on Ghostscript:  Sounds like for some reason the PCL Duplex command isn't getting inserted.  Can you capture the GS PCL output to a file and post it here?  One simple solution might be to direct the GS output to a file, then write a simple little script to insert the PCL  "Duplex" command into the resulting output file at the appropriate point:


Then push the edited file to the printer and clean up.

- Gary Patterson

Author Comment

ID: 36949935
When you ask these questions in haste, you miss out all the information! Sorry! :)

We are running i OS 6.1. The two printers nearest me are both HP laserjets, one is a 4250dtn and the other is a 1320tn.

Ghostscript works perfectly except for the duplex part of the print. The PDF is converted into a PCL file (device ljet4d), and I pass the -Duplex and -DDuplex command line options (I have seen both all over the 'net, so was unsure which was correct. Even after reading the manual pages.) I print the PCL document by copying it from the IFS to a *USERASCII PRTF object - using either of Scott Klement's PRTSPLF utility or FTP. Whichever printer I try prints the first page, sucks the first page back into the printer but then prints nothing on the rear side of the paper. Then the second page comes out and does the same, and finally the third page does the same. It is as though the duplex process wants to work but it prints the document's three pages on three seperate pieces of paper.. Before I used the -Duplex options, I would just get all three pages out without the "sucking back in", so I am reasonably certain that there are only three pages in the PCL document. Perhaps the duplex options are inserting blank pages or page breaks into the file?

The PDFRenderer class is completely different. I understand the Java language and how it works when I run it from windows, but I am not very sure about Java/400 and the classic JVM that I am told it is using. The PDFRenderer examples liberally sprinkled all around the net usually set up a PrintJob using the java.awt.print package, but when I call PrintJob I get a null pointer exception. I suspect there is a setup issue with the iSeries printers/OUTQs so I posted another question about that at the same time I posted this one.

I'll need to setup the PCL output file again and I can't do that until tomorrow now. I'll check your advice about the duplex code tomorrow and maybe post the PCL file here for you to look at. But I think that the duplex code is probably already in there as the printer behaves as though it is.
LVL 36

Expert Comment

by:Gary Patterson
ID: 36950743
Agree: sounds like you are getting extra page breaks in the duplex document, with the net result a simplex document.  

Just to confirm:  

1) Do you have the same issue on both printers (there is an 06 Apr 2011 firmware update available for the 4250)?
2) Can you print duplex to both of these from Windows?

I'd really like to see a sample of the problem PCL output.  I think that will tell us a lot.

- Gary Patterson
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.


Author Comment

ID: 36954369
I have the file ready and tested to make certain that it prints duplex but appears to have extra page breaks, and I am willing to pass it on to you (as I haven't a clue what to look for in the file.) However the print has some information on it that I do not want available on the internet to anyone. Can you tell me how to get the file to you without attaching it here?

I have the same issue on both printers, but I can print duplex to both printers from windows. Will that firmware update for the 4250 fix a problem with duplex printing? I am not seeing a problem duplex orinting except with this ghostscript conversion.
LVL 36

Expert Comment

by:Gary Patterson
ID: 36957049
Understand and agree with the privacy concerns. Check out my EE profile for contact info.  

I'll pull out the relevant block (PCL only - none of the actual text) and post it with my response.

- Gary Patterson

Assisted Solution

Paul-Bailey earned 0 total points
ID: 37030039
I've still not heard anything. Has there been any progress?

Author Closing Comment

ID: 37196978
Gary took the question home with him and continued some correspondence through email, but the I last heard from him some time back was with no solution but a hint that he could be hired as a consultant.

He gets part of the points for showing willing, but loses my respect for trying to get me to hire him.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Moore’s Law has proven itself time and time again since it was first introduced. So what’s next? Will Moore’s law continue to remain relevant, or will new technology take over and bring us the next big advancement in computing?
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question