Class ApacheFopWorker

java.lang.Object
org.apache.ofbiz.webapp.view.ApacheFopWorker

public final class ApacheFopWorker extends Object
Apache FOP worker class.
  • Method Details

    • getFactoryInstance

      public static org.apache.fop.apps.FopFactory getFactoryInstance()
      Returns an instance of the FopFactory class. FOP documentation recommends the reuse of the factory instance because of the startup time.
      Returns:
      FopFactory The FopFactory instance
    • transform

      public static void transform(File srcFile, File destFile, File stylesheetFile, String outputFormat) throws IOException, org.apache.fop.apps.FOPException
      Transform an xsl-fo file to the specified file format.
      Parameters:
      srcFile - The xsl-fo File instance
      destFile - The target (result) File instance
      stylesheetFile - Optional stylesheet File instance
      outputFormat - Optional output format, defaults to "application/pdf"
      Throws:
      IOException
      org.apache.fop.apps.FOPException
    • transform

      public static void transform(InputStream srcStream, OutputStream destStream, InputStream stylesheetStream, String outputFormat) throws org.apache.fop.apps.FOPException
      Transform an xsl-fo InputStream to the specified OutputStream format.
      Parameters:
      srcStream - The xsl-fo InputStream instance
      destStream - The target (result) OutputStream instance
      stylesheetStream - Optional stylesheet InputStream instance
      outputFormat - Optional output format, defaults to "application/pdf"
      Throws:
      org.apache.fop.apps.FOPException
    • transform

      public static void transform(StreamSource src, StreamSource stylesheet, org.apache.fop.apps.Fop fop) throws org.apache.fop.apps.FOPException
      Transform an xsl-fo StreamSource to the specified output format.
      Parameters:
      src - The xsl-fo StreamSource instance
      stylesheet - Optional stylesheet StreamSource instance
      fop -
      Throws:
      org.apache.fop.apps.FOPException
    • createFopInstance

      public static org.apache.fop.apps.Fop createFopInstance(OutputStream out, String outputFormat) throws org.apache.fop.apps.FOPException
      Returns a new Fop instance. Note: FOP documentation recommends using a Fop instance for one transform run only.
      Parameters:
      out - The target (result) OutputStream instance
      outputFormat - Optional output format, defaults to "application/pdf"
      Returns:
      Fop instance
      Throws:
      org.apache.fop.apps.FOPException
    • createFopInstance

      public static org.apache.fop.apps.Fop createFopInstance(OutputStream out, String outputFormat, org.apache.fop.apps.FOUserAgent foUserAgent) throws org.apache.fop.apps.FOPException
      Returns a new Fop instance. Note: FOP documentation recommends using a Fop instance for one transform run only.
      Parameters:
      out - The target (result) OutputStream instance
      outputFormat - Optional output format, defaults to "application/pdf"
      foUserAgent - FOUserAgent object which may contains encryption-params in render options
      Returns:
      Fop instance
      Throws:
      org.apache.fop.apps.FOPException
    • createTempFoXmlFile

      public static File createTempFoXmlFile() throws IOException
      Returns a temporary File instance. The temporary file name starts with tempFilePrefix and ends with ".xml". Calling methods are responsible for deleting the temporary file.

      FOP performs transforms in memory, so if there is any chance FO output will be more than a few pages, it would be best to keep FO input in a temporary file.

      Returns:
      File instance
      Throws:
      IOException
    • createTempResultFile

      public static File createTempResultFile() throws IOException
      Returns a temporary File instance. The temporary file name starts with tempFilePrefix and ends with ".res". Calling methods are responsible for deleting the temporary file.

      FOP performs transforms in memory, so if there is any chance FO output will be more than a few pages, it would be best to keep FO output in a temporary file.

      Returns:
      File instance
      Throws:
      IOException
    • getEncryptionLengthDefault

      public static String getEncryptionLengthDefault()
    • getUserPasswordDefault

      public static String getUserPasswordDefault()
    • getOwnerPasswordDefault

      public static String getOwnerPasswordDefault()
    • getAllowPrintDefault

      public static String getAllowPrintDefault()
    • getAllowCopyContentDefault

      public static String getAllowCopyContentDefault()
    • getAllowEditContentDefault

      public static String getAllowEditContentDefault()
    • getAllowEditAnnotationsDefault

      public static String getAllowEditAnnotationsDefault()
    • getAllowAccessContentDefault

      public static String getAllowAccessContentDefault()
    • getAllowFillInFormsDefault

      public static String getAllowFillInFormsDefault()
    • getAllowAssembleDocumentDefault

      public static String getAllowAssembleDocumentDefault()
    • getAllowPrintHqDefault

      public static String getAllowPrintHqDefault()
    • getEncryptMetadataDefault

      public static String getEncryptMetadataDefault()