Class Util


  • public class Util
    extends Object
    Utility methods for the Zonal OCR
    Since:
    8.4.2
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • updateZoneSample

        public static void updateZoneSample​(String sampleContent,
                                            Zone zone)
      • saveImage

        public static void saveImage​(String content,
                                     File file)
                              throws IOException
        Saves an image into a given file in .jpg format
        Parameters:
        content - the content of the image Base64 encoded
        file - the output file
        Throws:
        IOException - in case of I/O error
      • cropImageToFile

        public static void cropImageToFile​(String content,
                                           Zone zone,
                                           File file)
                                    throws IOException
        Crops an area and stores it in a given .jpg file
        Parameters:
        content - the content of the source image Base64 encoded
        zone - the zone definition
        file - the output file
        Throws:
        IOException - an I/O error
      • cropImage

        public static BufferedImage cropImage​(BufferedImage originalImage,
                                              Zone zone)
        Crops an area from given image
        Parameters:
        originalImage - the original image
        zone - the zone definition
        Returns:
        the cropped image
      • pasteImage

        public static void pasteImage​(BufferedImage container,
                                      BufferedImage imageIn,
                                      float opaque,
                                      int x,
                                      int y)
        Prints the contents of imageIn on container the given opaque value
        Parameters:
        container - the bigger image
        imageIn - the image to print in
        opaque - and indication of how opaque must be the print
        x - left coordinate
        y - top coordinate
      • printFirstPage

        public static void printFirstPage​(File originalFile,
                                          String originalFileName,
                                          File out)
                                   throws IOException
        Prints the first page of the given file into the output as .jpg image
        Parameters:
        originalFile - the original file
        originalFileName - the original filename
        out - the output .jpg file
        Throws:
        IOException - a generic I/O error