Using offline resources
Contents
[
Hide
]
While Aspose.OCR for Java can automatically fetch the necessary resources as needed, there are certain scenarios where manual downloading of these resources and providing them with your application could be beneficial:
- Your application needs to work in an environment where Internet access is limited or unavailable.
- You (or the application user) do not have the ability to change firewall rules.
- You want to reduce startup time and improve overall performance, particularly for applications requiring fast response times.
- All application files must pass the strict audit and cannot be changed/added in the runtime.
To make the application work in the offline mode:
- Create a directory in the application’s working directory.
- Download the required resource files from the Aspose.OCR resource repository to the directory. To find more information on a specific resource, refer to the following link.
- Provide the absolute or relative path to the directory using
Resources.SetLocalPath()
method. For example:Resources.SetLocalPath("aspose/ocr", false);
. - Block automatic downloading of resources by calling
Resources.AllowAutomaticDownloads(false)
. - Do not forget to include a directory with downloaded resources in your distributive, otherwise the related functionality will fail.
You also have a flexibility to combine online and offline modes. For example, provide the most used resources with your app and download rarely used resources in the runtime.
Example
Resources.SetLocalPath("aspose/ocr");
Resources.AllowAutomaticDownloads(false);