pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raj <ujarpe...@gmail.com>
Subject Re: NPE setValue
Date Tue, 23 Jul 2013 14:55:20 GMT
plz stop forwarding mails to this email-id


On Tue, Jul 23, 2013 at 8:16 PM, <joshua.garrison@daimler.com> wrote:

> Hello,
>
> I am curious if there is an issue with the setValue method in the current
> version of PDFBox. If not, do you have a fix for this code?
>
> I am getting the following stack error....
> SEVERE: java.lang.NullPointerException
>         at
>
> org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.calculateFontSize(PDAppearance.java:558)
>         at
>
> org.apache.pdfbox.pdmodel.interactive.form.PDAppearance.setAppearanceValue(PDAppearance.java:303)
>         at
>
> org.apache.pdfbox.pdmodel.interactive.form.PDVariableText.setValue(PDVariableText.java:131)
>         at org.apache.jsp.index_jsp._jspService(index_jsp.java:91)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
>         at
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
>         at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
>         at
> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
>         at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
>         at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>         at
>
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
>         at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
>         at
>
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
>         at
>
> com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
>         at
>
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
>         at
> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
>         at
> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
>         at
> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
>         at
>
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
>         at
>
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>         at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>         at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>         at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
>         at
>
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>         at
>
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>         at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
>         at
>
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>         at
>
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>         at java.lang.Thread.run(Thread.java:722)
>
>
> And here is my code...
>
> // Create a document and add a page to it
>                 PDDocument document = new PDDocument();
>                 document =
>
> PDDocument.load("C:\\Users\\garrisj\\Desktop\\Disciplinary_TardyLateForm.pdf");
>                 out.println("Number of pages: " +
> document.getNumberOfPages() + "<br />");
>
>                 System.out.println("TroubleShoot 1");
>                 PDDocumentCatalog docCatalog =
> document.getDocumentCatalog();
>                 System.out.println("TroubleShoot 2");
>                 PDAcroForm acroForm = docCatalog.getAcroForm();
>                 System.out.println("TroubleShoot 3");
>                 PDField field = acroForm.setFields("FULL NAME");)
>                 System.out.println("TroubleShoot 4");
>                 try{
>                     field.setValue("Garrison, Joshua C");
>                     System.out.println("TroubleShoot 5");
>                 } catch (NullPointerException ex) {
>                     ex.printStackTrace();
>                 }
>
>                 // Save the newly created document
>  document.save("C:\\Users\\garrisj\\Desktop\\BlankPage.pdf");
>
>                 // finally make sure that the document is properly
>                 // closed.
>                 document.close();
>
>
>
> Thanks,
>
> Joshua Garrison - Mt. Holly TMP
> IT Technician / Application Developer
> Daimler Trucks North America, LLC
> Office - (704) 822-7297
> joshua.garrison@daimler.com
>
>
> If you are not the intended addressee, please inform us immediately that
> you have received this e-mail in error, and delete it. We thank you for
> your cooperation.




-- 

Thanks & Regards,
*Raju. Peram*
*Mobile*: *(91) 9642858868*
*Email*: *ujarperam@gmail.com* <ujarperam@gmail.com>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message