I encountered an issue while generating PDFs where some product brand names include special characters like &. To temporarily resolve this, I used .Replace("&", "& ;") in the FooterHtml property of Markdown2PdfOptions.
For a permanent fix, we can:
Update the Prompt: Adjust the product generation prompt to avoid names with special characters.
Use WebUtility.HtmlEncode: Automatically escape special characters (e.g., &, <, >) using WebUtility.HtmlEncode to handle them correctly in XML/HTML contexts.