"Patrick O. Thurman" <[EMAIL PROTECTED]> writes: > Good Morning, > > I have a oracle.sql.ARRAY as input param and I would like to create > PDF document from this array and return to plsql a oracle.sql.BLOB object. > I have been tring the code below, but it does not work. > I get ORA-29532: Java call terminated by uncaught Java exception: > java.lang.NullPointerException I think it is when I close the document or > when I try to put the bytearray into the blob. > > Any ideals will help. Thanks > > > public static BLOB pdf(oracle.sql.ARRAY lines, oracle.sql.ARRAY defOptions) > throws DocumentException { > > Document document = null; > PdfWriter writer = null; > oracle.sql.BLOB vRetBlob = null; > ByteArrayOutputStream baosPDF = null; > > . > . > . > . > > document = new Document(MEDIA, rm, lm, tm, bm); > writer = PdfWriter.getInstance(document, baosPDF); > document.open(); > PdfContentByte cb = writer.getDirectContent(); > PdfTemplate template = cb.createTemplate(25, 25); > . > . > . > . > document.add(new Paragraph(11, lineText[i], fontDefFont)); > . > . > . > . > document.close(); > . > . > . > . > > try { > vBytes = vRetBlob.setBytes(0, baosPDF.toByteArray());
I didn't see you initialize baosPDF to an instance of ByteArrayOutputStream. Perhaps you omitted a line like baosPDF = new ByteArrayOutputStream(); From your code snippet above. If not it could account for you getting a NPE. > } > catch (SQLException se) { > System.out.println("generatePDFDocumentBytes >> " + se); > } > Return(vRetBlob); > } > regards, Dirk -- _____________________________________________________________________ RISC: Relegate Important Stuff to Compiler
pgpMeJO0sxdA0.pgp
Description: PGP signature
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions