After convert to pdf, the tablelayout are different with word

in which version of aspose.words?I tried your code, but doesn’t work:

@softboy I used the latest 25.8 version of Aspose.Words for .NET in my tests.

Hi,
i see the similiar ticket at 用aspose-word24.6版本,word转pdf后,pdf页码数量会多一页,导致页码数不一致 - #6 by vyacheslav.deryushev,
which hasn’t been fixed. Is it the same issue?

@softboy The issue reported in the mentioned thread is not resolved yet. It has been postponed and is not yet scheduled for development.

before, we use 24.12, when i use 25.8, the converted format still different with word. see below:
pdf:


word:

the following is my code:

        LoadOptions loadOptions = new LoadOptions();
        loadOptions.getLanguagePreferences().setDefaultEditingLanguage(EditingLanguage.CHINESE_PRC);
        Document doc = new Document(byteArrayInputStream,loadOptions);
        doc.getLayoutOptions().setTextShaperFactory(HarfBuzzTextShaperFactory.getInstance());
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        PdfSaveOptions options = new PdfSaveOptions();
        options.setSaveFormat(SaveFormat.PDF);
        options.getOutlineOptions().setHeadingsOutlineLevels(3);
        options.getOutlineOptions().setExpandedOutlineLevels(1);
        doc.save(byteArrayOutputStream,options);

pc environment: windows 11

@softboy Could you please attach your actual PDF output produced with the above code? We will check it and provide you more information.

aspose.pdf (7.2 MB)

attatched

@softboy As I can see fonts used in your PDF document differs from fonts used in PDF produced on my side. Please try implementing IWarningCallback as suggested above to check whether font substitution is performed on your side.

On my side side I see the following warning upon rendering your document:

Layout: FontSubstitution: Font '中文宋体' has not been found. Using 'SimSun' font instead. Reason: alternative name from document.

In chinese version of windows,‘中文宋体’ is embeded, it equals ‘SimSun’, the two are the single one



@softboy After analyzing the issue, I discovered that the table display problem occurs when the STXINWEI.TTF font is installed. If this font is removed, the table will display correctly. Unfortunately, I cannot find any text that uses the STXINWEI.TTF font, but is it possible to use another font instead?

The issue with text shifting from “4-2-4” on the next page is the same as in MS Word, so this is expected behavior.

Is it your FontSubstitution has problem? every chinese font has its chinese fontname, it should no any FontSubstitution callback occurred?

@softboy Alexey does not have the Chinese version of Windows, so messages from FontSubstitution can be detected because different font names are used in different locales.

no, we cannot require the users to do that. I think you should do further research to find out the root cause

@softboy Okay, thank you for the information. I understand that this cannot be a workaround. Could you please provide the output PDF file saved from MS Word? This will help us analyze the problem correctly.

aspose.pdf (5.9 MB)

@softboy
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28645

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

In addition, on chinese version of windows, also detected FontSubstitution callback messages

@softboy Could you please provide the warnings?

Font ‘中文宋体’ has not been found. Using ‘宋体’ font instead. Reason: alternative name from document.

@softboy Thank you for the provided information. I will add it to the issue.