I want to be able to take continuous scans from my samsung scx-4300 while simultaneously printing each scan out. I'm using xsane to control the device, but it allows me to only either save the scanned file as a digital image in my computer or print a hardcopy. I am wondering if there is a way to make it first scan the image, then print the copy and to loop this process?

Alternatively, how can I control the print and scan functions of my printer through command line, so that I can write a script to automate this process?