Image is not displayed when INCLUDEPICTURE field is used with relative path using C#

Hi All,

I can't get images to work by opening an RTF and saving it as a PDF, could anyone spot if I have done anything daft please!

{INCLUDEPICTURE "..\\images\\0295_all_20110110_i1_r1.jpg" \* MERGEFORMAT \d \x \y}

LoadOptions loadOptions = new LoadOptions();
loadOptions.BaseUri = @"C:\cms\docs\";

the directories look like

c:\cms\docs\ The documents
c:\cms\images\ The images

As I understand it, the baseUri should then be available for any relative path translations performed inside aspose?

Document doc = new Document( stream, loadOptions );
stream.Close();

if ( doc != null )
{
foreach (Shape shape in doc.GetChildNodes(NodeType.Shape, true) )
{
if (shape != null && shape.HasImage && shape.ImageData.IsLink)
{
System.Diagnostics.Debug.WriteLine( shape.ImageData.ImageBytes );
System.Diagnostics.Debug.WriteLine( shape.ImageData.SourceFullName );
}
}
}

The ImageBytes array is always null and the SourceFullName is always the relative path.

I have also tried doing a .SetImage on the ImageData but to no avail!


Many Thanks


Chris

Hi Chris,

Thanks for your query. I have tested the scenario and have not found the issue while using latest version of Aspose.Words for .NET. Please use the latest version of Aspose.Words for .NET. Please check the path of image file as well.

OK thanks for the quick post...

I replaced version 11-1-0-0 with 11-4-0-0 and it worked.

For reference, I enabled stopping for all exceptions and found a bunch of these:

Additional information: The sfnt file is not valid.

I guess it was some other rendering problem with my source document...

Thanks for the help

Chris

Hi Chris,

Thanks for using the latest version of Aspose.Words for .NET. Please let us know if you have any more queries.