I am trying to take a list of .png files in a directory and print them all in the same print job. I am able to do this correctly for jobs that have around 80 pages in them by loading each image into a BufferedImage and placing them into an ArrayList, and then sending the ArrayList to the print method I will paste below. The problem is when there are more then 80 pages, when trying to load all of the images into this ArrayList, we start to receive Out Of Memory errors due to the amount of memory the images take up when loading them. Does anyone have any suggestions on a better way to do this? Thanks in advance!!
Here is the code that loads the images into an ArrayList and provides out of memory error messages once we load too many .png files in to the images ArrayList
Here is the print method: