From: mattschmatt on
Hello. I download and installed the XPAAJ.jar file used for working with PDF
files through Java. Ben Forta wrote an article about this and provided some
examples. Anyway, I have the following code that works great until I call the
InputFormData() method. When I remove the method, it works fine but gives the
following error when I insert it. The method is the very last line in the code
below.

[b]"The system has attempted to use an undefined value, which usually
indicates a programming error, either in your code or some system code. Null
Pointers are another name for undefined values."[/b]

--------------------------------------------------------------------------------
-----------------------------
<!---open original PDF--->
<cfset doc = "">
<cfset docPath=GetDirectoryFromPath(GetBaseTemplatePath()) />
<cfset PDFfile= docPath & "test.pdf" />
<!---Create an empty input stream object in Java, then init it with the target
PDF file--->
<cfset inPdfFile = CreateObject("java", "java.io.FileInputStream")>
<cfset inPdfFile.init(#PDFfile#)>
<cfset PDFfactory=CreateObject("java", "com.adobe.pdf.PDFFactory")>
<cfset doc = PDFFactory.openDocument(#inPdfFile#)>

<!-- POPULATE THE FORM -->
<cfset xmlString = "<root><patient_name>Eric Cartman</patient_name></root>">
<cfset XMLBytes= xmlString.getBytes()>
<cfset XMLStream = CreateObject("java", "java.io.ByteArrayInputStream")>
<cfset XMLStream.init(XMLBytes)>
<cfset byteCount = XMLStream.available()>
<cfoutput>#byteCount#</cfoutput>
<cfset doc.importFormData(XMLStream)>

Any ideas? I can open the PDF and save it just fine. Also, the InputStream is
not empty or null. The available() method shows that it contains 54 bytes. Yet
I get the "null" error above.

Thanks for any help.