Discussion:
Printing PDF with Java
(too old to reply)
Mark
2006-03-22 14:28:27 UTC
Permalink
I am asked to print PDF's directly from the AS400 and to do this with
Java. I found an open source project PDFBOX and am trying to implement
this somehow.

This library uses java.awt.PrinterJob.getPrinterJob to setup a printer
job. This bombs out with a null pointer exception:

java.lang.NullPointerException
at java.lang.Class.forName(Class.java:242)
at java.awt.print.PrinterJob$1.run(PrinterJob.java:60)
at java.awt.print.PrinterJob.getPrinterJob(PrinterJob.java:54)
at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:708)
at org.pdfbox.PrintPDF.main(PrintPDF.java:97)

Any ideas how to do this on the AS400 platform ?
walker.l2
2006-03-22 15:25:38 UTC
Permalink
I haven't used PDFBOX, but Java printing on the AS/400 can be tricky
because you generally only have Headless AWT available. (Consequently
we call COBOL programs to generate prints. For PDFs this probably isn't
an option; it is possible that some of the OS/400 advanced printing
options will allow you to print PDFs from OS/400, but I have no
experience with them.) Is PDFBOX compatible with Headless AWT?
"AWT headless mode compatibility
To take advantage of Abstract Windowing Toolkit (AWT) headless mode,
your Java code must be noninteractive, such as code that simply
generates image data, and must not construct any heavyweight AWT
components. Heavyweight components are designed primarily for
representing interactive objects. These components require the Java
virtual machine to use an underlying graphics engine that can process
interactive events, such as the X11 window system.

When you use AWT for strictly noninteractive purposes, you may still
encounter a java.awt.HeadlessException when running in AWT headless
mode. When you encounter such an error, check your code for calls to
the constructors of the following heavyweight AWT components:

Heavyweight AWT components
Applet
Button
Checkbox
Choice
Dialog
FileDialog
Frame
JApplet
JDialog
JFrame
JWindow
Label
List
Menu
MenuBar
MenuComponent
MenuItem
PopupMenu
Robot Scrollbar
ScrollPane
TextArea
TextComponent
Window


If your Java code does construct any heavyweight AWT components, you
cannot run in AWT headless mode. You have two options:

Run NAWT with full graphical user interface (GUI) support, which
requires additional setup requirements (for example, setting up a
Virtual Network Computing X Window server, and so on)
Revise your code to eliminate calls to the heavyweight AWT components "
poddys
2006-03-22 16:34:48 UTC
Permalink
Bradley Stone has some good inexpensive PDF creation tools
(www.bvstools.com).

If this is a viable solution, you can also install PDF Creator on a PC
and set up a Printer on the AS400 to link to this. Granted the PC
needs to be on and a Printer Session active for the print to work, but
you can setup PDF Creator to automatically name (Date/Time) documents
and to go to a specific folder. It has worked well for me in the past.

Hope this helps.
walker.l2
2006-03-22 16:54:47 UTC
Permalink
There is a free Spool File to PDF conversion tool (
http://www.code400.com/cvt2pdf.php ). The PDF files it produces are
rather large though.

I get the impression that the OP might be trying to create a PDF
directly from Java, rather than trying to convert a spool file; but I
could be wrong.
Mark
2006-03-23 09:59:00 UTC
Permalink
We don't want to create PDF files, but we want to print already made
PDF files directly from the AS400. The PDF's are created by a scanning
application which scans waybills. As they are a part of our legacy
system, these are stored in the IFS structure.

On the other side we have this runtime of a report generator which also
can generate PDF's for us. This is a java runtime. This is the reason
we are lookin for a java solution.
b***@csh.rit.edu
2006-03-22 18:23:02 UTC
Permalink
Hi Mark,

The org.pdfbox.PrintPDF does not support headless printing right now.
You will need to write some Java to do it without popping up a dialog.

Ben
Mark
2006-03-23 12:35:18 UTC
Permalink
Well, as it is now, it does this:

PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPageable(this);
if( printJob.printDialog() )
{
printJob.print();
}

I will need to set the printer without the dialog. Ok, that's fine. But
it already gives an excepion on the getPrinterJob. So the question is,
why is that not working. Or can't this work and do I need an
alternative for this.
Niko
2006-03-23 07:01:43 UTC
Permalink
Post by Mark
I am asked to print PDF's directly from the AS400 and to do this with
Java. I found an open source project PDFBOX and am trying to implement
this somehow.
This library uses java.awt.PrinterJob.getPrinterJob to setup a printer
java.lang.NullPointerException
at java.lang.Class.forName(Class.java:242)
at java.awt.print.PrinterJob$1.run(PrinterJob.java:60)
at java.awt.print.PrinterJob.getPrinterJob(PrinterJob.java:54)
at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:708)
at org.pdfbox.PrintPDF.main(PrintPDF.java:97)
Any ideas how to do this on the AS400 platform ?
Hi,

