We just compared you shared “aspose_generated.pdf” and I shared “excel_saved_by_Excel_Save_as.pdf”. Please share a comparing screenshot of the two pdf files on your side.
Please check the attachments:
3_files_comparing.jpg (127.7 KB)
excel_saved_by_Excel_Save_as.pdf (54.0 KB)
Microsoft_PDF_generated.pdf (105.1 KB)
aspose_generated.pdf (19.4 KB)
@John.He
It seems you’re experiencing an issue where the font appears bold during the conversion of Excel to PDF using Aspose.Cells. This can happen due to font compatibility issues or settings in the PdfSaveOptions.
Cause: The bold appearance may result from missing fonts on the system where the conversion is taking place or incorrect PdfSaveOptions settings.
Solution: To resolve this issue, I recommend checking the following:
-
Font Compatibility: Ensure that the fonts used in your Excel file are available on the system where the conversion is taking place. If a font is missing, Aspose.Cells may substitute it with a different font, which could appear bolder.
-
PdfSaveOptions Settings: Adjust the CheckFontCompatibility
property in the PdfSaveOptions
class. Setting this to true
will help ensure that the fonts are checked for compatibility before rendering.
-
Default Font: If your Excel file contains Unicode characters that are not supported by the specified font, set the DefaultFont
property in PdfSaveOptions
to a font that supports these characters.
Here’s a minimal code example to illustrate how to set these options:
using Aspose.Cells;
using Aspose.Cells.Rendering;
public void ConvertExcelToPdf(string inputFilePath, string outputFilePath)
{
// Load the Excel file
Workbook workbook = new Workbook(inputFilePath);
// Create PdfSaveOptions
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions
{
CheckFontCompatibility = true,
DefaultFont = "Arial" // Set a default font that supports your characters
};
// Save the workbook as PDF
workbook.Save(outputFilePath, pdfSaveOptions);
}
Next Steps: After making these adjustments, try converting the file again and see if the font issue persists. If it does, please share any specific details about the fonts used in your Excel file, and I can assist you further.
Thank you for your patience, and I look forward to your update!