An application that reads Excel data, populates Word templates with dynamic content, generates personalized PDF documents, encrypts them with passwords, and optionally sends them via email. All document processing is automated and can be run through WSL using LibreOffice and QPDF.
cd server
npm install
To run the program, use one of the following commands:
npm start
wsl --install
- After the restart: The Ubuntu terminal will launch automatically.
- Set your Linux username and password when prompted.
Follow these steps to install and use LibreOffice on WSL:
sudo apt update
sudo apt install libreoffice
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
Restart Your Computer Again
nvm install v22
Follow these steps to install and use qpdf
on WSL:
sudo apt update
sudo apt install qpdf -y
npm install knex sqlite3
const path = require("path");
module.exports = {
development: {
client: "sqlite3",
connection: {
filename: path.join(__dirname, "database.sqlite"),
},
useNullAsDefault: true,
migrations: {
directory: path.join(__dirname, "migrations"),
},
},
};
npx knex migrate:make create_templates_table
Example :
exports.up = function (knex) {
return knex.schema.createTable("templates", (table) => {
table.increments("id").primary();
table.string("title").notNullable();
table.text("description").notNullable();
table.string("word_file_path").notNullable();
table.string("email_template_path").notNullable();
table.string("uploaded_by").notNullable();
table.timestamp("uploaded_at").defaultTo(knex.fn.now());
table.timestamp("updated_at").defaultTo(knex.fn.now());
table.timestamp("deleted_at").nullable();
});
};
exports.down = function (knex) {
return knex.schema.dropTable("templates");
};
npx knex migrate:latest
Create a new file db.js:
const knex = require("knex");
const config = require("./knexfile");
const db = knex(config.development);
module.exports = db;
-
Open DBeaver.
-
Create a new connection:
- Click the "New Database Connection" button (plug icon on the top left), or go to Database > New Connection.
- Choose SQLite:
- In the database list, type "SQLite" in the search bar and select SQLite.
- Click Next.
- Specify SQLite database file:
- Click the "Browse..." button next to the Database file field.
- Select your .sqlite or .db file (or type a new name to create a new one).
- Driver Configuration (if prompted):
- If DBeaver asks to download the SQLite driver, click Download.
- Let it finish the download and setup.
- Test Connection:
- Click Test Connection to make sure everything is working.
- Finish:
- Click Finish to connect and open the database.