### Build BentoPDF from Source Source: https://github.com/alam00000/bentopdf/blob/main/docs/getting-started.md Clone the repository, install dependencies, and start the development server. ```bash # Clone the repository git clone https://github.com/alam00000/bentopdf.git cd bentopdf # Install dependencies npm install # Start development server npm run dev ``` -------------------------------- ### Setup Commands for BentoPDF Development Source: https://github.com/alam00000/bentopdf/blob/main/docs/contributing.md Clone the repository, install dependencies, and start the development server. Requires Node.js 18+, npm 9+, and Git. ```bash # Fork and clone the repository git clone https://github.com/YOUR_USERNAME/bentopdf.git cd bentopdf # Install dependencies npm install # Start development server npm run dev ``` -------------------------------- ### Run setup.sh on air-gapped side Source: https://github.com/alam00000/bentopdf/blob/main/README.md After transferring the bundle to the air-gapped network, run the included setup script to load the Docker image, extract WASM files, and optionally start the container. ```bash cd bentopdf-airgap-bundle bash setup.sh ``` -------------------------------- ### Build BentoPDF from source Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Clones the repository, installs dependencies, and builds the project. The built files are placed in the `dist` folder. ```bash # Clone and build git clone https://github.com/alam00000/bentopdf.git cd bentopdf npm install npm run build # The built files are in the `dist` folder ``` -------------------------------- ### Install Dependencies (npm install) Source: https://github.com/alam00000/bentopdf/blob/main/README.md Install all required npm dependencies for the project. Run this after cloning the repository when using the npm development option. ```bash npm install ``` -------------------------------- ### Start docs dev server Source: https://github.com/alam00000/bentopdf/blob/main/README.md Start the VitePress development server for local documentation preview. ```bash npm run docs:dev ``` -------------------------------- ### Start development server Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Run the development server to manually test translations. ```bash npm run dev ``` -------------------------------- ### Manual per-user configuration in wasm-settings.html Source: https://github.com/alam00000/bentopdf/blob/main/cloudflare/WASM-PROXY.md Table of module URLs to enter in BentoPDF's Advanced Settings. ```markdown | Module | URL | | ----------- | ------------------------------------------------------------------- | | PyMuPDF | `https://bentopdf-wasm-proxy..workers.dev/pymupdf/` | | Ghostscript | `https://bentopdf-wasm-proxy..workers.dev/gs/` | | CoherentPDF | `https://bentopdf-wasm-proxy..workers.dev/cpdf/` | ``` -------------------------------- ### Clone Repository (npm setup) Source: https://github.com/alam00000/bentopdf/blob/main/README.md Clone the BentoPDF repository and navigate into the project directory. This is the first step for both npm and Docker Compose development setups. ```bash git clone https://github.com/alam00000/bentopdf.git cd bentopdf ``` -------------------------------- ### Subdirectory .htaccess Example for /pdf-tools/ Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/hostinger.md Apache configuration for a subdirectory installation at yourdomain.com/pdf-tools/. Update RewriteBase and paths accordingly. Includes language prefix routes, root-level .html extension rewriting, and a custom 404 error document. ```apache RewriteBase /pdf-tools/ # ... (same content as above, but update paths) ... # Language prefix root RewriteCond %{DOCUMENT_ROOT}/pdf-tools/$1/index.html -f RewriteRule ^(de|es|zh|zh-TW|vi|it|id|tr|fr|pt)/?$ /pdf-tools/$1/index.html [L] # Language prefix with path RewriteCond %{DOCUMENT_ROOT}/pdf-tools/$1/$2.html -f RewriteRule ^(de|es|zh|zh-TW|vi|it|id|tr|fr|pt)/([^/]+)/?$ /pdf-tools/$1/$2.html [L] # Root level .html extension RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^([^/]+)$ $1.html [L] ErrorDocument 404 /pdf-tools/404.html ``` -------------------------------- ### Build and Run with Docker Compose (SIMPLE_MODE=true) Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Builds the image locally with Simple Mode enabled and starts the container in detached mode. ```bash docker compose -f docker-compose.dev.yml build --build-arg SIMPLE_MODE=true ``` ```bash docker compose -f docker-compose.dev.yml up -d ``` -------------------------------- ### Enable and start BentoPDF Quadlet service Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Commands to reload the systemd user daemon and enable/start the bentopdf-simple service after creating the Quadlet unit file. ```bash systemctl --user daemon-reload systemctl --user enable --now bentopdf-simple ``` -------------------------------- ### Build BentoPDF from source Source: https://github.com/alam00000/bentopdf/blob/main/README.md Commands to clone, install, build, package, and preview BentoPDF from source. The preview is accessible at http://localhost:4173/. ```bash # Clone the repository git clone https://github.com/alam00000/bentopdf.git cd bentopdf # Install dependencies npm install # Build the project npm run build # Package the distribution for hosting (optional) npm run package # Preview the build locally npm run preview # The website will be accessible at: http://localhost:4173/ ``` -------------------------------- ### Build the project with git clone, npm install, and npm run build Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/apache.md Clones the BentoPDF repository, installs dependencies, and builds the project. Run these commands in order before deploying. ```bash git clone https://github.com/alam00000/bentopdf.git cd bentopdf npm install npm run build ``` -------------------------------- ### Run BentoPDF with Podman Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/docker.md Starts the self-hosted BentoPDF container on port 3000 using Podman. Note: Podman does not support the --restart flag in this example. ```bash podman run -d \ --name bentopdf \ -p 3000:8080 \ ghcr.io/alam00000/bentopdf-simple:latest ``` -------------------------------- ### Run with Docker Compose (docker-compose.dev.yml) Source: https://github.com/alam00000/bentopdf/blob/main/README.md Start the application using Docker Compose with the development configuration. The application will be available at http://localhost:3000. ```bash docker-compose -f docker-compose.dev.yml up -d ``` -------------------------------- ### Build and Serve with Environment Variable Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Sets SIMPLE_MODE=true, builds the project, and serves the dist folder on port 3000. ```bash export SIMPLE_MODE=true ``` ```bash npm run build ``` ```bash npx serve dist -p 3000 ``` -------------------------------- ### Install from local chart with Helm Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/kubernetes.md Creates the bentopdf namespace and installs or upgrades the BentoPDF chart from a local path, setting the image repository and tag. ```bash kubectl create namespace bentopdf helm upgrade --install bentopdf /path/to/bentopdf/chart \ --namespace bentopdf \ --set image.repository=ghcr.io/alam00000/bentopdf \ --set image.tag=latest ``` -------------------------------- ### Run BentoPDF with Docker or Podman Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Starts the self-hosted BentoPDF container, mapping host port 3000 to container port 8080. Use the self-hosted image `ghcr.io/alam00000/bentopdf-simple:latest` for internal deployments. Note: Office conversion requires HTTPS or localhost due to SharedArrayBuffer restrictions. ```bash # Docker docker run -d -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest # Podman podman run -d -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest ``` -------------------------------- ### Configure BentoPDF with Environment Variables Source: https://github.com/alam00000/bentopdf/blob/main/cloudflare/WASM-PROXY.md Set these environment variables in .env.production or as Docker build args to use the proxy URLs. ```bash VITE_WASM_PYMUPDF_URL=https://bentopdf-wasm-proxy..workers.dev/pymupdf/ VITE_WASM_GS_URL=https://bentopdf-wasm-proxy..workers.dev/gs/ VITE_WASM_CPDF_URL=https://bentopdf-wasm-proxy..workers.dev/cpdf/ ``` -------------------------------- ### Compare commercial and Simple Mode builds side-by-side Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Runs both Docker images to compare the commercial build (bentopdf.com look) and the self-hosted Simple Mode build. Podman users replace 'docker' with 'podman'. ```bash # Commercial build (the bentopdf.com look) docker run -p 3000:8080 ghcr.io/alam00000/bentopdf:latest # Self-Hosted build (Simple Mode) docker run -p 3001:8080 ghcr.io/alam00000/bentopdf-simple:latest # Podman users: replace 'docker' with 'podman' ``` -------------------------------- ### Redeploy after custom domain setup Source: https://github.com/alam00000/bentopdf/blob/main/cloudflare/WASM-PROXY.md Command to redeploy the worker after adding the custom domain route. ```bash npx wrangler deploy -c wasm-wrangler.toml ``` -------------------------------- ### Build and serve Simple Mode locally Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Builds with SIMPLE_MODE=true and serves the built files on port 3000. Use for local testing. ```bash # Build with simple mode SIMPLE_MODE=true npm run build # Serve the built files npx serve dist -p 3000 ``` -------------------------------- ### Enable and Start BentoPDF Quadlet Service Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/docker.md Commands to reload systemd, start, enable, check status, and view logs for the BentoPDF Quadlet service. For system-wide deployment, omit the --user flag and place the unit file in /etc/containers/systemd/. ```bash # Reload systemd to detect new unit systemctl --user daemon-reload # Start the service systemctl --user start bentopdf # Enable on boot systemctl --user enable bentopdf # Check status systemctl --user status bentopdf # View logs journalctl --user -u bentopdf -f ``` -------------------------------- ### Override WASM URLs via .env.production Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Alternative build-time override by setting environment variables in `.env.production` before building from source. Example shows setting `VITE_WASM_PYMUPDF_URL`. ```bash VITE_WASM_PYMUPDF_URL=https://your-server.com/pymupdf/ npm run build ``` -------------------------------- ### Build and Run with Docker (SIMPLE_MODE=true) Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Builds the image with the SIMPLE_MODE build argument and runs it, mapping port 3000 to 8080. ```bash docker build --build-arg SIMPLE_MODE=true -t bentopdf-simple . ``` ```bash docker run -p 3000:8080 bentopdf-simple ``` -------------------------------- ### Build Commercial build with custom branding Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Builds the commercial image with custom brand name, logo, and footer text, then runs it. The build arguments are passed via --build-arg. ```bash docker build \ --build-arg VITE_BRAND_NAME="AcmePDF" \ --build-arg VITE_BRAND_LOGO="images/acme-logo.svg" \ --build-arg VITE_FOOTER_TEXT="© 2026 Acme Corp. All rights reserved." \ -t acmepdf . docker run -p 3000:8080 acmepdf ``` -------------------------------- ### Nested object example for nav.home Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Illustrates the nested object convention for keys like 'nav.home'. ```json { "nav": { "home": "Home" } } ``` -------------------------------- ### Deploy the Worker Source: https://github.com/alam00000/bentopdf/blob/main/cloudflare/WASM-PROXY.md Commands to log in and deploy the Cloudflare Worker using the wasm-wrangler.toml configuration. ```bash cd cloudflare npx wrangler login npx wrangler deploy -c wasm-wrangler.toml ``` -------------------------------- ### Start BentoPDF with Docker Compose or Podman Compose Source: https://github.com/alam00000/bentopdf/blob/main/README.md Starts the BentoPDF container in detached mode. Use docker-compose for Docker or podman-compose for Podman. The app becomes available at http://localhost:3000. ```bash # Docker Compose docker-compose up -d # Podman Compose podman-compose up -d ``` -------------------------------- ### Run Simple Mode with npm Script Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Uses the built-in npm script that sets SIMPLE_MODE=true, builds the project, and serves it on http://localhost:3000. ```bash npm run serve:simple ``` -------------------------------- ### Create Spanish translation directory and copy English template Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Creates the `public/locales/es` directory and copies the English `common.json` as a starting template for the Spanish translation. ```bash # Create the directory mkdir -p public/locales/es # Copy the English template cp public/locales/en/common.json public/locales/es/common.json ``` -------------------------------- ### Run Self-Hosted build with Docker or build with SIMPLE_MODE Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Two ways to use the self-hosted build: pull the pre-built image and run it, or build it yourself with SIMPLE_MODE=true. The self-hosted build hides marketing chrome but keeps all PDF tools. ```bash # Use the pre-built image (recommended) docker run -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest # Or build it yourself SIMPLE_MODE=true npm run build ``` -------------------------------- ### Enable and start BentoPDF systemd service Source: https://github.com/alam00000/bentopdf/blob/main/README.md Reloads systemd user daemon and enables/starts the bentopdf service. Run after creating the Quadlet unit file. ```bash systemctl --user daemon-reload systemctl --user enable --now bentopdf ``` -------------------------------- ### Install Wrangler CLI Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/cors-proxy.md Install the Wrangler CLI globally to deploy the Cloudflare Worker. ```bash npm install -g wrangler ``` -------------------------------- ### Run BentoPDF with Docker or Docker Compose Source: https://github.com/alam00000/bentopdf/blob/main/docs/getting-started.md Self-host BentoPDF using the Docker image or Docker Compose. Requires SharedArrayBuffer for Office file conversion, which needs specific COOP/COEP headers and a secure context; localhost works for testing, but LAN IPs require HTTPS. ```bash # Pull and run the Docker image (self-hosted build) docker run -d -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest # Or use Docker Compose curl -O https://raw.githubusercontent.com/alam00000/bentopdf/main/docker-compose.yml docker compose up -d ``` -------------------------------- ### Install and port-forward BentoPDF Source: https://github.com/alam00000/bentopdf/blob/main/chart/README.md Installs the chart and forwards port 8080 to access the service locally. ```bash helm install bentopdf ./chart kubectl port-forward deploy/bentopdf 8080:8080 # open http://127.0.0.1:8080 ``` -------------------------------- ### Correct translation key-value example Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Illustrates the correct way to translate a value while keeping the key unchanged. ```json "home": "Inicio" ``` -------------------------------- ### Input placeholder with data-i18n-placeholder Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md HTML example for translating input placeholders. ```html ``` -------------------------------- ### Set up inside air-gapped network Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Loads the Docker image, extracts the WASM packages and OCR data into the expected directory structure, and runs BentoPDF on port 3000. Ensure the files are accessible at the URLs configured in Step 2. ```bash # Load the Docker image docker load -i bentopdf.tar # Extract WASM packages mkdir -p ./wasm/pymupdf ./wasm/gs ./wasm/cpdf ./wasm/ocr/core ./wasm/ocr/lang-data ./wasm/ocr/fonts tar xzf bentopdf-pymupdf-wasm-0.11.14.tgz -C ./wasm/pymupdf --strip-components=1 tar xzf bentopdf-gs-wasm-*.tgz -C ./wasm/gs --strip-components=1 tar xzf coherentpdf-*.tgz -C ./wasm/cpdf --strip-components=1 TEMP_TESS=$(mktemp -d) tar xzf tesseract.js-7.0.0.tgz -C "$TEMP_TESS" cp "$TEMP_TESS/package/dist/worker.min.js" ./wasm/ocr/worker.min.js rm -rf "$TEMP_TESS" tar xzf tesseract.js-core-7.0.0.tgz -C ./wasm/ocr/core --strip-components=1 cp ./tesseract-langdata/*.traineddata.gz ./wasm/ocr/lang-data/ cp ./ocr-fonts/* ./wasm/ocr/fonts/ # Run BentoPDF docker run -d -p 3000:8080 --restart unless-stopped bentopdf ``` -------------------------------- ### Run Simple Mode with Docker or Podman Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Pulls and runs the pre-built Simple Mode image. Use for production. Maps port 3000 to 8080. ```bash # Docker - Pull and run the Simple Mode image docker pull ghcr.io/alam00000/bentopdf-simple:latest docker run -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest # Podman podman pull ghcr.io/alam00000/bentopdf-simple:latest podman run -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest ``` -------------------------------- ### Install from GHCR OCI chart with Helm Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/kubernetes.md Installs or upgrades the BentoPDF chart from GHCR as an OCI artifact, using the GHCR_USERNAME environment variable and specifying version 0.1.0. ```bash export GHCR_USERNAME="" helm upgrade --install bentopdf oci://ghcr.io/$GHCR_USERNAME/charts/bentopdf \ --namespace bentopdf \ --create-namespace \ --version 0.1.0 \ --set image.repository=ghcr.io/alam00000/bentopdf \ --set image.tag=latest ``` -------------------------------- ### Pluralization example Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Example of handling plurals in translations using i18next pluralization. ```json { "pages": "page", "pages_plural": "pages" } ``` -------------------------------- ### SSL with Let's Encrypt Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/nginx.md Install certbot and its nginx plugin, then obtain and configure an SSL certificate for your domain. ```bash sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d your-domain.com ``` -------------------------------- ### Build with custom BASE_URL Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Builds the project with a base URL for deploying to a subdirectory. The BASE_URL environment variable is set before the build command. ```bash BASE_URL=/pdf-tools/ npm run build ``` -------------------------------- ### Run bentopdf with Docker Compose or Podman Compose Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/docker.md Starts the bentopdf service defined in docker-compose.yml. Use 'docker compose up -d' for Docker Compose or 'podman-compose up -d' for Podman Compose. ```bash # Docker Compose docker compose up -d # Podman Compose podman-compose up -d ``` -------------------------------- ### Tool definition in tools.ts Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Example of tool name and subtitle in TypeScript configuration. ```typescript { name: 'Merge PDF', // Used for shortcuts only subtitle: 'Combine multiple PDFs into one file.', } ``` -------------------------------- ### Download WASM and OCR packages Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Run these commands on a machine with internet access to download the required npm packages and OCR data files for air-gapped deployment. Creates tesseract-langdata and ocr-fonts directories. ```bash npm pack @bentopdf/pymupdf-wasm@0.11.14 npm pack @bentopdf/gs-wasm npm pack coherentpdf npm pack tesseract.js@7.0.0 npm pack tesseract.js-core@7.0.0 mkdir -p tesseract-langdata curl -fsSL https://cdn.jsdelivr.net/npm/@tesseract.js-data/eng/4.0.0_best_int/eng.traineddata.gz -o tesseract-langdata/eng.traineddata.gz mkdir -p ocr-fonts curl -fsSL https://raw.githack.com/googlefonts/noto-fonts/main/hinted/ttf/NotoSans/NotoSans-Regular.ttf -o ocr-fonts/NotoSans-Regular.ttf ``` -------------------------------- ### Enable Netlify Large Media Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/netlify.md Commands to set up Netlify Large Media for large WASM files. Run `netlify lm:setup` and track `*.wasm` files with Git LFS. ```bash netlify lm:setup git lfs track "*.wasm" ``` -------------------------------- ### Run Simple Mode with Docker (Docker Hub) Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Runs the pre-built Simple Mode image from Docker Hub. Maps host port 3000 to container port 8080. ```bash docker run -p 3000:8080 bentopdfteam/bentopdf-simple:latest ``` ```bash podman run -p 3000:8080 docker.io/bentopdfteam/bentopdf-simple:latest ``` -------------------------------- ### Run BentoPDF with Docker Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/docker.md Starts the self-hosted BentoPDF container on port 3000 with automatic restart. Use the self-hosted build for internal deployments. ```bash docker run -d \ --name bentopdf \ -p 3000:8080 \ --restart unless-stopped \ ghcr.io/alam00000/bentopdf-simple:latest ``` -------------------------------- ### Run Simple Mode with Docker (GHCR) Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Runs the pre-built Simple Mode image from GitHub Container Registry. Maps host port 3000 to container port 8080. ```bash docker run -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest ``` ```bash podman run -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest ``` -------------------------------- ### Clone and build Docker image with WASM URLs Source: https://github.com/alam00000/bentopdf/blob/main/README.md Clones the repository and builds the Docker image, passing build arguments for WASM and OCR asset URLs. Replace the example URLs with your internal server addresses. ```bash git clone https://github.com/alam00000/bentopdf.git cd bentopdf docker build \ --build-arg VITE_WASM_PYMUPDF_URL=https://internal-server.example.com/wasm/pymupdf/ \ --build-arg VITE_WASM_GS_URL=https://internal-server.example.com/wasm/gs/ \ --build-arg VITE_WASM_CPDF_URL=https://internal-server.example.com/wasm/cpdf/ \ --build-arg VITE_TESSERACT_WORKER_URL=https://internal-server.example.com/wasm/ocr/worker.min.js \ --build-arg VITE_TESSERACT_CORE_URL=https://internal-server.example.com/wasm/ocr/core \ --build-arg VITE_TESSERACT_LANG_URL=https://internal-server.example.com/wasm/ocr/lang-data \ --build-arg VITE_OCR_FONT_BASE_URL=https://internal-server.example.com/wasm/ocr/fonts \ -t bentopdf . ``` -------------------------------- ### Fork and clone the repository Source: https://github.com/alam00000/bentopdf/blob/main/CONTRIBUTING.md Clone the BentoPDF repository and install dependencies with npm. ```bash git clone https://github.com/alam00000/bentopdf.git cd bentopdf npm install ``` -------------------------------- ### Spanish common.json translation example Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Shows the structure of `public/locales/es/common.json` with translated values for navigation and hero sections. Only values should be translated, not keys. ```json { "nav": { "home": "Inicio", "about": "Acerca de", "contact": "Contacto", "allTools": "Todas las herramientas" }, "hero": { "title": "Tu conjunto de herramientas PDF gratuito y seguro", "subtitle": "Combina, divide, comprime y edita archivos PDF directamente en tu navegador." } // ... continue translating all keys } ``` -------------------------------- ### Preview the built docs Source: https://github.com/alam00000/bentopdf/blob/main/README.md Preview the production build of the documentation site locally. ```bash npm run docs:preview ``` -------------------------------- ### Air-gap bundle directory structure Source: https://github.com/alam00000/bentopdf/blob/main/README.md Shows the layout of the bundle directory produced by the prepare-airgap.sh script, including the Docker image, WASM packages, OCR language data, fonts, and setup script. ```text bentopdf-airgap-bundle/ bentopdf.tar # Docker image *.tgz # WASM packages (PyMuPDF, Ghostscript, CoherentPDF, Tesseract) tesseract-langdata/ # OCR traineddata files ocr-fonts/ # OCR text-layer font files setup.sh # Setup script for the air-gapped side README.md # Instructions ``` -------------------------------- ### Docker Compose for Simple Mode Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Defines a service using the pre-built Simple Mode image. The commented line shows the Docker Hub alternative. ```yaml services: bentopdf: # Using GitHub Container Registry (Recommended) image: ghcr.io/alam00000/bentopdf-simple:latest # Or using Docker Hub # image: bentopdfteam/bentopdf-simple:latest container_name: bentopdf restart: unless-stopped ports: - '3000:8080' ``` -------------------------------- ### Build docs for production Source: https://github.com/alam00000/bentopdf/blob/main/README.md Build the VitePress documentation site for production deployment. ```bash npm run docs:build ``` -------------------------------- ### Add custom domain route in wasm-wrangler.toml Source: https://github.com/alam00000/bentopdf/blob/main/cloudflare/WASM-PROXY.md TOML configuration to add a route for a custom domain like wasm.bentopdf.com. ```toml routes = [ { pattern = "wasm.bentopdf.com/*", zone_name = "bentopdf.com" } ] ``` -------------------------------- ### Build with BASE_URL and SIMPLE_MODE Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds the Docker image with both BASE_URL and SIMPLE_MODE build arguments, then runs the container. The app will be accessible at the specified subdirectory. ```bash # Build with both BASE_URL and SIMPLE_MODE docker build \ --build-arg BASE_URL=/tools/pdf/ \ --build-arg SIMPLE_MODE=true \ -t bentopdf-simple . docker run -p 3000:8080 bentopdf-simple ``` -------------------------------- ### Build and serve from subdirectory Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds the app with a custom BASE_URL (must have trailing and leading slash), copies the dist files into a nested directory, and serves it locally. The site will be accessible at `http://localhost:3000/tools/bentopdf/`. ```bash # Example: # 1. Build the app with the specific BASE_URL. BASE_URL must have a trailing and leading slash. The BASE_URL can be any URL of your choice. Here we are using /tools/bentopdf/ as an example. BASE_URL=/tools/bentopdf/ npm run build # 2. Create the nested directory structure inside serve-test (or any folder of your choice for local testing. In case of production, create the nested directory structure inside the root directory) mkdir -p serve-test/tools/bentopdf # 3. Copy all files from the 'dist' folder into that nested directory cp -r dist/* serve-test/tools/bentopdf/ # 4. Serve the 'serve-test' folder npx serve serve-test ``` -------------------------------- ### Run BentoPDF from GitHub Container Registry Source: https://github.com/alam00000/bentopdf/blob/main/README.md Quick start command to run the Self-Hosted build of BentoPDF from GHCR. Maps host port 3000 to container port 8080. Access the app at http://localhost:3000. ```bash docker run -p 3000:8080 ghcr.io/alam00000/bentopdf-simple:latest ``` -------------------------------- ### Podman Quadlet unit file for BentoPDF Simple Mode Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Systemd unit file for running BentoPDF Simple Mode with Podman Quadlet. Place this file at ~/.config/containers/systemd/bentopdf-simple.container. Configures the container image, port publishing, and auto-update from the registry. ```ini [Unit] Description=BentoPDF Simple Mode After=network-online.target [Container] Image=ghcr.io/alam00000/bentopdf-simple:latest ContainerName=bentopdf-simple PublishPort=80:8080 AutoUpdate=registry [Service] Restart=always [Install] WantedBy=default.target ``` -------------------------------- ### Build and run nonroot image with PUID/PGID Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/docker.md Builds the Dockerfile.nonroot image and runs it with custom user and group IDs. The container starts as root, creates a user with the specified PUID/PGID, adjusts ownership, then drops privileges using su-exec. PUID/PGID cannot be 0. ```bash # Build the non-root image docker build -f Dockerfile.nonroot -t bentopdf-nonroot . # Run with custom UID/GID docker run -d \ --name bentopdf \ -p 3000:8080 \ -e PUID=1000 \ -e PGID=1000 \ --restart unless-stopped \ bentopdf-nonroot ``` -------------------------------- ### Customize branding with VITE_BRAND_NAME and VITE_BRAND_LOGO environment variables Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/apache.md Sets branding environment variables before building to customize the PDF tool's name and logo. Replace the example values with your own. ```bash VITE_BRAND_NAME="AcmePDF" VITE_BRAND_LOGO="images/acme-logo.svg" npm run build ``` -------------------------------- ### Set Environment Secrets for Source URLs Source: https://github.com/alam00000/bentopdf/blob/main/cloudflare/WASM-PROXY.md Commands to set the PYMUPDF_SOURCE, GS_SOURCE, and CPDF_SOURCE secrets interactively. Option B suggests using the Cloudflare Dashboard instead. ```bash # Option A: Interactive prompts npx wrangler secret put PYMUPDF_SOURCE -c wasm-wrangler.toml npx wrangler secret put GS_SOURCE -c wasm-wrangler.toml npx wrangler secret put CPDF_SOURCE -c wasm-wrangler.toml # Option B: Set via Cloudflare Dashboard # Go to Workers & Pages > bentopdf-wasm-proxy > Settings > Variables ``` -------------------------------- ### Check Git Status Before Release Source: https://github.com/alam00000/bentopdf/blob/main/RELEASE.md Shows the current state of the repository before starting a release. Useful to verify which files are modified or untracked. ```bash $ git status On branch main Your branch is up to date with 'origin/main'. Changes not staged for commit: modified: src/js/new-feature.js modified: src/css/styles.css modified: README.md Untracked files: src/js/feature-helper.js ``` -------------------------------- ### Production build with CDN (VITE_USE_CDN=true) Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds the production bundle using jsDelivr CDN for WASM files. Recommended for improved performance and reduced bandwidth costs. Local files are always included as automatic fallback if CDN fails. ```bash # Production build with CDN (Recommended) VITE_USE_CDN=true npm run build ``` -------------------------------- ### Check Git Status with Uncommitted Changes Source: https://github.com/alam00000/bentopdf/blob/main/RELEASE.md Shows the repository state when there are uncommitted changes. This is the starting point for Scenario 2. ```bash $ git status Changes not staged for commit: modified: package.json modified: src/js/main.js modified: README.md ``` -------------------------------- ### Custom Express.js CORS proxy Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/cors-proxy.md Example Express.js implementation for a custom backend proxy. It accepts GET requests with a 'url' query parameter, fetches the URL server-side, and returns the response with the required CORS headers. ```javascript app.get('/api/cert-proxy', async (req, res) => { const targetUrl = req.query.url; // Validate it's a certificate URL if (!isValidCertUrl(targetUrl)) { return res.status(400).json({ error: 'Invalid URL' }); } try { const response = await fetch(targetUrl); const data = await response.arrayBuffer(); res.set('Access-Control-Allow-Origin', 'https://your-domain.com'); res.set('Content-Type', 'application/octet-stream'); res.set('X-Content-Type-Options', 'nosniff'); res.send(Buffer.from(data)); } catch (error) { res.status(500).json({ error: 'Proxy error' }); } }); ``` -------------------------------- ### Set environment variables in .env.production for source build Source: https://github.com/alam00000/bentopdf/blob/main/README.md When building from source instead of Docker, set these variables in `.env.production` before running `npm run build`. Replace the example URLs with your internal server addresses. ```bash VITE_WASM_PYMUPDF_URL=https://internal-server.example.com/wasm/pymupdf/ VITE_WASM_GS_URL=https://internal-server.example.com/wasm/gs/ VITE_WASM_CPDF_URL=https://internal-server.example.com/wasm/cpdf/ VITE_TESSERACT_WORKER_URL=https://internal-server.example.com/wasm/ocr/worker.min.js VITE_TESSERACT_CORE_URL=https://internal-server.example.com/wasm/ocr/core VITE_TESSERACT_LANG_URL=https://internal-server.example.com/wasm/ocr/lang-data VITE_OCR_FONT_BASE_URL=https://internal-server.example.com/wasm/ocr/fonts ``` -------------------------------- ### Get application URL when HTTPRoute is enabled Source: https://github.com/alam00000/bentopdf/blob/main/chart/templates/NOTES.txt Prints the application hostname or a note if hostnames are not configured. Includes a command to inspect the gateway configuration. ```plaintext {{- if .Values.httpRoute.enabled }} {{- $defaultGatewayName := .Values.gateway.name -}} {{- if not $defaultGatewayName -}} {{- $defaultGatewayName = printf "%s-gateway" (include "bentopdf.name" .) -}} {{- end -}} {{- $defaultGatewayNs := .Release.Namespace -}} {{- if .Values.gateway.enabled -}} {{- $defaultGatewayNs = default .Release.Namespace .Values.gateway.namespace -}} {{- end -}} {{- $gatewayName := $defaultGatewayName -}} {{- $gatewayNs := $defaultGatewayNs -}} {{- if and .Values.httpRoute.parentRefs (first .Values.httpRoute.parentRefs) -}} {{- $firstRef := first .Values.httpRoute.parentRefs -}} {{- $gatewayName = default $defaultGatewayName $firstRef.name -}} {{- $gatewayNs = default $defaultGatewayNs $firstRef.namespace -}} {{- end -}} {{- if .Values.httpRoute.hostnames }} export APP_HOSTNAME={{ .Values.httpRoute.hostnames | first }} echo "Visit http://$APP_HOSTNAME to use your application" {{- else }} echo "HTTPRoute is enabled. Configure httpRoute.hostnames to see your URL here." {{- end }} NOTE: Your HTTPRoute depends on the listener configuration of your gateway and your HTTPRoute rules. The rules can be set for path, method, header and query parameters. You can check the gateway configuration with 'kubectl get --namespace {{ $gatewayNs }} gateway/{{ $gatewayName }} -o yaml' ``` -------------------------------- ### Build-time custom branding with environment variables Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Set VITE_BRAND_NAME, VITE_BRAND_LOGO, and VITE_FOOTER_TEXT before running npm run build to replace the default BentoPDF logo, name, and footer. Place your logo in public/ first. Works in full mode and Simple Mode, and can be combined with other build-time options like BASE_URL, SIMPLE_MODE, and VITE_DEFAULT_LANGUAGE. ```bash # Place your logo in public/, then build VITE_BRAND_NAME="AcmePDF" \ VITE_BRAND_LOGO="images/acme-logo.svg" \ VITE_FOOTER_TEXT="© 2026 Acme Corp. Internal use only." \ npm run build ``` -------------------------------- ### Too formal translation example Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Example of a translation that is too formal and should be avoided. ```json "hero.title": "Ihr gebührenfreies und gesichertes Werkzeug für PDF-Dokumente" ``` -------------------------------- ### Podman Quadlet container definition Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Systemd service definition for running BentoPDF as a user service. Creates a container from the self-hosted image, publishes port 3000 to 8080, and enables automatic updates. Requires Podman with Quadlet support. ```ini [Container] Image=ghcr.io/alam00000/bentopdf-simple:latest ContainerName=bentopdf PublishPort=3000:8080 AutoUpdate=registry [Service] Restart=always [Install] WantedBy=default.target ``` -------------------------------- ### Build from Source with Custom Branding Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds the project from source with custom brand name, logo, and footer text via environment variables. The logo must be placed in the public/ folder first. ```bash VITE_BRAND_NAME="AcmePDF" \ VITE_BRAND_LOGO="images/acme-logo.svg" \ VITE_FOOTER_TEXT="© 2026 Acme Corp. Internal use only." \ npm run build ``` -------------------------------- ### Verify SharedArrayBuffer and crossOriginIsolated in Browser Console Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Run in the browser DevTools Console on any BentoPDF page to verify cross-origin isolation. Both checks should pass when the page is HTTPS or http://localhost and COEP/COOP headers are present on every response. ```javascript console.log(window.crossOriginIsolated); // should be true console.log(typeof SharedArrayBuffer); // should be "function" ``` -------------------------------- ### Enable the Site Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/nginx.md Symlink the site configuration into sites-enabled, test the configuration, and reload nginx. ```bash sudo ln -s /etc/nginx/sites-available/bentopdf /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx ``` -------------------------------- ### Good translation example Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Example of a translation that matches the friendly, clear, and professional tone. ```json "hero.title": "Ihr kostenloses und sicheres PDF-Toolkit" ``` -------------------------------- ### Build-time tool disabling with DISABLE_TOOLS Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/index.md Set DISABLE_TOOLS to a comma-separated list of tool IDs (e.g., edit-pdf, sign-pdf) before npm run build to remove those tools from the homepage, search, shortcuts, workflow builder, and direct URL access. Tool IDs are the page URL without .html. ```bash DISABLE_TOOLS="edit-pdf,sign-pdf" npm run build ``` -------------------------------- ### Quick test of release system Source: https://github.com/alam00000/bentopdf/blob/main/RELEASE.md Make a small change, commit, and run the release to test the pipeline. ```bash # Make a small change echo "// Test" >> src/js/main.js git add src/js/main.js git commit -m "Test release" npm run release ``` -------------------------------- ### Docker Compose deployment for BentoPDF Simple Mode Source: https://github.com/alam00000/bentopdf/blob/main/SIMPLE_MODE.md Deploy the self-hosted Simple Mode container using Docker Compose or Podman Compose. Uses the recommended GitHub Container Registry image with an alternative Docker Hub image commented out. Maps host port 80 to container port 8080 and sets PUID/PGID environment variables. ```yaml services: bentopdf: image: ghcr.io/alam00000/bentopdf-simple:latest # Recommended # image: bentopdfteam/bentopdf-simple:latest # Alternative: Docker Hub container_name: bentopdf restart: unless-stopped ports: - '80:8080' environment: - PUID=1000 - PGID=1000 ``` -------------------------------- ### Build and verify static language files Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Runs the build process (includes i18n page generation) and verifies that static files for the language were created in `dist/ja/`. ```bash # Run build (includes i18n page generation) npm run build # Verify files were created ls dist/ja/ # Should show: index.html, merge-pdf.html, etc. ``` -------------------------------- ### Automated air-gap preparation with prepare-airgap.sh Source: https://github.com/alam00000/bentopdf/blob/main/README.md Clones the repository and runs the prepare-airgap.sh script to download WASM packages, build the Docker image, and export a self-contained bundle. Supports listing or searching OCR language codes, interactive prompts, and fully automated mode with a custom WASM base URL. ```bash git clone https://github.com/alam00000/bentopdf.git cd bentopdf # Show supported OCR language codes (for --ocr-languages) bash scripts/prepare-airgap.sh --list-ocr-languages # Search OCR language codes by name or abbreviation bash scripts/prepare-airgap.sh --search-ocr-language german # Interactive mode — prompts for all options bash scripts/prepare-airgap.sh # Or fully automated bash scripts/prepare-airgap.sh --wasm-base-url https://internal.example.com/wasm ``` -------------------------------- ### Docker build and run for subdirectory deployment Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds the Docker image with the BASE_URL build argument and runs the container. The app will be accessible at `http://localhost:3000/bentopdf/`. ```bash # Build for subdirectory deployment docker build --build-arg BASE_URL=/bentopdf/ -t bentopdf . # Run the container docker run -p 3000:8080 bentopdf # The app will be accessible at http://localhost:3000/bentopdf/ ``` -------------------------------- ### Build Commercial Image with Custom Branding and Run Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds a Docker image with custom brand name, logo, and footer text, then runs it. The build uses --build-arg flags for VITE_BRAND_NAME, VITE_BRAND_LOGO, and VITE_FOOTER_TEXT. The run command maps port 3000 to 8080. ```bash docker build \ --build-arg VITE_BRAND_NAME="AcmePDF" \ --build-arg VITE_BRAND_LOGO="images/acme-logo.svg" \ --build-arg VITE_FOOTER_TEXT="© 2026 Acme Corp. All rights reserved." \ -t acmepdf . ``` ```bash docker run -p 3000:8080 acmepdf ``` -------------------------------- ### Commit translation changes Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Commit your translation changes with a descriptive message, as shown in the contributing guide. ```bash git commit -m "Add French translation" ``` -------------------------------- ### Translated string with HTML tags intact Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Example of a translation that preserves the HTML tags from the original string. ```json { "faq.analytics.answer": "Nein. BentoPDF verfolgt Sie in keiner Weise. Wir verwenden keine Cookies, keine Analysetools und keine Tracking-Skripte – auch nicht auf der Live-Website bentopdf.com. Wir wissen nie, wer Sie sind oder was Sie mit den Tools tun." } ``` -------------------------------- ### Manual Step 1: Download WASM and OCR packages Source: https://github.com/alam00000/bentopdf/blob/main/README.md Downloads the required npm packages and OCR data files on a machine with internet access. Uses specific versions for pymupdf-wasm and tesseract.js, and fetches the English traineddata and Noto Sans font. ```bash npm pack @bentopdf/pymupdf-wasm@0.11.16 npm pack @bentopdf/gs-wasm npm pack coherentpdf npm pack tesseract.js@7.0.0 npm pack tesseract.js-core@7.0.0 mkdir -p tesseract-langdata curl -fsSL https://cdn.jsdelivr.net/npm/@tesseract.js-data/eng/4.0.0_best_int/eng.traineddata.gz -o tesseract-langdata/eng.traineddata.gz mkdir -p ocr-fonts curl -fsSL https://raw.githack.com/googlefonts/noto-fonts/main/hinted/ttf/NotoSans/NotoSans-Regular.ttf -o ocr-fonts/NotoSans-Regular.ttf ``` -------------------------------- ### Incorrect translation key-value example Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Shows a wrong approach where the key is translated instead of the value, which should be avoided. ```json "inicio": "Inicio" ``` -------------------------------- ### Push translation branch to fork Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Push your translation branch to your fork on GitHub, as instructed in the contributing guide. ```bash git push origin add-french-translation ``` -------------------------------- ### Standard build with local files only Source: https://github.com/alam00000/bentopdf/blob/main/README.md Builds the production bundle using only local files, without CDN. Use when CDN is not desired or unavailable. ```bash # Standard build with local files only npm run build ``` -------------------------------- ### Deploy BentoPDF from GHCR Source: https://github.com/alam00000/bentopdf/blob/main/chart/README.md Upgrades or installs the chart from the OCI registry with version 1.0.0. ```bash helm upgrade --install bentopdf oci://ghcr.io/$GHCR_USERNAME/charts/bentopdf --version 1.0.0 ``` -------------------------------- ### Create a new branch for translation Source: https://github.com/alam00000/bentopdf/blob/main/TRANSLATION.md Use this command to create a new branch for your translation work, as recommended in the contributing guide. ```bash git checkout -b add-french-translation ``` -------------------------------- ### Option A: Commit Everything First Source: https://github.com/alam00000/bentopdf/blob/main/RELEASE.md Recommended solution: commit all changes before running the release command. ```bash git add . git commit -m "Add new features and improvements" npm run release ``` -------------------------------- ### Build with base URL for subdirectory deployment Source: https://github.com/alam00000/bentopdf/blob/main/docs/self-hosting/apache.md Run this command to build the project with a base URL of /pdf/ for subdirectory deployment. ```bash BASE_URL=/pdf/ npm run build ```