We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

XamlFlow conversion without storing images locally


I would like to convert an HTML document to a XamlFlow document. This works very fine, but I don't want to store embedded images locally. Is there a possibility to convert to XamlFlow, but load embedded images from a server (absolute URIs) instead of storing them locally?

Thank you in advanced!

Hi Christina,

Thanks for your inquiry. Please use the following code snippet to achieve your requirements.
The XamlFlowSaveOptions.ImagesFolderAlias property specifies the name of the folder used to construct image URIs written into an XAML document. Default is an empty string.

When you save a Document in XAML format, Aspose.Words needs to save all images embedded in the document as standalone files. ImagesFolder allows you to specify where the images will be saved and ImagesFolderAlias allows to specify how the image URIs will be constructed.

  • If ImagesFolderAlias is not an empty string, then the image URI written to XAML will be ImagesFolderAlias + .
  • If ImagesFolderAlias is an empty string, then the image URI written to XAML will be ImagesFolder + .
  • If ImagesFolderAlias is set to ‘.’ (dot), then the image file name will be written to XAML without path regardless of other options.

Document doc = new
Document(MyDir + “in.html”);<o:p></o:p>

XamlFlowSaveOptions opt = new XamlFlowSaveOptions(SaveFormat.XamlFlow);

opt.ImagesFolderAlias = "http://www.aspose.com/";

opt.ImageSavingCallback = new ImageSavingCallback();

doc.Save(MyDir + "out.xaml", opt);

public class ImageSavingCallback : IImageSavingCallback


public void ImageSaving(ImageSavingArgs args)


// Since we are referencing an existing image on an external site we don’t need to save the image to disk. Instead set the image to be saved to a stream and dispose of it.

args.ImageStream = new MemoryStream();

args.KeepImageStreamOpen = false;



Thanks a lot, that´s perfect! I will try it out.

Hi Christina,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.