cyanfish / naps2

Scan documents to PDF and more, as simply as possible.
https://www.naps2.com
Other
2.71k stars 320 forks source link

Execute Script after PDF saving #106

Open torwag opened 1 year ago

torwag commented 1 year ago

Is your feature request related to a problem? Please describe. I would like to send the generated PDFs directly to certain services like paperless-ngx (API call), SFTP servers, or nextcloud (webdav).

Describe the solution you'd like Similar to #70 but simpler, I would like to propose that a script gets executed (configurable in the GUI) whenever a PDF was generated. That could be used to create all kind of "send to..." solutions and more. The script can be selected in the UI, together with a set of placeholders for certain parameters of naps2, foremost the filename of the PDF. It would be the task of the script maintainer to make use of those parameters. Others could be PDF author, scanner, scan settings, etc. The proposed solution is pretty straight forward and yet it could be used for many different situations (send email, send to services, trigger notification, further processing the PDF, send to other devices, print, encrypt, etc.), enabling NAPS2 to remain slim and not over-featured.

Describe alternatives you've considered This could be done in an overall script calling naps2 within that script, however it would not work with the batch mode of naps2. A watchdog could observe a certain folder for incoming PDFs and e.g. send them to a certain API, but that is usually quite fragile and not compatible with all OSes.

LewisSpring commented 1 year ago

+1 on this.

My HP Scanner is an absolute ... piece of work. TWAIN doesn't work for DPIs over 600 and WIA via NAPS2 is just about adequate.

I need a way of automatically cropping the images - HP TWAIN driver had this, but NAPS2/WIA does not. To fill this gap, I will need to make a script to do this instead using ImageMagik or similar. (Currently, my best solution is to use batch script to find the newest file and blindly edit the file which could cause issues.)

Thanks!

SanaRinomi commented 9 months ago

+1 on this, mainly for the use case of sending to paperless!

gouthamravee commented 7 months ago

+1 for this, I recently setup paperless ngx and would love to be able to send scans from NAPS2 directly to paperless.

Their API is described here

https://docs.paperless-ngx.com/api/#file-uploads https://docs.paperless-ngx.com/api/#authorization