// Load the workbook Workbook workbook = new Workbook("input.xlsx"); // Access the desired worksheet Worksheet worksheet = workbook.getWorksheets().get(0); // Set the print area - specify the range you want to print worksheet.getPageSetup().setPrintArea(""); // Save the workbook workbook.save("clear_print_area.pdf");