Convert Word DOC to TIFF Image & Retain Orientation of Japanese Characters | C# .NET

This is a resurrection of case WORDSNET-21330 - which your support team claimed was fixed with the latest version of Aspose Words For .Net ( version 21.4).
However our test with version 21.7.0 suggests that the problem still persists…

@SamManoff,

Yes, WORDSNET-21330 was resolved. Please compress the following resources into ZIP format and attach the .zip file here for testing:

  • A simplified Word DOC document containing the Japanese characters
  • Aspose.Words 21.7 generated TIFF Image file showing the undesired behavior
  • Please also provide a comparison screenshot highlighting (encircle) the problematic area(s) in Aspose.Words generated output and attach it here for our reference.

As soon as you get these pieces of information ready, we will then start investigation into your particular scenario and provide you more information.

IF-5235.zip (167.1 KB)
Please find the following attachments:
IF-5235.doc - The source document
Aspose-21-7-0.jpg - A snapshot of the generated image with the the faulting sections highlighted.
IF-5235.tiff - The Aspose generated image by our application.
MsFax-IF-5235.tif - The desired resulting image, generated by MS Fax printer.

Hope this helps.
Sam

Uploaded the files through Aspose sight.
Thanks - Sam

@SamManoff,

Please use the following code to get the desired output:

Document doc = new Document("C:\\Temp\\IF-5235\\IF-5235.doc");
doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
doc.Save("C:\\temp\\IF-5235\\21.7.tiff", options);

I have also attached the output TIFF Image file here for your reference:

AsposeGen_HarfBuzz.png (61.3 KB)
Hi Awais
Attached is the image generated when I added the suggested
doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;
statement.
As you can see the text got stripped out altogether.
Please advise,
Sam.

@SamManoff,

Please check the following article to determine if any fonts related warnings are being thrown by Aspose.Words on your end:

How to Receive Notification of Missing Fonts and Font Substitution during Rendering

Please make sure that the following fonts are installed on your machine:

  • MS Pゴシック
  • MS ゴシック
  • Century
  • MS 明朝
  • MS P明朝

Hi,
All of the document fonts as found in the doc.FontInfos list were available - hardly surprising given that without the last addition of :
doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;
statement.
The generated image seems to show the right fonts (apart from the reported issue which seems like a proper rendering issue not related to a missing font).

If it comes out OK on your environment it mast be some other conflicting option / constraints that is causing my runs to generate a blank (no text) table.

Cheers, Sam.

@SamManoff,

I have prepared a simple console application which produces correct Image file on my end:

Source Word document and Aspose.Words generated TIFF Image can be found in app’s Bin > Debug folder. We tested the scenario over Windows 10.

Also, please share your environment details (OS, .NET frameworks versions etc). Do you get this particular issue on only one particular machine?

Output_4_6_1.zip (48.1 KB)
Hi unfortunately I’m not so lucky. This the comment I get with the test application you’ve sent:
The output is stripped out table (as shown in the tiff file attached) :
Aspose.Words Warning: Table column widths may need to be calculated. Rendered column widths could differ. At Table 1, Section 1
Also when I run it with our real application and we set some additional options I get the exception I’ve attached.

Thanks Sam.

@SamManoff,

Please follow the steps below to upgrade to the latest 21.8 version of Aspose.Words for .NET.

  • Double click on 232623.sln to open with Visual Studio
  • Inside Visual Studio, Right Click on the Solution (see screenshot.png (22.5 KB))
  • Choose Manage NuGet Packages for Solution
  • Go to the Updates Tab
  • Click on the Select all packages checkbox
  • Press Update button (see update nuget packages.png (39.4 KB))
  • Then follow the on-screen installation boxes and finally Rebuild the solution.

This should fix the following exception on your end:

System.Exception: Text shaper factory failed to return text shaper for 'C:\Windows\Fonts\msgothic.ttc', face index '2' ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)