You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Pete Nygaard <pn...@ritehite.com> on 2014/10/23 20:36:39 UTC

Fw: java error: nullpointerexception

I am trying to use an FDF file to populate a PDF template document using 
PDFbox.  I am hoping you can help with an error I am encountering.  I 
believe at the line "PDDocumentCatalog docCatalog = pd
.getDocumentCatalog();"
the nullpointerexception is occuring.

The console shows that the FDF file is loaded, however the next println 
statment "1" nevers appears,  the nullpointerexception occurs.


Read FDF file: c:\files\CYLeveler-DLIGCAP.FDF
FDF file loaded
Exception in thread "AgentThread: JavaAgent" 
java.lang.NullPointerException
        at JavaAgent.NotesMain(Unknown Source)
        at lotus.domino.AgentBase.runNotes(Unknown Source)
        at lotus.domino.NotesThread.run(Unknown Source)



public class JavaAgent extends AgentBase {
        PDDocument pd;
        FDFDocument fdf; 
        PDDocumentCatalog docCatalog;
        }
 
public void NotesMain() {
        System.out.println("Read FDF file: " + flds[1]);
                File input = new File(flds[1]);
                fdf = FDFDocument.load(input); 
                System.out.println("FDF file loaded"); 
                PDDocumentCatalog docCatalog = pd.getDocumentCatalog(); // 
I think this is where the nullpointerexception occurs.
                System.out.println("   1");
                PDAcroForm acroForm = docCatalog.getAcroForm();
                System.out.println("   2");
                acroForm.setCacheFields( true ); 
                System.out.println("   3");
                acroForm.importFDF(fdf); 
                System.out.println("   4");

thank you for any assistance you can provide.

Pete Nygaard
Sr, Programmer/Analyst



CONFIDENTIALITY NOTICE: This message is from Rite-Hite Holding Corporation and may contain confidential and proprietary information that is intended only for the individual(s) or entities named. If you have received this message in error, please let us know immediately by e-mail reply and delete it from your system. You may not copy this message or disclose its contents to anyone. Rite-Hite reserves the right to monitor messages by authorized Rite-Hite employees at anytime and without further consent.

Re: Fw: java error: nullpointerexception

Posted by Brzrk One <br...@gmail.com>.
just reading your code, I think you want fdf.getDocumentCatalog()

On Thu, Oct 23, 2014 at 2:36 PM, Pete Nygaard <pn...@ritehite.com> wrote:

> I am trying to use an FDF file to populate a PDF template document using
> PDFbox.  I am hoping you can help with an error I am encountering.  I
> believe at the line "PDDocumentCatalog docCatalog = pd
> .getDocumentCatalog();"
> the nullpointerexception is occuring.
>
> The console shows that the FDF file is loaded, however the next println
> statment "1" nevers appears,  the nullpointerexception occurs.
>
>
> Read FDF file: c:\files\CYLeveler-DLIGCAP.FDF
> FDF file loaded
> Exception in thread "AgentThread: JavaAgent"
> java.lang.NullPointerException
>         at JavaAgent.NotesMain(Unknown Source)
>         at lotus.domino.AgentBase.runNotes(Unknown Source)
>         at lotus.domino.NotesThread.run(Unknown Source)
>
>
>
> public class JavaAgent extends AgentBase {
>         PDDocument pd;
>         FDFDocument fdf;
>         PDDocumentCatalog docCatalog;
>         }
>
> public void NotesMain() {
>         System.out.println("Read FDF file: " + flds[1]);
>                 File input = new File(flds[1]);
>                 fdf = FDFDocument.load(input);
>                 System.out.println("FDF file loaded");
>                 PDDocumentCatalog docCatalog = pd.getDocumentCatalog(); //
> I think this is where the nullpointerexception occurs.
>                 System.out.println("   1");
>                 PDAcroForm acroForm = docCatalog.getAcroForm();
>                 System.out.println("   2");
>                 acroForm.setCacheFields( true );
>                 System.out.println("   3");
>                 acroForm.importFDF(fdf);
>                 System.out.println("   4");
>
> thank you for any assistance you can provide.
>
> Pete Nygaard
> Sr, Programmer/Analyst
>
>
>
> CONFIDENTIALITY NOTICE: This message is from Rite-Hite Holding Corporation
> and may contain confidential and proprietary information that is intended
> only for the individual(s) or entities named. If you have received this
> message in error, please let us know immediately by e-mail reply and delete
> it from your system. You may not copy this message or disclose its contents
> to anyone. Rite-Hite reserves the right to monitor messages by authorized
> Rite-Hite employees at anytime and without further consent.
>