It so happened that we have an HP LaserJet MFP connected to the server in our local network office. Its print part was shared by the entire network by standard means, but there were problems with scanning. Actually, they were solved by writing two scripts (PHP + bash) for the server, which allow:
select scan source (top tray with auto-draw for A4 sheets or flatbed scanner)
set the number of pages (it makes sense only for a flatbed scanner - it cannot determine when the sheets have run out)
if you wish - immediately overtake a multi-page document in PDF
upd. Habrayuzer otaqsun also suggested the project phpSANE - good for scanning images one by one, but does not understand the automatic document feeder and does not know how to overtake the results of scanning into PDF (but knows how to JPEG and PNM).