Good Morning all, I have a java class that reads a PDF template file and fills in the input fields:
import com.lowagie.text.pdf.AcroFields; import com.lowagie.text.pdf.PdfReader; import com.lowagie.text.pdf.PdfStamper; import java.io.FileOutputStream; import java.sql.*; import java.text.SimpleDateFormat; /** * Fill in a simple registration form. */ public class readTemplatePDF { /** * Reads a form and fills in the fields. * @param args no arguments needed */ public static void main(String[] args) { readTemplatePDF d = new readTemplatePDF(); d.write(null); } public static String write(oracle.sql.ARRAY parms) { String result = "0 -- Successfull"; String[] values = null; int arraySize = 0; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SS' '"); try { values = (String[])parms.getArray(); arraySize = parms.length(); } catch (java.sql.SQLException ex) { System.out.println(sdf.format(new java.util.Date()) + " readTemplatePDF >> " + ex.toString()); } try { // we create a reader to read the template PDF file PdfReader reader = new PdfReader("PORA$DATA:[PORADATA.PDF]" + values[0]); int n = reader.getNumberOfPages(); PdfStamper stamp1 = new PdfStamper(reader, new FileOutputStream("PORA$DATA:[PORADATA.PDF]" + values[1])); AcroFields form1 = stamp1.getAcroFields(); int i = 2; while (i < arraySize) { form1.setField(values[i], values[i+1]); i++; i++; } stamp1.setFormFlattening(true); stamp1.close(); result = "0 -- Successfull"; } catch (Exception ex) { System.out.println(sdf.format(new java.util.Date()) + " readTemplatePDF >> " + ex.toString()); result = "9 -- Failed"; } return result; } } I receive a java.io.IOException when tring to create PdfReader reader = new PdfReader("PORA$DATA:[PORADATA.PDF]" + values[0]); I have found in the code: public RandomAccessFileOrArray(String filename, boolean forceRead) throws IOException { File file = new File(filename); if (!file.canRead()) { if (filename.startsWith("file:/") || filename.startsWith("http://") || filename.startsWith("https://") || filename.startsWith("jar:")) { InputStream is = new URL(filename).openStream(); try { this.arrayIn = InputStreamToArray(is); return; } finally { try {is.close();}catch(IOException ioe){} } } else { InputStream is = BaseFont.getResourceStream(filename); if (is == null) throw new IOException(filename + " not found as file or resource."); try { this.arrayIn = InputStreamToArray(is); return; } finally { try {is.close();}catch(IOException ioe){} } } } Where I believe my exception is being generated. What are the reasons for this exception other than the file not existing on the disk, not in the right place and not having the correct OS security? Why is a randomAccess method being used to read a binary file? I have this code running and working in my test environment, but cannot make it work in production. I am a Oracle DBA and I am running this class as a stored procedure within the database. I believe that this is a Oracle DB problem, but I cannot find the difference between test and prod to solve the problem. I believe this in NOT a security/priviledge problem, but some thing different, maybe file type or.. Pat, Patrick O. Thurman Stephen F. Austin State University Information Technology Services Data Base Administrator Phone: (936) 468-1074 Fax: (936) 468-1117 ------------------------------------------------------------------------- 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