BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
Hello,
In the attached project, I am using some code that you gave me in order to apply formatting to all characters in an equation. I have added an option to set the equation to be bold, but the bold format is not being applied to all of the characters in the equation. Can you please take a look and let me know how I can resolve this issue?
Thanks.
Hi
Natalie,
Based on the given details, we understand that you are trying to apply bold formatting
to the equations. Kindly refer to the documentation
and GitHub
link for applying bold formatting. You can also refer to the code snippet below
for reference:
WordDocument document = new WordDocument(); document.EnsureMinimal(); document.LastParagraph.AppendMath(@"\mathbf{A_{33} B_{44}}"); |
Regards,
Dharanya.
Hi Dharanya,
Adding \mathbf formats the equation as text so none of the equations are formatted properly, so this is not a solution to my original problem. Is there another way to do this?
Thanks.
Natalie,
We have modified the code snippet to apply bold formatting in MathFormat style. In Microsoft Word,
bold formatting for equations is applied in MathFormat style to ensure proper preservation. Kindly use the below line of code in the SetCharacterFormatToRunElement() method and also refer
to the attached modified sample for reference.
runElement.MathFormat.Style
= MathStyleType.Bold; |
Regards,
Dharanya.
Hello,
Please see the attached file that displays a PDF where some of the characters are still not shown in bold. Please advise on how to solve this issue.
Thanks.
Natalie,
We have reproduced the reported problem while viewing the content in the PDF
Viewer—some characters are still not displayed in bold. However, when we saved
the PDF document, we verified that the bold formatting for the equation content
was applied correctly. We will check the reason why some equation characters
are not shown in bold and share further details within two days.
Regards,
Dharanya.
Hi Natalie,
On further investigation, font glyphs are not available in
the PDF document, so that bold is not applied in the PDF document. We
recommend setting the EmbedFonts and EmbedCompleteFonts APIs to true during Word to PDF conversion. This
setting allows you to embed the complete font information (glyphs) from the
TrueType fonts used in the converted PDF document. It is helpful to resolve the
reported issue.
Please use the highlighted code snippet below during the Word to PDF conversion to resolve the reported issue.
private void CreateAndDisplayReport() { var reportInfo = Report.GenerateProjectReportTemplate();
var reportGenerator = new ReportGenerator(); var document = reportGenerator.BuildSyncfusionReport(reportInfo);
var tempPath = Path.GetTempFileName();
using (DocToPDFConverter converter = new()) { converter.Settings = new DocToPDFConverterSettings() { ExportBookmarks = ExportBookmarkType.Bookmarks, EmbedFonts = true, EmbedCompleteFonts = true }; //Converts Word document into PDF document using (PdfDocument pdfDocument = converter.ConvertToPDF(document)) { //Saves the PDF document pdfDocument.Save(tempPath); } };
document.Close();
pdfViewer.Load(tempPath); } |
Regards,
Anto Nihil S