class UpdateFieldOnDocumentOpen
{
    private UpdateFieldOnDocumentOpen()
    {
    }
    
    public static void main(String[] args) throws IOException
    {<FILL_FUNCTION_BODY>}
}

        // Load the PDF document created by SimpleForm.java
        try (PDDocument document = Loader.loadPDF(new File("target/SimpleForm.pdf")))
        {
            // Note that the JavaScript will depend on the reader application.
            // The classes and methods available to Adobe Reader and Adobe Acrobat
            // are documented in the Acrobat SDK.
            String javaScript = "var now = util.printd('yyyy-mm-dd', new Date());"
                    + "var oField = this.getField('SampleField');"
                    + "oField.value = now;";
            
            // Create an action as JavaScript action
            PDActionJavaScript jsAction = new PDActionJavaScript();
            jsAction.setAction(javaScript);
            
            // Set the action to be executed when the document is opened
            document.getDocumentCatalog().setOpenAction(jsAction);
            
            document.save("target/UpdateFieldOnDocumentOpen.pdf");
        }
    
<no_super_class>