Watermarked share folder download – system description
The download request, the preparing background job, the issue log and how watermarking at download time, in memory, works, with its limits.
The watermarked download has three steps: request, preparation (background job or the status poll), then watermarking in memory at the moment of download. Bytes move only at download time.
Data model
Table names carry the installation's own prefix in the database.
| Table | Role |
|---|---|
doc_download | download request: token, user, state, expiry |
doc_download_item | issue log: document, classification (pdf / image / skip), unique code |
doc_share_item, doc | the folder's documents |
Process
dlrequest: the download library'srequest()creates a download row and adoc_downloadjob.- Preparation (the job, or the status poll after 20 s): per document a
pdf/image/skipclassification and a unique code in the issue log; with no watermarkable file the state isfailed; the ready state is valid for 24 hours. dlstatus: polled by the client every 2 s;dlfile: watermarks in memory at download time – on every PDF page a bottom stamp and a faint diagonal repetition (FPDI), images with GD; stamp: "name (#id) | date | Confidential | CODE". One file is delivered as such, several as a streamed ZIP; non-watermarkable files are skipped and listed.doc_downloadbackground job (one-off, queued by the request):prepareQueued(50)– prepares waiting requests and closes expired ones; no bytes move here.
Permissions
foldersdownload(SYSTEM) and the download library present; status and file only for one's own token (getDownloadByToken(token, user_id)).- Prerequisites: FPDI (PDF), GD (image).
Known limitations
On the admin side the share folder's scope (company, assigned user) is not checked, only its existence.