i have already used lastest version: 8.8.0
i have tried your code. It is ok. But my bug still exist, because i don’t use the function: "src.save(“out1a1.pdf”);"
In my application, i use this function: “sr.toPrinter(printerName);” with printerName is a pdf printer or xps printer, and the output is wrong (the orientation of the paper is portrait while the orientation of the data is landscape). But when i use excel with same printer and landscape mode, the output file is correct.
Please test it again:
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
//Get the first worksheet
Worksheet sheet = wb.getWorksheets().get(0);
//Create a SheetRender object with respect to your desired sheet
PageSetup pageSetup = sheet.getPageSetup();
// Page orientation
pageSetup.setOrientation(PageOrientationType.LANDSCAPE);
SheetRender sr = new SheetRender(sheet, imgOptions);
//Print the worksheet
wb.save(“out1a1.pdf”);
sr.toPrinter(printerName);
with printerName is “Foxit reader PDF Printer” or “Microsoft XPS Document writer”