Hi Team,
I am converting a word document to single page tiff images by using he below code.
Here how can i implement the iWarningCallback interface and what is the benefit by implement this .
Please see the current code which i am using to convert document to single page tiff
public static System.Drawing.Image[] ConvertWordToSingleTiff(string OutputFolder, string FullInputFileName)
{
System.Drawing.Image[] sourceImages = null;
try
{
//FullconvertedMultiTiffName = Path.Combine(OutputFolder, Path.GetFileNameWithoutExtension(FullInputFileName) + ".TIF");
if (!Directory.Exists(OutputFolder))
{
Directory.CreateDirectory(OutputFolder);
}
Aspose.Words.Document doc = new Aspose.Words.Document(FullInputFileName);
ImageSaveOptions options = new ImageSaveOptions(Aspose.Words.SaveFormat.Tiff);
options.Resolution = 200;
options.TiffCompression = TiffCompression.Ccitt4;
options.ImageBrightness = .40f;
Stream output = null;
sourceImages = new System.Drawing.Image[doc.PageCount];
for (int page = 0; page < doc.PageCount; page++)
{
output = new MemoryStream();
options.PageIndex = page;
options.PageCount = 1;
//sourceImages[page - 1] = System.Drawing.Image.FromStream(output);
doc.Save(output,options);
sourceImages[page] = System.Drawing.Image.FromStream(output);
sourceImages[page].Save(Path.Combine(OutputFolder, String.Concat(Path.GetFileNameWithoutExtension(FullInputFileName), page.ToString().PadLeft(3, '0'), ".", "tiff")));
}
return sourceImages;
}
catch (Exception ex)
{
throw new Exception(String.Format("Error converting {0} to Tiff : {1}", Path.GetFileNameWithoutExtension(FullInputFileName), ex.Message));
}
}
Regards
Anish