Excel to PDF - wrong cell height, letters cut off at top

I use the following code to save Excel as PDF usging aspose-cells-24.3.jar.

The letters in the cells are cut off at top and lines are separated by a too large distance, example:
SaveAsPDF.zip (30.7 KB)

How can I improve the PDF output?

    Workbook workbook = new Workbook(istream);
    try {
      
      PdfSaveOptions pdfOptions = new PdfSaveOptions();
      pdfOptions.setAllColumnsInOnePagePerSheet(true);
      pdfOptions.setGridlineType(GridlineType.HAIR);

      WorksheetCollection worksheetCollection = workbook.getWorksheets();
      for (Object worksheetObj : worksheetCollection) {
        if (worksheetObj instanceof Worksheet worksheet) {
          PageSetup pageSetup = worksheet.getPageSetup();
          pageSetup.setPrintGridlines(true);
          pageSetup.setHeader(0, "&A");
      }
      
      workbook.save(ostream, pdfOptions);
      
    }
    finally {
      ostream.close();
      workbook.dispose();
    }

@wimix,

I have tested your scenario/case using your template XLSX file and sample code segment, it works fine and as expected. Please find attached the output PDF file for your reference.
output.pdf (30.2 KB)

I also checked your output PDF and found some other font was used in your output PDF instead of “Calibri”. It means, “Calibri” font is missing on your end. Please note, underlying fonts (used in the workbook) are compulsory for rendering and should be available/installed on the system where you are processing the code, see the document on configuring fonts for your reference.

Let us know if you still find the issue after installing the fonts on the system and making the fonts folder accessible to your application (APIs).