Pdf not getting saved

Pdf not getting saved

Forum member · Apr 6, 2006
Hi, I have a pdf which is having a form with 50 fields. I have writtena utility java file which replaces the field values. the problem I am facing is that when I run this class file as a standalone application then everything works fine, but when I run it through a servlet then while saving the file I get an error. The sample code that I have wrriten is MergeOptions mergeOptions = new MergeOptions(true); MergeDocument mergeDocument = new MergeDocument(pdfFilePath,mergeOptions); FormFieldList fieldList = mergeDocument.getForm().getFields(); FormField field = null; String fieldName = ""; String tempFile = "a.pdf"; Iterator itr = fieldList.getIterator(); this.fileCounter++; while (itr.hasNext()) { field = (FormField) itr.next(); fieldName = field.getName(); field.setValue((String) variables.get(fieldName)); } mergeDocument.draw(tempFile); It is not able to draw the file. I am using weblogic 8.1 as the web/application container The error is java.lang.NullPointerException at com.cete.dynamicpdf.merger.forms.MergeTextField.drawDictionary(Unknown Source) at com.cete.dynamicpdf.forms.FormField.draw(Unknown Source) at com.cete.dynamicpdf.io.DocumentResourceList.a(Unknown Source) at com.cete.dynamicpdf.io.DocumentWriter.draw(Unknown Source) at com.cete.dynamicpdf.Document.draw(Unknown Source) Please help me in this case. I am stuck

Re: Pdf not getting saved

Support · Apr 6, 2006
Hello, The problem is likely being caused because the Draw function can’t handle a null value for one of it’s form fields. It needs to be an empty string, not null. Please make sure that you are not setting any for field value to null. Also are you using any sessions in WebLogic? If so, make sure that your session variables are not returning null values. Thanks, ceTe Software Support Team