Japanese font problems when converting Doc to Pdf

Hi

I’ m evaluating Aspose.Words for.NET for converting Word Docs to PDF

I downloaded and tested with the latest 9.2.0 dlls as I noticed you have included fixes for Japanese font related problems in PDF creation in this release.

The code I am using is as described in your doc.

Document doc = new Document("1.doc");

doc.Save("1.pdf");

I’ve uploaded the word and pdf docs for you to investigate.

There seems to be a problem with text flow / alignment around the first table on the right side of the page.
There is a problem with the font used in the two lower images, the Word doc uses MS PGothic but in the PDF has this replaced with MicrosoftSansSerif.

If I convert to Docx rather than PDF, the results are correct.

Am I doing something wrong in my code ?
Any guidance appreciated.

Thanks

Andy

Hello

Thanks for your request. The problem occurs because you are using floating objects in your document. Currently Aspose.Words does not fully support Text Wrapping during converting to PDF. As a workaround, you can try refactoring your document to avoid using floating TextBoxes and Images. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
Regarding the problem with font, please make sure that the MS PGothic font is installed on your PC. During converting to PDF Aspose.Words should read all fonts used in the original document to create font subset, which will be stored in the output PDF file.
If the font is installed, and the problem still exists, please attach this font here for testing. I will investigate the problem and provide you more information.
Best regards,

Hello

Thanks for the quick feedback.
I hope you have a failry quick solution to the floating object problem.
Refactoring is not simple in this case as I am not in control of the document origination.

Regarding MS PGothic, it is installed on my machine.
It is a TTC which I have zipped up and uploaded for your testing.
I’m interested as that same font is used in the document at other places, the two characters next to the large number ‘1’ at the top left of the page are the same font.
I wondered if it was a problem specifcally caused by the font being within a picture ?

Again, I have no possibility to influence the document origination in this case and I cannot easilly refactor it.
I look forward to your feedback and any suggestions to work around this would be great.

Thnaks

Andy

Hello

Thanks for your inquiry. Unfortunately, positioning of floating objects is an extremely complex issue, so I cannot promise you a fast fix. Hopefully, this issue will be resolved somewhere at the beginning of the next year, but I cannot provide you a more solid estimate at the moment.
I managed to reproduce the problem with text inside image. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
As a temporary workaround, you can try converting vector images in your document to raster images. Please see the following code:

Document doc = new Document("1.doc");
// Get all shapes in the document.
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
// Loop through all shapes.
foreach(Shape shape in shapes)
{
    // If shape contains a vector image, convert it to raster image.
    if (shape.HasImage && (shape.ImageData.ImageType == ImageType.Wmf || shape.ImageData.ImageType == ImageType.Emf))
    {
        using(MemoryStream vectorImageStream = new MemoryStream(shape.ImageData.ImageBytes))
        using(Image image = Image.FromStream(vectorImageStream))
        using(MemoryStream resterImageStream = new MemoryStream())
        {
            image.Save(resterImageStream, ImageFormat.Png);
            shape.ImageData.SetImage(resterImageStream);
        }
    }
}
// Save output docuemnt to PDF.
doc.Save("out.pdf");

Best regards,

Hello
We are happy to tell you that a very cool and important feature (filed as 7180) is included in the new version of Aspose.Words. Text wrapping around images and shapes when rendering Microsoft Word documents to PDF, XPS and printing is now supported. You can download the latest version from here.
Best regards,

Hello

Thanks for the update.
I tested with Words 9.6 and uploaded the resulting PDF for you review.
I also uploaded a PDF created directly from Word as the reference.

Is the difference I am seeing related to the Tight and Through options which are not yet implemented ?

Thanks and regards
Andy

Hi,

Thank you for additional information. I managed to reproduce it on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
The problem seems to occur because Japanese (and any other Asian languages) does not have whitespaces in text. So Aspose.Words thinks that whole paragraph is one very long word and does not break it to lines.
Best regards,

I am currently having this same issue with Japanese text. Could you confirm when you expect this issue to be resolved?

Thank you.

Hello
Thanks for your inquiry. Unfortunately, I cannot give you any estimate at the moment. Our developers will analyze the issue and then we will be able to provide you more information.
Best regards,

Also could you please attach your input and output documents here for testing?

Best regards,

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

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

The issues you have found earlier (filed as WORDSNET-4331) have been fixed in this .NET update and this Java update.

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