Unable to add image in OMR Templete

Error: Error occurred during generation process. Please contact support. Exception message: Can’t find full path for the image: https://schoolcanvas.com/assets/img/favicon.png. Make sure full valid path to this image is provided in GenerateTemplate method parameters.

?image=https://schoolcanvas.com/assets/img/favicon.png
align=center
width: 100px
height: 100px

?image=D:\Veera\HelloOMR\wwwroot\templetefld\favicon.png
align=center
width: 100px
height: 100px

reffered URL: Adding images|Documentation

In asp.net C#. am try to local path and url image not able to generate. kindly check its correct. incase any issue share correct format text

@Veera127

It seems you are encountering an issue with adding images to your OMR template using Aspose.OMR. The error message indicates that the application cannot find the full path for the image you are trying to use. Here are some steps and tips to help you resolve this issue:

  1. Image Path: Ensure that the image path you provide is correct. For local images, use an absolute path that the application can access. For example:

    string imagePath = @"D:\Veera\HelloOMR\wwwroot\templetefld\favicon.png";
    
  2. URL Images: If you are using a URL for the image, make sure that the URL is accessible from the environment where your application is running. You can test the URL in a web browser to confirm it is reachable.

  3. GenerateTemplate Method: When calling the GenerateTemplate method, ensure that you are passing the correct parameters, including the image path. Here’s a basic example of how to use the method:

    OmrEngine omrEngine = new OmrEngine();
    omrEngine.GenerateTemplate("path_to_template.txt", outputPath, imagePath);
    
  4. Check Permissions: If you are using a local path, ensure that your application has the necessary permissions to access the directory and the image file.

  5. Documentation Reference: For more detailed guidance on generating OMR templates with images, you can refer to the official documentation which provides comprehensive instructions and examples.

If you continue to face issues, consider checking the documentation for any specific requirements regarding image formats or paths, or reach out to the support forum for further assistance.

Sources:
[1]: Generate OMR Templates with Images in .NET | Aspose.OMR .NET API

Controller
OmrEngine omrEngine = new OmrEngine();
string workingDirectory = System.IO.Directory.GetCurrentDirectory();
Aspose.OMR.Generation.GlobalPageSettings globalPageSettings = new Aspose.OMR.Generation.GlobalPageSettings()
{
PaperSize = Aspose.OMR.Generation.PaperSize.Tabloid,
BubbleColor = Aspose.OMR.Generation.Color.Red,
ImagesPaths = new string[] {
System.IO.Path.Combine(workingDirectory, “aspose-logo.png”),
@“D:\Veera\HelloOMR\wwwroot\templetefld\favicon.png”
}
};

        GenerationResult generationResult = omrEngine.Generate(templatePath, globalPageSettings);

templete.txt
?image=favicon.png
align=center
width: 100px
height: 100px

is correct?

Hello, @Veera127

There is an article for Adding Images.

At the current moment, only local file paths are resolved, but with the help of ImageCollection it is possible to pass MemoryStream with image content.