Eszett characters are turned to 'SS' after converting DOCM to PDF

Hi,
I’m trying to convert customer’s input docm file into pdf where input file contains Eszett characters which are seen as ‘SS’ in pdf.
After further checking, we found the issue is specifically for the ones set into the document through below macro :

Sub AutoOpen()
    Dim oStory As Range
    For Each oStory In ActiveDocument.StoryRanges
        oStory.Fields.Update
        If oStory.StoryType <> wdMainTextStory Then
            While Not (oStory.NextStoryRange Is Nothing)
                Set oStory = oStory.NextStoryRange
                oStory.Fields.Update
            Wend
        End If
    Next oStory
    Set oStory = Nothing
        ActiveDocument.Saved = True
End Sub

Alternative macro

Sub AutoOpen()
        Dim aStory As Range
        Dim aField As Field
        For Each aStory In ActiveDocument.StoryRanges
            For Each aField In aStory.Fields
                aField.Update
            Next aField
        Next aStory
    ActiveDocument.Saved = True
End Sub

I’ve created an sample.docm where I’ve implemented Eszett character created with both macro and with ascii (Alt+0223). I’ve converted it to PDF with latest aspose.words 25.9 and attached the output pdf too where you can see the changes.

sample.docx (13.3 KB)

sample.pdf (18.6 KB)

Thanks
Ramani Sankar

@rsv2

El problema que estás experimentando con los caracteres Eszett (ß) que se convierten en ‘SS’ al exportar un archivo DOCM a PDF puede estar relacionado con la codificación de caracteres en el documento. Aquí hay algunas sugerencias para solucionar este problema:

  1. Verifica la codificación del documento. Asegúrate de que el archivo DOCM esté guardado en una codificación que soporte caracteres especiales, como UTF-8. Esto puede ayudar a evitar problemas de conversión.

  2. Actualiza los campos antes de la conversión. Es importante que todos los campos en el documento estén actualizados antes de realizar la conversión a PDF. Puedes utilizar el siguiente código para actualizar todos los campos:

    Sub ActualizarCampos()
        Dim oStory As Range
        For Each oStory In ActiveDocument.StoryRanges
            oStory.Fields.Update
            If oStory.StoryType <> wdMainTextStory Then
                While Not (oStory.NextStoryRange Is Nothing)
                    Set oStory = oStory.NextStoryRange
                    oStory.Fields.Update
                Wend
            End If
        Next oStory
    End Sub
    
  3. Prueba con una versión diferente de Aspose.Words. A veces, los problemas pueden ser específicos de una versión. Asegúrate de estar utilizando la última versión de Aspose.Words, o prueba con una versión anterior para ver si el problema persiste.

  4. Revisa la configuración de exportación a PDF. Asegúrate de que no haya configuraciones específicas en la exportación que puedan estar afectando la representación de los caracteres.

Si después de seguir estos pasos el problema persiste, considera buscar asistencia adicional en los foros de Aspose, ya que podría ser un problema específico de la biblioteca o del documento en sí.

Hi,
The macro sent is the same as I described.
I’ve tried with various other versions apart from 25.9 and still issue presists.
Can you help me out here

@rsv2
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): WORDSJAVA-3192

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.

Hi @alexey.noskov
When can I expect an update on this issue?

@rsv2 Unfortunately, at the moment we cannot provide you any estimates. The issue is currently in the queue for analysis. Once analysis is done we will be able to provide you more information or a fix. Please accept our apologies for your inconvenience.

Hi @alexey.noskov
Can we have an update on this issue since this is urgent and critical issue from our side

@rsv2 The issue is currently in the queue for analysis. We will keep you updated and let you know once it is resolved or we have more information for you. Please accept our apologies for you inconvenience.

Hi @alexey.noskov
Customer is following up on us every week on this issue
Is there any update?

@rsv2 Unfortunately, the issue is not resolved yet. It looks like the reason of the problem is AllCaps option. If reset it the document is rendered properly. So you can use the following code as a temporary workaround:

Document doc = new Document("C:\\Temp\\in.docx");
    
FindReplaceOptions opt = new FindReplaceOptions();
opt.setUseSubstitutions(true);
opt.getApplyFont().setAllCaps(false);
doc.getRange().replace("ß", "$0", opt);
    
doc.save("C:\\Temp\\out.pdf");

Hi @alexey.noskov
I’m afraid that the code workaround didnt work. I’ve tried it with my standalone program

import com.aspose.words.Document;
import com.aspose.words.PdfSaveOptions;
import com.aspose.words.FindReplaceOptions;

public class demo {
    public static void main(String[] args) {
        try {
            String inputPath = "C:\\Users\\rsv2\\Documents\\aspose\\sample.docx";
            // Path to the output PDF file
            String outputPath = "C:\\Users\\rsv2\\Documents\\aspose\\output.pdf";

            // Load the DOCM document
            Document doc = new Document(inputPath);
			
			FindReplaceOptions opt = new FindReplaceOptions();
			opt.setUseSubstitutions(true);
			opt.getApplyFont().setAllCaps(false);
			doc.getRange().replace("ß", "$0", opt);

            // Save as PDF
            doc.save(outputPath);

            System.out.println("DOCM converted to PDF successfully!");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

This too gave the same issue.
Why the same symbol generated from ascii works and which is generated via macro didnt?
Anyway we rely for a permanent fix and I’ll wait for it.

@rsv2 The workaround works fine on my side. Here is the produced output: out.pdf (18.0 KB)

@alexey.noskov Anyway customer will not accept a code change as a temporary workaround.
Can I expect a permanent fix?

@rsv2 The issue is currently in analysis. We will keep you updated and let you know once it is resolved.

Hi @alexey.noskov
Is there any update on this issue?

@rsv2 The issue is already resolved in the current codebase. The fix will be included into the next 25.11 version of Aspose.Words for Java.