Automatically download required resources
Contents
[
Hide
]
Aspose.OCR for C++ can automatically fetch the necessary resources as needed when you call the method that depends on them. This mode is enabled by default.
- Create a directory to which resources will be downloaded.
- Specify the path to that directory in
resource_root_path
property ofAsposeOCRResourceLoadSettings
structure. - Set
lazy_load
property ofAsposeOCRResourceLoadSettings
structure totrue
. - Apply the resource load settings (
AsposeOCRResourceLoadSettings
structure) usingasposeocr_set_resource_load_settings()
method before calling any other Aspose.OCR method.
AsposeOCRResourceLoadSettings load_settings;
std::string root_path = "path/to/files";
load_settings.resource_root_path = root_path.c_str();
load_settings.lazy_load = true;
asposeocr_set_resource_load_settings(load_settings);
You also have a flexibility to combine online and offline modes. For example, provide the most used resources with your app and allow the app to automatically download rarely used resources in the runtime.
Important considerations
If you choose to automatically download resources on demand, consider the following:
- The device hosting your application must have access to Internet.
- The application must be allowed outbound HTTP access to the resource repository’s URL in the firewall.
- Depending on your Internet connection’s speed, the automatic download of resources may take some time. This will result in increased processing time when you first call a method that depends on the downloaded resource.
If the above-mentioned constraints are not feasible, consider using manual resource management.