Get exclusive business insights on tech and automation delivered weekly — Join our free newsletter!

Paperless-ngx integration with Nextcloud for smart workflow

Learn to integrate Paperless-ngx with Nextcloud for seamless document management and additional automation of workflows in your business.

Last updated: Oct 17, 2024

5 mins read
Portrait von Tobias Wupperfeld

Author

Tobias Wupperfeld

Tobias is a seasoned software engineer and the founder of PaperlessZone. His mission is to help SMBs digitize and automate processes.

Topics

Thumbnail: Paperless-ngx integration with Nextcloud

Overview

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.

What are the strengths of Paperless-ngx?

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.

What are the strengths of Nextcloud?

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.

Why integrate Paperless-ngx into Nextcloud?

Benefit 1: Centralized file management

You can manage both your scanned, archived files, and your digital documents on a single platform. This can increase productivity.

Benefit 2: Improved collaboration and accessibility

Through the integration, you can apply Nextcloud's collaboration solution to archived documents as well.

Benefit 3: Security and compliance

Data security remains preserved as both applications ideally run on the same server.

Benefit 4: Workflow automation

Combining the applications opens up further possibilities for automation, such as sharing approvals.

Integrating Paperless-ngx into Nextcloud

Step 1: Prerequisites

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.

Step 2: Mount the Paperless directory in Nextcloud

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).

Set correct permissions on the import folder

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

Step 3: Check Paperless configuration for teams

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.

Create a storage path for each user

{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.

Add a storage path in Paperless-ngx

Add a storage path in Paperless

Step 4: Add local external storage

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.

Configure screen of the local external storage in Nextcloud

Configure the local external storage in Nextcloud

Step 5: Create workflows

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.

Configure the trigger in Paperless-ngx

Add a trigger for the workflow in Paperless

Configure an action in Paperless-ngx

Add an action for the workflow in Paperless

Done!

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.

The 2 Paperless folders are created in Nextcloud

View of the 2 Paperless folders in Nextcloud

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.

🛟 Need Expert Assistance?

We’re here to help you seamlessly integrate and set up Paperless-ngx, Nextcloud, and more. We specialize in tailored solutions to optimize your business processes and automate workflows.

Get in touch with us today for a consultation or to discuss your specific requirements!

Contact us

Leave a Comment

Your email address won't be published.