Batch Printing for Salary Slip

is this possible to print all salary slip from Payroll Entry?
for Salary Slip we want to use A5/A6 paper size

yes, you can using custom script in payroll entry

do you have sample code?