Hello,
Thank you for your inquiry.
Regarding your question about achieving consistent results between PDFs generated by Spire.Xls and Microsoft Excel, if you want the output PDFs to have the same effect, please remove the line of code "workbook.getConverterSetting().setSheetFitToPage(true);" from your code. This line of code is responsible for fitting a sheet into one page when converting it to PDF.
- Code: Select all
Workbook workbook = new Workbook();
workbook.loadFromFile("input/PR_ex3.xlsx");
workbook.saveToFile("output/ExcelToPdf4.pdf", FileFormat.PDF);
By removing this line, the conversion process will retain the original layout of the sheet, which may result in multiple pages in the PDF if the content exceeds one page.
If you have any further questions or need assistance with anything else, please feel free to ask.
Sincerely,
Annika
E-iceblue support team