Unable to get some colored text on saved tif image using SaveToImage() CCITT4 compression

Hello,
We are trying to convert Word Document containing colored text to CCITT4 Tif Images (Black & White) and noticed some colored text missing.
Attached Sample “Hello.doc” and resulting image “HelloImage0.tif”.
Here is the Sample Code we are using:

using System;
using System.Collections.Generic;
using System.Text;
using Aspose.Words;
using Aspose.Words.Rendering;
namespace WordTester
{
    class Program
    {
        static void Main(string[] args)
        {
            Aspose.Words.License licenseWords = new Aspose.Words.License();
            licenseWords.SetLicense("Aspose.Words.lic");
            ImageOptions imgOptions = new ImageOptions();
            imgOptions.Resolution = (float) 200;
            imgOptions.TiffCompression = TiffCompression.Ccitt4;
            Document doc = new Document("Hello.doc");
            for (int i = 0; i <doc.PageCount; i++)
                doc.SaveToImage(i, 1, "HelloImage" + i.ToString() + ".tif", imgOptions);
        }
    }
}

Please let us know if we are missing something in code and/or if there is a method to set a threshold level to show all colors.
We need to display all text on CCITT4 Tif Images (Black & White).
We hope to hear from you soon.
Thank You!

Hello

Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
Best regards,

I am glad you were able to reproduce the issue. Since you stated that this problem was linked to the appropriate issue, does that mean this is a problem that has been reported previously by a different customer? Is there a specific problem number that you can provide so we can track the resolution to this problem?
Thank you,
Robert

Hi Robert,

Thanks for your inquiry. There was another customer, who also reported the similar issue. By the way there is a very simple workaround of this issue. As you know CCITT3 and CCITT4 are bitonal, so you can just reset color of text before converting document to TIF. For example, you can try using the following code:

// Open document.
Document doc = new Document(@"Test001\in.doc");
// Get all Run nodes.
NodeCollection runs = doc.GetChildNodes(NodeType.Run, true);
// Reset color of text in each run.
// Color.Empty is Auto color in MS Word.
foreach(Run run in runs)
    run.Font.Color = Color.Empty;
// Save document as TIFF.
ImageOptions opt = new ImageOptions();
opt.TiffCompression = TiffCompression.Ccitt4;
doc.SaveToImage(0, doc.PageCount, @"Test001\out.tif", opt);

Hope this helps.
Best regards.

The issues you have found earlier (filed as 10465) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(64)