Class SetField


  • public class SetField
    extends java.lang.Object
    This example will take a PDF document and set a form field in it.
    • Constructor Summary

      Constructors 
      Constructor Description
      SetField()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String calculateOutputFilename​(java.lang.String filename)  
      static void main​(java.lang.String[] args)
      This will read a PDF file and set a field and then write it the pdf out again.
      private void setField​(java.lang.String[] args)  
      void setField​(PDDocument pdfDocument, java.lang.String name, java.lang.String value)
      This will set a single field in the document.
      private static void usage()
      This will print out a message telling how to use this example.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SetField

        public SetField()
    • Method Detail

      • setField

        public void setField​(PDDocument pdfDocument,
                             java.lang.String name,
                             java.lang.String value)
                      throws java.io.IOException
        This will set a single field in the document.
        Parameters:
        pdfDocument - The PDF to set the field in.
        name - The name of the field to set.
        value - The new value of the field.
        Throws:
        java.io.IOException - If there is an error setting the field.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        This will read a PDF file and set a field and then write it the pdf out again.
        see usage() for commandline
        Parameters:
        args - command line arguments
        Throws:
        java.io.IOException - If there is an error importing the FDF document.
      • setField

        private void setField​(java.lang.String[] args)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • calculateOutputFilename

        private static java.lang.String calculateOutputFilename​(java.lang.String filename)
      • usage

        private static void usage()
        This will print out a message telling how to use this example.