I have done this with iText and it is working wery well.

There is source of printing class..only you need to download iText pdf
library(google it)
and copy Courier.ttf to IFS folder where your class file is.


import java.io.*;
import com.ibm.as400.access.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.BaseFont;

public class spltopdf extends Object{

public static void main(String[] parameters){
if (parameters.length != 7 ){
System.out.println("");
System.out.println("Parameters are not correct.");
System.out.println("");
System.out.println("Command syntax is: spltopdf path name rows
cols notes library file member");
System.out.println("");
System.out.println("Syntax example is: spltopdf /mypdf order 66
198 Demo qgpl tmpspool m000001");
System.out.println("");
System.exit(0);
}

try {
String PDFPATH = parameters[0];
String PDFNAME = parameters[1];
String ROWS = parameters[2];
String COLS = parameters[3];
String LIBRARY = parameters[4];
String FILE = parameters[5];
String MEMBER = parameters[6];

System.out.println(PDFPATH);
System.out.println(PDFNAME);
System.out.println(ROWS);
System.out.println(COLS);
System.out.println(LIBRARY);
System.out.println(FILE);
System.out.println(MEMBER);

int RecordLength = Integer.valueOf(COLS).intValue();
AS400 as400 = new AS400();

QSYSObjectPathName filename = new
QSYSObjectPathName(LIBRARY, FILE, MEMBER, "MBR");

SequentialFile file = new SequentialFile(as400,
filename.getPath());

// Retrieve the record format for the file
AS400FileRecordDescription recordDescription = new
AS400FileRecordDescription(as400, filename.getPath());
RecordFormat[] format =
recordDescription.retrieveRecordFormat();
file.setRecordFormat(format[0]);
file.open(SequentialFile.READ_ONLY, 100,
SequentialFile.COMMIT_LOCK_LEVEL_NONE);

System.out.println("Start Creation of "+ PDFPATH + "/" +
PDFNAME + ".pdf");
try {
// Create the courier.ttf font object
BaseFont courier = BaseFont.createFont("courier.ttf",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font font = new Font(courier, 10f); // The fontsize is
10

float f = courier.getWidthPoint("0123456789", 10f); //
length of 10 fixed characters width
float Xpoints = Float.valueOf(COLS).floatValue() * f /
10 + 72 ; // the page width in pixels

// leading = the space between two lines, that is 1.5
times the fontsize
int leading = 15 ;
float Ypoints = (Float.valueOf(ROWS).floatValue() + 5)
* leading + 72 ; //The page height in pixels

// Create the Rectangle object in a certain color and
use this as pageSize
Rectangle pageSize = new Rectangle(Xpoints, Ypoints);
// pageSize.setBackgroundColor(new java.awt.Color(0xFF,
0xFF, 0xDE));
Document document = new Document(pageSize,36,36,36,36);
// The four margins have 36 pixels (0.5 of inch)

IFSFileOutputStream target = new
IFSFileOutputStream(as400,PDFPATH+"/"+PDFNAME+".pdf",IFSFileOutputStream.SHA
RE_NONE, false);

// Create an instance of the com.lowagie.text.Document
object
PdfWriter.getInstance(document, target);
document.addTitle("Spool2pdf converter");
document.addSubject("Spool file converted to pdf
format");
document.addCreator(as400.getUserId());
document.addAuthor(as400.getUserId());
document.addHeader("Expires", "0");



document.open();
boolean FirstTime = true;
String NewPage = "1";
String SpaceBeforeOneLine = "0";
String SpaceBeforeTwoLines = "-";
String fcfc = " ";
String linef = "";

Record data = file.readNext(); // Read first record of
work file
while (data != null) {
if (FirstTime)
FirstTime = false;
else
fcfc = (String) data.getField(0);
linef = (String) data.getField(1);
// According to the value of control char FCFC
create new line, lines or page
if ( fcfc.compareTo(NewPage)==0 ) {
document.newPage(); }
if ( fcfc.compareTo(SpaceBeforeOneLine)==0 ) {
document.add(new Paragraph(leading, " ",
font)); }
if ( fcfc.compareTo(SpaceBeforeTwoLines)==0 ) {
document.add(new Paragraph(leading, " ", font));
document.add(new Paragraph(leading, " ", font));
}
document.add(new Paragraph(leading, linef, font));
// add a spooled file line to PDF
data = file.readNext(); // Read next record of work
file
}
document.close();
as400.disconnectAllServices();
System.out.println("Finnished Creation of "+ PDFPATH +
"/" + PDFNAME + ".pdf");
} catch(DocumentException de) {
System.out.println(de.getMessage());
System.exit(0);
} catch(IOException ioe) {
System.out.println(ioe.getMessage());
System.exit(0);
}
} catch (Exception e) {
System.out.println("Could not read the work file");
System.out.println(e.getMessage());
System.exit(0);
}


System.out.println("Finnished creation of pdf document!");
System.exit(0);}
}


Cheers,
Niko.
Steve
2006-03-23 11:34:00 UTC
Permalink
Ok, but your sample code is to create a PDF from a file.
Could you support me with an example of java code to print an IFS PDF file
on an As400 connected printer?
Thanks
Steve
Post by Niko
Post by Mark
I am asked to print PDF's directly from the AS400 and to do this with
Java. I found an open source project PDFBOX and am trying to implement
this somehow.
This library uses java.awt.PrinterJob.getPrinterJob to setup a printer
java.lang.NullPointerException
at java.lang.Class.forName(Class.java:242)
at java.awt.print.PrinterJob$1.run(PrinterJob.java:60)
at java.awt.print.PrinterJob.getPrinterJob(PrinterJob.java:54)
at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:708)
at org.pdfbox.PrintPDF.main(PrintPDF.java:97)
Any ideas how to do this on the AS400 platform ?
Hi,
I have done this with iText and it is working wery well.
There is source of printing class..only you need to download iText pdf
library(google it)
and copy Courier.ttf to IFS folder where your class file is.
import java.io.*;
import com.ibm.as400.access.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.BaseFont;
public class spltopdf extends Object{
public static void main(String[] parameters){
if (parameters.length != 7 ){
System.out.println("");
System.out.println("Parameters are not correct.");
System.out.println("");
System.out.println("Command syntax is: spltopdf path name rows
cols notes library file member");
System.out.println("");
System.out.println("Syntax example is: spltopdf /mypdf order 66
198 Demo qgpl tmpspool m000001");
System.out.println("");
System.exit(0);
}
try {
String PDFPATH = parameters[0];
String PDFNAME = parameters[1];
String ROWS = parameters[2];
String COLS = parameters[3];
String LIBRARY = parameters[4];
String FILE = parameters[5];
String MEMBER = parameters[6];
System.out.println(PDFPATH);
System.out.println(PDFNAME);
System.out.println(ROWS);
System.out.println(COLS);
System.out.println(LIBRARY);
System.out.println(FILE);
System.out.println(MEMBER);
int RecordLength = Integer.valueOf(COLS).intValue();
AS400 as400 = new AS400();
QSYSObjectPathName filename = new
QSYSObjectPathName(LIBRARY, FILE, MEMBER, "MBR");
SequentialFile file = new SequentialFile(as400,
filename.getPath());
// Retrieve the record format for the file
AS400FileRecordDescription recordDescription = new
AS400FileRecordDescription(as400, filename.getPath());
RecordFormat[] format =
recordDescription.retrieveRecordFormat();
file.setRecordFormat(format[0]);
file.open(SequentialFile.READ_ONLY, 100,
SequentialFile.COMMIT_LOCK_LEVEL_NONE);
System.out.println("Start Creation of "+ PDFPATH + "/" +
PDFNAME + ".pdf");
try {
// Create the courier.ttf font object
BaseFont courier = BaseFont.createFont("courier.ttf",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font font = new Font(courier, 10f); // The fontsize is
10
float f = courier.getWidthPoint("0123456789", 10f); //
length of 10 fixed characters width
float Xpoints = Float.valueOf(COLS).floatValue() * f /
10 + 72 ; // the page width in pixels
// leading = the space between two lines, that is 1.5
times the fontsize
int leading = 15 ;
float Ypoints = (Float.valueOf(ROWS).floatValue() + 5)
* leading + 72 ; //The page height in pixels
// Create the Rectangle object in a certain color and
use this as pageSize
Rectangle pageSize = new Rectangle(Xpoints, Ypoints);
// pageSize.setBackgroundColor(new java.awt.Color(0xFF,
0xFF, 0xDE));
Document document = new Document(pageSize,36,36,36,36);
// The four margins have 36 pixels (0.5 of inch)
IFSFileOutputStream target = new
IFSFileOutputStream(as400,PDFPATH+"/"+PDFNAME+".pdf",IFSFileOutputStream.SHA
RE_NONE, false);
// Create an instance of the com.lowagie.text.Document
object
PdfWriter.getInstance(document, target);
document.addTitle("Spool2pdf converter");
document.addSubject("Spool file converted to pdf
format");
document.addCreator(as400.getUserId());
document.addAuthor(as400.getUserId());
document.addHeader("Expires", "0");
document.open();
boolean FirstTime = true;
String NewPage = "1";
String SpaceBeforeOneLine = "0";
String SpaceBeforeTwoLines = "-";
String fcfc = " ";
String linef = "";
Record data = file.readNext(); // Read first record of
work file
while (data != null) {
if (FirstTime)
FirstTime = false;
else
fcfc = (String) data.getField(0);
linef = (String) data.getField(1);
// According to the value of control char FCFC
create new line, lines or page
if ( fcfc.compareTo(NewPage)==0 ) {
document.newPage(); }
if ( fcfc.compareTo(SpaceBeforeOneLine)==0 ) {
document.add(new Paragraph(leading, " ",
font)); }
if ( fcfc.compareTo(SpaceBeforeTwoLines)==0 ) {
document.add(new Paragraph(leading, " ", font));
document.add(new Paragraph(leading, " ", font));
}
document.add(new Paragraph(leading, linef, font));
// add a spooled file line to PDF
data = file.readNext(); // Read next record of work
file
}
document.close();
as400.disconnectAllServices();
System.out.println("Finnished Creation of "+ PDFPATH +
"/" + PDFNAME + ".pdf");
} catch(DocumentException de) {
System.out.println(de.getMessage());
System.exit(0);
} catch(IOException ioe) {
System.out.println(ioe.getMessage());
System.exit(0);
}
} catch (Exception e) {
System.out.println("Could not read the work file");
System.out.println(e.getMessage());
System.exit(0);
}
System.out.println("Finnished creation of pdf document!");
System.exit(0);}
}
Cheers,
Niko.
Niko
2006-03-23 13:25:02 UTC
Permalink
Post by Steve
Ok, but your sample code is to create a PDF from a file.
Could you support me with an example of java code to print an IFS PDF file
on an As400 connected printer?
Thanks
Steve
Post by Niko
Post by Mark
I am asked to print PDF's directly from the AS400 and to do this with
Java. I found an open source project PDFBOX and am trying to implement
this somehow.
This library uses java.awt.PrinterJob.getPrinterJob to setup a printer
java.lang.NullPointerException
at java.lang.Class.forName(Class.java:242)
at java.awt.print.PrinterJob$1.run(PrinterJob.java:60)
at java.awt.print.PrinterJob.getPrinterJob(PrinterJob.java:54)
at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:708)
at org.pdfbox.PrintPDF.main(PrintPDF.java:97)
Any ideas how to do this on the AS400 platform ?
Hi,
I have done this with iText and it is working wery well.
There is source of printing class..only you need to download iText pdf
library(google it)
and copy Courier.ttf to IFS folder where your class file is.
import java.io.*;
import com.ibm.as400.access.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.BaseFont;
public class spltopdf extends Object{
public static void main(String[] parameters){
if (parameters.length != 7 ){
System.out.println("");
System.out.println("Parameters are not correct.");
System.out.println("");
System.out.println("Command syntax is: spltopdf path name rows
cols notes library file member");
System.out.println("");
System.out.println("Syntax example is: spltopdf /mypdf order 66
198 Demo qgpl tmpspool m000001");
System.out.println("");
System.exit(0);
}
try {
String PDFPATH = parameters[0];
String PDFNAME = parameters[1];
String ROWS = parameters[2];
String COLS = parameters[3];
String LIBRARY = parameters[4];
String FILE = parameters[5];
String MEMBER = parameters[6];
System.out.println(PDFPATH);
System.out.println(PDFNAME);
System.out.println(ROWS);
System.out.println(COLS);
System.out.println(LIBRARY);
System.out.println(FILE);
System.out.println(MEMBER);
int RecordLength = Integer.valueOf(COLS).intValue();
AS400 as400 = new AS400();
QSYSObjectPathName filename = new
QSYSObjectPathName(LIBRARY, FILE, MEMBER, "MBR");
SequentialFile file = new SequentialFile(as400,
filename.getPath());
// Retrieve the record format for the file
AS400FileRecordDescription recordDescription = new
AS400FileRecordDescription(as400, filename.getPath());
RecordFormat[] format =
recordDescription.retrieveRecordFormat();
file.setRecordFormat(format[0]);
file.open(SequentialFile.READ_ONLY, 100,
SequentialFile.COMMIT_LOCK_LEVEL_NONE);
System.out.println("Start Creation of "+ PDFPATH + "/" +
PDFNAME + ".pdf");
try {
// Create the courier.ttf font object
BaseFont courier = BaseFont.createFont("courier.ttf",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font font = new Font(courier, 10f); // The fontsize is
10
float f = courier.getWidthPoint("0123456789", 10f); //
length of 10 fixed characters width
float Xpoints = Float.valueOf(COLS).floatValue() * f /
10 + 72 ; // the page width in pixels
// leading = the space between two lines, that is 1.5
times the fontsize
int leading = 15 ;
float Ypoints = (Float.valueOf(ROWS).floatValue() + 5)
* leading + 72 ; //The page height in pixels
// Create the Rectangle object in a certain color and
use this as pageSize
Rectangle pageSize = new Rectangle(Xpoints, Ypoints);
// pageSize.setBackgroundColor(new
java.awt.Color(0xFF,
Post by Steve
Post by Niko
0xFF, 0xDE));
Document document = new
Document(pageSize,36,36,36,36);
Post by Steve
Post by Niko
// The four margins have 36 pixels (0.5 of inch)
IFSFileOutputStream target = new
IFSFileOutputStream(as400,PDFPATH+"/"+PDFNAME+".pdf",IFSFileOutputStream.SHA
Post by Steve
Post by Niko
RE_NONE, false);
// Create an instance of the
com.lowagie.text.Document
Post by Steve
Post by Niko
object
PdfWriter.getInstance(document, target);
document.addTitle("Spool2pdf converter");
document.addSubject("Spool file converted to pdf
format");
document.addCreator(as400.getUserId());
document.addAuthor(as400.getUserId());
document.addHeader("Expires", "0");
document.open();
boolean FirstTime = true;
String NewPage = "1";
String SpaceBeforeOneLine = "0";
String SpaceBeforeTwoLines = "-";
String fcfc = " ";
String linef = "";
Record data = file.readNext(); // Read first record of
work file
while (data != null) {
if (FirstTime)
FirstTime = false;
else
fcfc = (String) data.getField(0);
linef = (String) data.getField(1);
// According to the value of control char FCFC
create new line, lines or page
if ( fcfc.compareTo(NewPage)==0 ) {
document.newPage(); }
if ( fcfc.compareTo(SpaceBeforeOneLine)==0 ) {
document.add(new Paragraph(leading, " ",
font)); }
if ( fcfc.compareTo(SpaceBeforeTwoLines)==0 ) {
document.add(new Paragraph(leading, " ", font));
document.add(new Paragraph(leading, " ", font));
}
document.add(new Paragraph(leading, linef, font));
// add a spooled file line to PDF
data = file.readNext(); // Read next record of work
file
}
document.close();
as400.disconnectAllServices();
System.out.println("Finnished Creation of "+ PDFPATH +
"/" + PDFNAME + ".pdf");
} catch(DocumentException de) {
System.out.println(de.getMessage());
System.exit(0);
} catch(IOException ioe) {
System.out.println(ioe.getMessage());
System.exit(0);
}
} catch (Exception e) {
System.out.println("Could not read the work file");
System.out.println(e.getMessage());
System.exit(0);
}
System.out.println("Finnished creation of pdf document!");
System.exit(0);}
}
Cheers,
Niko.
Hi,

Maybe this will help..(I'am not sure is this available in Java on iSeries)
http://java.sun.com/j2se/1.4.2/docs/guide/jps/spec/JPSTOC.fm.html

You cannot print directly because AWT printing works with underlying canvas
of OS.
As iSeries is not GUI OS this is impossible.

Only way to do it is to generate image of every page and then convert them
into PCL or PS data stream and print it with printerwriter class from java
toolbox to outq as ascii stream.
Then you can release this spool to printer or to print to lpd port of remote
printer.

Niko.
Steve
2006-03-23 14:12:23 UTC
Permalink
Thanks Niko.....
I'll check...
Post by Niko
Hi,
Maybe this will help..(I'am not sure is this available in Java on iSeries)
http://java.sun.com/j2se/1.4.2/docs/guide/jps/spec/JPSTOC.fm.html
You cannot print directly because AWT printing works with underlying canvas
of OS.
As iSeries is not GUI OS this is impossible.
Only way to do it is to generate image of every page and then convert them
into PCL or PS data stream and print it with printerwriter class from java
toolbox to outq as ascii stream.
Then you can release this spool to printer or to print to lpd port of remote
printer.
Niko.
Niko
2006-03-23 14:40:57 UTC
Permalink
I forgot to tell you...

I am working on v5r3 with JAVA1.3 and there is ibmjps.jar
in '/QIBM/ProdData/OS400/Java400/ext/ibmjps.jar'

See more on
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzaha/jvprtsrv.htm

So, it could be possible.
Cheers, NIko.
b***@arcor.de
2006-03-30 16:33:49 UTC
Permalink
Hello Mark,

Don't know, whats missing on your AS400! Got the same error.
You should try to push your PDF document directly to your AS400
connected printer.
Any printer conforming to KPDL3 or Adobe Postscript 3 language
(Kyocera/Xerox) can print your document, without intermediate
conversion!

Create a remote outqueue with parameter "transform=*NO" (do not
transform print stream on iSeries!) as an important setting an run the
following code:

String sys = "mySystem"; /* Insert ISeries server name
*/
String user = "username"; /* Insert ISeries user profile
name */
String pass = "abc"; /* Insert ISeries password */

AS400 system = new AS400(sys, user, pass);

/* Insert ISeries output queue */
String outqname = "/QSYS.LIB/qusrsys.LIB/D1531.OUTQ";
OutputQueue outq = new OutputQueue(system, outqname);
PrintParameterList parms = new PrintParameterList();
parms.setParameter(PrintObject.ATTR_OUTPUT_QUEUE,
outq.getPath());

try{
fileout = new SpooledFileOutputStream(system, parms, null,
null);
}
catch (Exception e)
{
System.out.println("error opening spool file: " +
e.getMessage());
}

FileInputStream bfr = null;
try {

bfr = new FileInputStream("c:/temp/testpdf.pdf");
byte[] buffer = new byte[bfr.available()];
bfr.read(buffer);
fileout.write(buffer);
fileout.flush();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
Post by Mark
I am asked to print PDF's directly from the AS400 and to do this with
Java. I found an open source project PDFBOX and am trying to implement
this somehow.
This library uses java.awt.PrinterJob.getPrinterJob to setup a printer
java.lang.NullPointerException
at java.lang.Class.forName(Class.java:242)
at java.awt.print.PrinterJob$1.run(PrinterJob.java:60)
at java.awt.print.PrinterJob.getPrinterJob(PrinterJob.java:54)
at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:708)
at org.pdfbox.PrintPDF.main(PrintPDF.java:97)
Any ideas how to do this on the AS400 platform ?
Loading...