This page provides documentation for anyone working with the NAPS2 source code.
You can open the NAPS2 solution with Visual Studio 2017 Community.
NAPS2 build scripts are located in
Update-Resources.ps1: Update localized
.resxfiles from translations in
Publish-NAPS2.ps1: Make a production build, stored in
This is where the vast majority of NAPS2 functionality lives.
Automation: Code specific to NAPS2.Console
Config: Classes to manage user and application configuration
Dependencies: Management of optional external dependencies (Tesseract OCR, Ghostscript PDF rendering)
Icons: Image files
ImportExport: Code for saving and importing data (PDFs, Images, Emails, etc.)
Lang: Localization files
Logging: Classes to manage logging
Ocr: Implementation of OCR (using Tesseract)
Operation: Generic interface for different kinds of operations (saving pdfs, etc.) used to display standardized progress information, as well as uniformly handle cancellation and errors
Platform: Cross-platform compatibility helpers
Recovery: Code to manage the on-disk representation of scanned images and recover that data in case of a crash
Scan: Code related to scanning and images
Util: General utility classes and extensions that don't fit anywhere else
WinForms: Forms, controls, and other WinForms-specific code
Worker: Code specific to NAPS2.Worker and inter-process communication
This is the composition root for dependency injection (DI). It includes dependencies on Ninject (the DI container) and NLog (the logging framework).
EntryPoints: Entry points for NAPS2.exe, NAPS2.Console.exe, and NAPS2.Worker.exe.
Modules: Ninject configuration
This is the C++ backend for the NAPS2.Scan.Wia.Native namespace, and acts as a replacement for the Microsoft-provided wiaaut.dll.
It is not included in the normal build process; instead, the compiled 32-bit and 64-bit dlls are stored in the
This builds NAPS2.exe and passes control to NAPS2.DI.EntryPoints.WinFormsEntryPoint. The Setup subfolder also contains configuration for the EXE installer and other installation dependencies.
This builds NAPS2.Console.exe and passes control to NAPS2.DI.EntryPoints.ConsoleEntryPoint.
This builds NAPS2.Worker.exe and passes control to NAPS2.DI.EntryPoints.WorkerEntryPoint. The worker is used to interact with 32-bit drivers (on 64-bit systems) and to render thumbnails (to avoid process-wide GDI+ locks).
This builds the NAPS2.Portable.exe launcher which is used in the portable builds of NAPS2. It launches NAPS2.exe in the App subfolder.
This WIX (Windows Installer XML Toolset) project contains configuration for the MSI installer. Note that EXE configuration and other installation dependencies are stored in the NAPS2 project under Setup (so they are accessible even without WIX installed).
Development-time tools for localization. Used by the Update-Templates.ps1 and Update-Resources.ps1 scripts.
This contains a small number of functional unit tests.
Gmail and Outlook Web Access integration (for the "Email PDF" button) require client credentials to be set up for each service. If you want to include support in a custom build you will need to get your own set of credentials.
Building NAPS2.Core generates a placeholder file
NAPS2.Core\microsoft.credentials.json. Edit it and set the values from the
Microsoft Application Portal (generate a password for
You will also need to set up web redirect URIs to
http://127.0.0.1:50320/ as well as for ports