Backslash (\) Being Converted to Yen Symbol (¥) During HTML to PDF Conversion in Aspose

Hello Team

When converting HTML to PDF using Aspose in .NET, backslash characters (\) in the HTML are incorrectly rendered as the Yen symbol (¥) in the resulting PDF only in the deployed environment. This issue does not occur on local machines. It happens regardless of font or encoding settings and affects the accuracy of the PDF output.

Steps to Reproduce:

  1. Prepare an HTML file containing a backslash (\).
  2. Convert the HTML to PDF using Aspose in the deployed environment with .NET.
  3. Open the PDF; the backslash appears as ¥.

Expected Behavior:
Backslash (\) should be rendered correctly in the PDF.

Actual Behavior:
Backslash (\) is converted to Yen symbol (¥) in the deployed environment, while local machines render it correctly.

 var options = new Aspose.Html.Saving.PdfSaveOptions();
 options.PageSetup.AnyPage = page;

 Converter.ConvertHTML(document, options, streamProvider);

even we try to replace “" with \ still getting same error.
var htmlContent = html.Replace(”\", “\”);

@pthube

The issue of backslashes (\) being rendered as Yen symbols (¥) during HTML to PDF conversion in your deployed environment may stem from font encoding differences between your local machines and the server environment. Here are several steps to troubleshoot and potentially resolve the issue:

  1. Check Font Availability: Verify that the font used in your HTML is available on the deployed environment. If the font is missing, Aspose may substitute it with a default font that does not support the backslash character correctly.

  2. Specify a Different Font: Explicitly set a font that you know supports the backslash character in your HTML/CSS. For example:

    <style>
        body {
            font-family: 'Arial', sans-serif; /* Ensure this font is available on the server */
        }
    </style>
    
  3. Use a Different Encoding: Ensure that the HTML content is encoded correctly. You can specify the character set in your HTML:

    <meta charset="UTF-8">
    
  4. Test with a Simple HTML: Create a minimal HTML file containing just the backslash and convert it to PDF to see if the issue persists. This can help isolate the problem.

  5. Update Aspose Library: Make sure you are using the latest version of the Aspose library, as updates may include fixes for rendering issues.

If the problem continues, consider reaching out to Aspose support with specific details about your environment and the HTML content you are using.