Learn to integrate Paperless-ngx with Nextcloud for seamless document management and additional automation of workflows in your business.
Last updated: Nov 7, 2024
It is a challenge for companies today to manage both physical and digital documents efficiently. Paper-based workflows can be time-consuming. On the other hand, unorganized digital files lead to frustration and wasted time.
With the integration of Paperless-ngx into Nextcloud, you can streamline the document management process. Scanning, storing, and collaborating are simplified.
Paperless-ngx is an open-source document management system (DMS) that allows easy importing, storing, and retrieving of documents.
Some key features are:
OCR (Optical Character Recognition) and search: The contents of your documents are indexed, allowing you to find your documents in seconds.
Metadata and tagging: You can add additional information to your documents. Instead of using a traditional folder structure, Paperless-ngx uses a tag-based system. This enables the flexible organization of your documents.
Document automation: With Paperless-ngx you can automate various workflows through the user interface. Besides that, a REST API is available, allowing the software to be integrated into your existing infrastructure.
Nextcloud is a leading open-source cloud storage and collaboration solution.
Key features:
File storage and sharing: Nextcloud offers similar functions to cloud storage providers like OneDrive, Google Drive, Dropbox, etc.
Secure file access (GDPR-compliant): Since Nextcloud is self-hosted, you retain full control over your data.
Collaboration tools (document editing, file versioning): In Nextcloud, you can work on documents simultaneously with other users, share, comment, tag, and more. You can also easily revert files to previous versions.
Expandable through apps: Nextcloud includes its own app store where you can extend the functionality of the application.
You can manage both your scanned, archived files, and your digital documents on a single platform. This can increase productivity.
Through the integration, you can apply Nextcloud’s collaboration solution to archived documents as well.
Data security remains preserved as both applications ideally run on the same server.
Combining the applications opens up further possibilities for automation, such as sharing approvals.
You have a server where both Paperless and Nextcloud are already installed as Docker containers. This tutorial assumes that both tools are running on the same server and in the same Docker network.
For the Nextcloud instance to access the relevant directories from Paperless, 2 volumes need to be added to the Nextcloud container. If you have installed Nextcloud via Docker-Compose, open the Docker-Compose script and add the following lines to the volumes:
- ~/paperless-ngx/consume:/opt/paperless-ngx/consume
- ~/paperless-ngx/media/documents/archive:/opt/paperless-ngx/media/documents/archive
To explain: ~/paperless-ngx/consume
defines the storage path of the import folder for my Paperless instance. This folder should be mapped to /opt/paperless-ngx/consume
on my Nextcloud instance. I follow the same procedure for the folder where Paperless archives my documents, ~/paperless-ngx/media/documents/archive
.
Depending on where Paperless is installed for you, you may need to adjust the paths before the colon. In my case, I have installed Paperless in the root directory of my user in the folder paperless-ngx. Inside that, there is the folder consume and media/documents/archive.
To display the absolute path, navigate to the folder and enter the command pwd
. It will show you the absolute path that you can copy as is (e.g., /home/demo/paperless-ngx/consume).
It is important that the consume folder gets the correct permissions for the integration to work. The folder must be owned by the Docker user (usually referred to as www-data or 33). The Docker user needs read, write, and execute permissions within the folder. Other users only need read and execute permissions.
To do this, run the following 2 lines (with your consume folder path):
sudo chown -R www-data:www-data ~/paperless-ngx/consume
sudo chmod -R 755 ~/paperless-ngx/consume
Ideally, you have created the same users in both Paperless and Nextcloud. Each user should have the corresponding permissions in the respective application.
To ensure that each user only sees their documents in Nextcloud, some preparations are necessary.
{owner_username}
is prefixed. This will later make it easy to share the correct folder in Nextcloud. The owner is the admin, and the other users are granted view rights.
Log in to your Nextcloud admin account and install the Nextcloud External Storage app from the app store.
Next, go to the administration settings and add the storage paths for the respective users under External Storage.
If your admin user is named admin, then the path to the consume folder would be /opt/paperless-ngx/consume/admin
and the path to the archive would be /opt/paperless-ngx/media/documents/archive/admin
.
Only the respective user receives permission, and the archive is given read-only access.
Follow the same principle for the other users.
Create a workflow for each user in Paperless so that the correct permissions are set during upload. Choose Consumption Started as the trigger. Then select the consume folder and enter the absolute path (e.g., /home/demo/paperless-ngx/consume/demo/*).
As the action, select Assignment. The owner is the respective user. The user should also receive viewing and editing permissions.
After successful setup, each user will have two folders in their Nextcloud environment: the Paperless consume folder, where documents can be uploaded to Paperless via drag-and-drop, and a Paperless documents folder, where the documents available to the user are stored in the folder structure created by Paperless.
Test the setup. You should be able to access your archive and find files using the Nextcloud search. By default, Nextcloud does not create an OCR layer, which is why searching through document content does not work as it does in Paperless.
Drag a document into the consume folder in Nextcloud and observe how Paperless processes it. It should then move from your consume folder to your archive. From there, you can utilize the familiar Nextcloud functions.
Keep reading
Discover the latest trends in the automation industry and how they can impact your business.
View moreYour email address won't be published.