// Create a pdf file stream FileOutputStream outputStream = null; try { outputStream = new FileOutputStream("RenderExcelRangesInsideAPDF.pdf"); } catch (FileNotFoundException e) { e.printStackTrace(); } // Create a new workbook Workbook workbook = new Workbook(); workbook.open(this.getResourceStream("xlsx/FinancialReport.xlsx")); IWorksheet worksheet = workbook.getWorksheets().get(0); //Create a pdf document. PDDocument doc = null; try { doc = PDDocument.load(this.getResourceStream("Acme-Financial Report 2018.pdf")); } catch (IOException e1) { // Log ignored error of your code // log.debug(e1.getMessage()); } //Create a PrintManager. PrintManager printManager = new PrintManager(); //Draw the contents of the sheet3 to the fourth page. IRange printArea1 = workbook.getWorksheets().get(2).getRange("A3:C24"); Size size1 = printManager.getSize(printArea1); printManager.draw(doc, doc.getPage(3), new Rectangle(306, 215, size1.getWidth(), size1.getHeight()), printArea1); //Draw the contents of the sheet1 to the fifth page. IRange printArea2 = workbook.getWorksheets().get(0).getRange("A4:E29"); Size size2 = printManager.getSize(printArea2); printManager.draw(doc, doc.getPage(4), new Rectangle(71, 250, size2.getWidth(), size2.getHeight()), printArea2); //Draw the contents of the sheet2 to the sixth page. IRange printArea3 = workbook.getWorksheets().get(1).getRange("A2:E28"); Size size3 = printManager.getSize(printArea3); printManager.draw(doc, doc.getPage(5), new Rectangle(71, 230, 783, size3.getHeight()), printArea3); //Save the modified pages into pdf file. try { doc.save(outputStream); doc.close(); } catch (IOException e) { // Log ignored error of your code // log.debug(e.getMessage()); } // Close the file stream try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); }