Dear Aspose Team,
Our customers are experiencing the following problem with some documents (we don’t know the exact number) that have automatic hyphenation:
The documents are processed in our application and converted to a PDF document. During conversion, the application freezes (the next step isn’t reached in the debugger). CPU usage increases, but otherwise nothing happens. No errors occur, but saving to PDF format doesn’t complete; only an empty PDF file is created.
In the attached VS console project, I have included a reduced document (\Resources\Testdoc.docx) and code that can be used to reproduce the problem.
Other, almost identical documents can be saved as PDFs without any problems, even with automatic hyphenation.
If you disable automatic hyphenation for the affected documents, they also work without problems.
We tested with lates Words.Net version (25.5).
We played around with different PdfSaveoptions but with no effect.
Any idea?
Best regards
AsposeConsole.zip (300.4 KB)
@bitworks
It seems that your application is freezing during the conversion of Word documents with automatic hyphenation to PDF format, resulting in an empty PDF file. This issue may be related to how the Aspose.Words library handles documents with specific formatting features like hyphenation.
Here are a few suggestions to troubleshoot and potentially resolve the issue:
-
Disable Automatic Hyphenation: Since you mentioned that disabling automatic hyphenation allows the documents to be processed without issues, consider implementing a pre-processing step in your application to disable hyphenation for documents before conversion. This can be done by accessing the document’s settings and modifying the hyphenation options.
-
Check for Document Corruption: Ensure that the documents being processed are not corrupted. You can try opening the documents in Microsoft Word to see if they display correctly.
-
Use Different PdfSaveOptions: Experiment with various PdfSaveOptions
settings. For instance, you might want to adjust the TextCompression
, EmbedFullFonts
, or Compliance
properties to see if they have any effect on the conversion process.
-
Memory Optimization: If the documents are large, consider enabling memory optimization in the PdfSaveOptions
. This can help reduce memory consumption during the conversion process.
-
Update Aspose.Words: Ensure that you are using the latest version of Aspose.Words. Sometimes, issues are resolved in newer releases, so updating to the latest version may help.
-
Debugging: Since you mentioned that the application freezes without errors, consider adding logging to your application to capture the state before the conversion process. This may help identify if a specific document or setting is causing the freeze.
If the problem persists after trying these suggestions, you may want to reach out to Aspose support with specific details about the documents and the code you are using for further assistance.
For more information on PdfSaveOptions
and its properties, you can refer to the official documentation here.
If you have any further questions or need additional assistance, feel free to ask!
@bitworks
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-28332
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 the meantime I think it’s related to this issue: Infinite Loop When Converting DOCX to PDF Using Aspose.Words with w:hint=“eastAsia” Character - Free Support Forum - aspose.com and it’s not necessarily related to automatic hyphenation because we found some documents without automatic hyphenation showing the same behaviour.
But all affected documents are having StructuredDocumentTags (checkboxes) and in the Document.xml all having a run inside the SDT with w:hint="eastAsia"
attribute.
An example of SDT xml:
<w:sdt>
<w:sdtPr>
<w:rPr>
<w:rFonts w:asciiTheme="minorHAnsi" w:hAnsiTheme="minorHAnsi" w:cstheme="minorHAnsi"/>
</w:rPr>
<w:id w:val="-2126682795"/>
<w14:checkbox>
<w14:checked w14:val="0"/>
<w14:checkedState w14:val="2612" w14:font="MS Gothic"/>
<w14:uncheckedState w14:val="2610" w14:font="MS Gothic"/>
</w14:checkbox>
</w:sdtPr>
<w:sdtContent>
<w:r w:rsidR="00B84B04">
<w:rPr>
<w:rFonts w:ascii="MS Gothic" w:eastAsia="MS Gothic" w:hAnsi="MS Gothic" w:cstheme="minorHAnsi" w:hint="eastAsia"/>
</w:rPr>
<w:t>☐</w:t>
</w:r>
</w:sdtContent>
</w:sdt>
When I remove the w:hint="eastAsia"
attributes from the SDT xml for all the checkboxes document works fine as described in the linked forum post too.
As far as I can see it is not possible to access the attribute via Aspose.Words to customize it, is that correct?
@bitworks Yes, you’re right. The main problem is related to the infinite loop. This issue is currently under development. Unfortunately, Aspose.Words does not provide access to the w:hint
attribute. We have already registered a WORDSNET-12061 request in our issue tracker. We apologize for any inconvenience caused.
The issues you have found earlier (filed as WORDSNET-28332) have been fixed in this Aspose.Words for .NET 25.7 update also available on NuGet.