Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7a8b9f011 | ||
|
|
2848ccd12e | ||
|
|
bc35687e8e | ||
|
|
4a1cec96c0 | ||
|
|
0568602163 | ||
|
|
0747ea68f5 | ||
|
|
885b3f049e | ||
|
|
0cb745b9ae | ||
|
|
4408ecfa5b | ||
|
|
e4dbe7f9b0 | ||
|
|
d286cfa23d | ||
|
|
9469d0aeb5 | ||
|
|
07f55c4fe0 | ||
|
|
57188e7161 | ||
|
|
aee8b8e5c6 | ||
|
|
6b35049894 | ||
|
|
45b3a14da4 | ||
|
|
7329a7357c | ||
|
|
6b76f0d31a | ||
|
|
a61749d500 | ||
|
|
d0a5416570 | ||
|
|
1ec8112efc | ||
|
|
ad6557b80c | ||
|
|
40862215de | ||
|
|
b99ad89db0 | ||
|
|
d65974a7e1 | ||
|
|
2ec75c39f4 | ||
|
|
9f3bc98636 | ||
|
|
6e14f8d966 | ||
|
|
5ae4d3a751 | ||
|
|
b0836d0bd7 |
@@ -8,11 +8,29 @@
|
||||
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
||||
"dockerfile": "../Dockerfile.dev"
|
||||
},
|
||||
"runArgs": [
|
||||
"-e",
|
||||
"GIT_EDITOR=code --wait",
|
||||
"--security-opt",
|
||||
"label=disable"
|
||||
],
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
"appPort": [8080],
|
||||
"forwardPorts": [8080, 2002, 2003],
|
||||
"portsAttributes": {
|
||||
"8080": {
|
||||
"label": "Stirling-PDF Dev Port"
|
||||
},
|
||||
"2002": {
|
||||
"label": "unoserver Port"
|
||||
},
|
||||
"2003": {
|
||||
"label": "UnoConvert Port"
|
||||
}
|
||||
},
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
|
||||
"mounts": [
|
||||
"source=logs-volume,target=/workspace/logs,type=volume"
|
||||
"source=logs-volume,target=/workspace/logs,type=volume",
|
||||
"source=build-volume,target=/workspace/build,type=volume"
|
||||
],
|
||||
"workspaceFolder": "/workspace",
|
||||
// Configure tool-specific properties.
|
||||
@@ -97,18 +115,17 @@
|
||||
"Oracle.oracle-java", // Oracle Java extension with additional features for Java development
|
||||
"streetsidesoftware.code-spell-checker", // Spell checker for code to avoid typos
|
||||
"vmware.vscode-boot-dev-pack", // Developer tools for Spring Boot by VMware
|
||||
"vmware.vscode-spring-boot", // Spring Boot tools by VMware for enhanced Spring development
|
||||
"vscjava.vscode-java-pack", // Java Extension Pack with essential Java tools for VS Code
|
||||
"vscjava.vscode-spring-boot-dashboard", // Spring Boot dashboard for managing and visualizing Spring Boot applications
|
||||
"vscjava.vscode-spring-initializr", // Support for Spring Initializr to create new Spring projects
|
||||
"EditorConfig.EditorConfig", // EditorConfig support for maintaining consistent coding styles
|
||||
"ms-azuretools.vscode-docker", // Docker extension for Visual Studio Code
|
||||
"charliermarsh.ruff" // Ruff extension for Ruff language support
|
||||
"charliermarsh.ruff", // Ruff extension for Ruff language support
|
||||
"github.vscode-github-actions" // GitHub Actions extension for Visual Studio Code
|
||||
]
|
||||
}
|
||||
},
|
||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||
"remoteUser": "devuser",
|
||||
"shutdownAction": "stopContainer",
|
||||
"postStartCommand": "./scripts/init-setup.sh"
|
||||
"initializeCommand": "bash ./.devcontainer/git-init.sh",
|
||||
"postStartCommand": "./.devcontainer/init-setup.sh"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GIT_USER=$(git config --get user.name)
|
||||
GIT_EMAIL=$(git config --get user.email)
|
||||
|
||||
# Exit if GIT_USER or GIT_EMAIL is empty
|
||||
if [ -z "$GIT_USER" ] || [ -z "$GIT_EMAIL" ]; then
|
||||
echo "GIT_USER or GIT_EMAIL is not set. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git config --local user.name "$GIT_USER"
|
||||
git config --local user.email "$GIT_EMAIL"
|
||||
|
||||
# This directory should contain custom Git hooks for the repository
|
||||
# Set the path for Git hooks to /workspace/hooks
|
||||
git config --local core.hooksPath '%(prefix)/workspace/hooks'
|
||||
# Set the safe directory to the workspace path
|
||||
git config --local --add safe.directory /workspace
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# =============================================================================
|
||||
# Dev Container Initialization Script (init-setup.sh)
|
||||
#
|
||||
# This script runs when the Dev Container starts and provides guidance on
|
||||
# how to interact with the project. It prints an ASCII logo, displays the
|
||||
# current user, changes to the project root, and then shows helpful command
|
||||
# instructions.
|
||||
#
|
||||
# Instructions for future developers:
|
||||
#
|
||||
# - To start the application, use:
|
||||
# ./gradlew bootRun --no-daemon -Dspring-boot.run.fork=true -Dserver.address=0.0.0.0
|
||||
#
|
||||
# - To run tests, use:
|
||||
# ./gradlew test
|
||||
#
|
||||
# - To build the project, use:
|
||||
# ./gradlew build
|
||||
#
|
||||
# - For running pre-commit hooks (if configured), use:
|
||||
# pre-commit run --all-files
|
||||
#
|
||||
# Make sure you are in the project root directory after this script executes.
|
||||
# =============================================================================
|
||||
|
||||
echo "Devcontainer started successfully!"
|
||||
|
||||
VERSION=$(grep "^version =" build.gradle | awk -F'"' '{print $2}')
|
||||
GRADLE_VERSION=$(gradle -version | grep "^Gradle " | awk '{print $2}')
|
||||
GRADLE_PATH=$(which gradle)
|
||||
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
|
||||
JAVA_PATH=$(which java)
|
||||
|
||||
echo """
|
||||
____ _____ ___ ____ _ ___ _ _ ____ ____ ____ _____
|
||||
/ ___|_ _|_ _| _ \| | |_ _| \ | |/ ___| | _ \| _ \| ___|
|
||||
\___ \ | | | || |_) | | | || \| | | _ _____| |_) | | | | |_
|
||||
___) || | | || _ <| |___ | || |\ | |_| |_____| __/| |_| | _|
|
||||
|____/ |_| |___|_| \_\_____|___|_| \_|\____| |_| |____/|_|
|
||||
"""
|
||||
echo -e "Stirling-PDF Version: \e[32m$VERSION\e[0m"
|
||||
echo -e "Gradle Version: \e[32m$GRADLE_VERSION\e[0m"
|
||||
echo -e "Gradle Path: \e[32m$GRADLE_PATH\e[0m"
|
||||
echo -e "Java Version: \e[32m$JAVA_VERSION\e[0m"
|
||||
echo -e "Java Path: \e[32m$JAVA_PATH\e[0m"
|
||||
|
||||
# Display current active user (for permission/debugging purposes)
|
||||
echo -e "Current user: \e[32m$(whoami)\e[0m"
|
||||
|
||||
# Change directory to the project root (parent directory of the script)
|
||||
cd "$(dirname "$0")/.."
|
||||
echo -e "Changed to project root: \e[32m$(pwd)\e[0m"
|
||||
|
||||
# Display available commands for developers
|
||||
echo "=================================================================="
|
||||
echo "Available commands:"
|
||||
echo ""
|
||||
echo " To start unoserver: "
|
||||
echo -e "\e[34m nohup /opt/venv/bin/unoserver --port 2003 --interface 0.0.0.0 > /tmp/unoserver.log 2>&1 &\e[0m"
|
||||
echo
|
||||
echo " To start the application: "
|
||||
echo -e "\e[34m gradle bootRun\e[0m"
|
||||
echo ""
|
||||
echo " To run tests: "
|
||||
echo -e "\e[34m gradle test\e[0m"
|
||||
echo ""
|
||||
echo " To build the project: "
|
||||
echo -e "\e[34m gradle build\e[0m"
|
||||
echo ""
|
||||
echo " To run pre-commit hooks (if configured):"
|
||||
echo -e "\e[34m pre-commit run --all-files -c .pre-commit-config.yaml\e[0m"
|
||||
echo "=================================================================="
|
||||
@@ -54,7 +54,8 @@ Docker:
|
||||
- any-glob-to-any-file: '.github/workflows/build.yml'
|
||||
- any-glob-to-any-file: '.github/workflows/push-docker.yml'
|
||||
- any-glob-to-any-file: 'Dockerfile'
|
||||
- any-glob-to-any-file: 'Dockerfile.*'
|
||||
- any-glob-to-any-file: 'Dockerfile.fat'
|
||||
- any-glob-to-any-file: 'Dockerfile.ultra-lite'
|
||||
- any-glob-to-any-file: 'exampleYmlFiles/*.yml'
|
||||
- any-glob-to-any-file: 'scripts/download-security-jar.sh'
|
||||
- any-glob-to-any-file: 'scripts/init.sh'
|
||||
@@ -63,10 +64,16 @@ Docker:
|
||||
- any-glob-to-any-file: 'test.sh'
|
||||
- any-glob-to-any-file: 'test2.sh'
|
||||
|
||||
Devtools:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: '.devcontainer/**/*'
|
||||
- any-glob-to-any-file: 'Dockerfile.dev'
|
||||
|
||||
Test:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'cucumber/**/*'
|
||||
- any-glob-to-any-file: 'src/test**/*'
|
||||
- any-glob-to-any-file: 'src/test/**/*'
|
||||
- any-glob-to-any-file: 'src/testing/**/*'
|
||||
- any-glob-to-any-file: '.pre-commit-config'
|
||||
- any-glob-to-any-file: '.github/workflows/pre_commit.yml'
|
||||
- any-glob-to-any-file: '.github/workflows/scorecards.yml'
|
||||
|
||||
@@ -108,3 +108,6 @@
|
||||
- name: "Priority: Low"
|
||||
color: "00FF00"
|
||||
description: "Issues or pull requests with low priority"
|
||||
- name: "Devtools"
|
||||
color: "FF9E1F"
|
||||
description: "Development tools"
|
||||
|
||||
@@ -21,6 +21,10 @@ changelog:
|
||||
labels:
|
||||
- Translation
|
||||
|
||||
- title: Development Tools
|
||||
labels:
|
||||
- Devtools
|
||||
|
||||
- title: Other Changes
|
||||
labels:
|
||||
- "*"
|
||||
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: env.CHANGES_DETECTED == 'true'
|
||||
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # v7.0.7
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
commit-message: "Update 3rd Party Licenses"
|
||||
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
git diff --staged --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
||||
- name: Create Pull Request
|
||||
if: env.CHANGES_DETECTED == 'true'
|
||||
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # v7.0.7
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
commit-message: ":file_folder: pre-commit"
|
||||
|
||||
@@ -74,6 +74,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
|
||||
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@@ -35,6 +35,7 @@ jobs:
|
||||
run: ./gradlew swaggerhubUpload
|
||||
env:
|
||||
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
|
||||
SWAGGERHUB_USER: "Frooodle"
|
||||
|
||||
- name: Get version number
|
||||
id: versionNumber
|
||||
@@ -42,6 +43,7 @@ jobs:
|
||||
|
||||
- name: Set API version as published and default on SwaggerHub
|
||||
run: |
|
||||
curl -X PUT -H "Authorization: ${SWAGGERHUB_API_KEY}" "https://api.swaggerhub.com/apis/Frooodle/Stirling-PDF/${{ steps.versionNumber.outputs.versionNumber }}/settings/lifecycle" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"published\":true,\"default\":true}"
|
||||
curl -X PUT -H "Authorization: ${SWAGGERHUB_API_KEY}" "https://api.swaggerhub.com/apis/${SWAGGERHUB_USER}/Stirling-PDF/${{ steps.versionNumber.outputs.versionNumber }}/settings/lifecycle" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"published\":true,\"default\":true}"
|
||||
env:
|
||||
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
|
||||
SWAGGERHUB_USER: "Frooodle"
|
||||
|
||||
@@ -103,7 +103,7 @@ jobs:
|
||||
git diff --staged --quiet || git commit -m ":memo: Sync README.md" || echo "no changes"
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@dd2324fc52d5d43c699a5636bcf19fceaa70c284 # v7.0.7
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
||||
with:
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
commit-message: Update files
|
||||
|
||||
@@ -26,6 +26,8 @@ clientWebUI/
|
||||
!cucumber/exampleFiles/
|
||||
!cucumber/exampleFiles/example_html.zip
|
||||
exampleYmlFiles/stirling/
|
||||
/testing/file_snapshots
|
||||
SwaggerDoc.json
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
@@ -188,3 +190,7 @@ id_ed25519.pub
|
||||
.ipynb_checkpoints
|
||||
|
||||
**/jcef-bundle/
|
||||
|
||||
# node_modules
|
||||
node_modules/
|
||||
*.mjs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.8.4
|
||||
rev: v0.9.10
|
||||
hooks:
|
||||
- id: ruff
|
||||
args:
|
||||
@@ -12,7 +12,7 @@ repos:
|
||||
files: ^((\.github/scripts|scripts)/.+)?[^/]+\.py$
|
||||
exclude: (split_photos.py)
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
rev: v2.4.1
|
||||
hooks:
|
||||
- id: codespell
|
||||
args:
|
||||
@@ -22,7 +22,7 @@ repos:
|
||||
files: \.(html|css|js|py|md)$
|
||||
exclude: (.vscode|.devcontainer|src/main/resources|Dockerfile|.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js)
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.22.0
|
||||
rev: v8.24.0
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
|
||||
Vendored
+6
-9
@@ -5,19 +5,16 @@
|
||||
"ms-python.black-formatter", // Python code formatter using Black
|
||||
"ms-python.flake8", // Flake8 linter for Python to enforce code quality
|
||||
"ms-python.python", // Official Microsoft Python extension with IntelliSense, debugging, and Jupyter support
|
||||
// "ms-vscode-remote.remote-containers", // Support for remote development with containers (Docker, Dev Containers)
|
||||
// "ms-vscode-remote.vscode-remote-extensionpack", // Remote Development Pack for SSH, WSL, and Containers
|
||||
"ms-vscode-remote.vscode-remote-extensionpack", // Remote Development Pack for SSH, WSL, and Containers
|
||||
"Oracle.oracle-java", // Oracle Java extension with additional features for Java development
|
||||
"redhat.java", // Java support by Red Hat with IntelliSense, debugging, and code navigation
|
||||
"streetsidesoftware.code-spell-checker", // Spell checker for code to avoid typos
|
||||
"vmware.vscode-boot-dev-pack", // Developer tools for Spring Boot by VMware
|
||||
"vmware.vscode-spring-boot", // Spring Boot tools by VMware for enhanced Spring development
|
||||
"vscjava.vscode-gradle", // Gradle extension for build and automation support
|
||||
"vscjava.vscode-java-debug", // Debugging support for Java projects
|
||||
"vscjava.vscode-java-dependency", // Java dependency management within VS Code
|
||||
"vscjava.vscode-java-pack", // Java Extension Pack with essential Java tools for VS Code
|
||||
"vscjava.vscode-java-test", // Java test framework for running and debugging tests in VS Code
|
||||
"vscjava.vscode-spring-boot-dashboard", // Spring Boot dashboard for managing and visualizing Spring Boot applications
|
||||
"vscjava.vscode-spring-initializr" // Support for Spring Initializr to create new Spring projects
|
||||
"EditorConfig.EditorConfig", // EditorConfig support for maintaining consistent coding styles
|
||||
"ms-azuretools.vscode-docker", // Docker extension for Visual Studio Code
|
||||
"GitHub.copilot", // GitHub Copilot AI pair programmer for Visual Studio Code
|
||||
"GitHub.vscode-pull-request-github", // GitHub Pull Requests extension for Visual Studio Code
|
||||
"charliermarsh.ruff" // Ruff code formatter for Python to follow the Ruff Style Guide
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -11,7 +11,6 @@
|
||||
"java.format.enabled": true,
|
||||
"java.format.settings.profile": "GoogleStyle",
|
||||
"java.format.settings.google.version": "1.25.2",
|
||||
"java.format.settings.google.mode": "jar-file",
|
||||
"java.format.settings.google.extra": "--aosp --skip-sorting-imports --skip-javadoc-formatting",
|
||||
// (DE) Aktiviert Kommentare im Java-Format.
|
||||
// (EN) Enables comments in Java formatting.
|
||||
@@ -81,4 +80,4 @@
|
||||
"spring.initializr.defaultLanguage": "Java",
|
||||
"spring.initializr.defaultGroupId": "stirling.software.SPDF",
|
||||
"spring.initializr.defaultArtifactId": "SPDF",
|
||||
}
|
||||
}
|
||||
|
||||
+19
-18
@@ -1,53 +1,54 @@
|
||||
# dockerfile.dev
|
||||
|
||||
# Basisimage: Gradle mit JDK 17 (Debian-basiert)
|
||||
FROM gradle:8.12-jdk17
|
||||
FROM gradle:8.13-jdk17
|
||||
|
||||
# Als Root-Benutzer arbeiten, um benötigte Pakete zu installieren
|
||||
USER root
|
||||
|
||||
# Set GRADLE_HOME und füge Gradle zum PATH hinzu
|
||||
ENV GRADLE_HOME=/opt/gradle
|
||||
ENV PATH="$GRADLE_HOME/bin:$PATH"
|
||||
|
||||
# Update und Installation zusätzlicher Pakete (Debian/Ubuntu-basiert)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
tini \
|
||||
bash \
|
||||
curl \
|
||||
sudo \
|
||||
libreoffice \
|
||||
poppler-utils \
|
||||
qpdf \
|
||||
# settings.yml | tessdataDir: /usr/share/tesseract-ocr/5/tessdata
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-eng \
|
||||
fonts-dejavu \
|
||||
fonts-noto \
|
||||
python3 \
|
||||
python3-pip \
|
||||
fonts-terminus fonts-dejavu fonts-font-awesome fonts-noto fonts-noto-core fonts-noto-cjk fonts-noto-extra fonts-liberation fonts-linuxlibertine \
|
||||
python3-uno \
|
||||
python3-venv \
|
||||
# ss -tln
|
||||
iproute2 \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Setze die Environment Variable für setuptools
|
||||
ENV SETUPTOOLS_USE_DISTUTILS=local
|
||||
|
||||
# Installation der benötigten Python-Pakete
|
||||
RUN python3 -m venv /opt/venv \
|
||||
RUN python3 -m venv --system-site-packages /opt/venv \
|
||||
&& . /opt/venv/bin/activate \
|
||||
&& pip install --upgrade setuptools \
|
||||
&& pip install --no-cache-dir WeasyPrint pdf2image pillow unoserver opencv-python-headless pre-commit
|
||||
|
||||
# Füge den venv-Pfad zur globalen PATH-Variable hinzu, damit die Tools verfügbar sind
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
# Erstelle notwendige Verzeichnisse und lege einen Nicht‑Root Benutzer an
|
||||
RUN mkdir -p /home/devuser/{configs,logs,customFiles,pipeline/watchedFolders,pipeline/finishedFolders} \
|
||||
&& adduser --disabled-password --gecos '' devuser \
|
||||
&& chown -R devuser:devuser /home/devuser
|
||||
COPY . /workspace
|
||||
|
||||
RUN mkdir -p /home/devuser/logs /workspace/logs /workspace/scripts /workspace/src/main/resources \
|
||||
RUN adduser --disabled-password --gecos '' devuser \
|
||||
&& chown -R devuser:devuser /home/devuser /workspace
|
||||
RUN echo "devuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/devuser \
|
||||
&& chmod 0440 /etc/sudoers.d/devuser
|
||||
|
||||
# Setze das Arbeitsverzeichnis (wird später per Bind-Mount überschrieben)
|
||||
WORKDIR /workspace
|
||||
|
||||
RUN chmod +x /workspace/.devcontainer/git-init.sh
|
||||
RUN sudo chmod +x /workspace/.devcontainer/init-setup.sh
|
||||
|
||||
# Wechsel zum Nicht‑Root Benutzer
|
||||
USER devuser
|
||||
|
||||
+8
-2
@@ -1,5 +1,11 @@
|
||||
# Build the application
|
||||
FROM gradle:8.12-jdk17 AS build
|
||||
FROM gradle:8.13-jdk21 AS build
|
||||
|
||||
COPY build.gradle .
|
||||
COPY settings.gradle .
|
||||
COPY gradlew .
|
||||
COPY gradle gradle/
|
||||
RUN ./gradlew build -x spotlessApply -x spotlessCheck -x test -x sonarqube || return 0
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
@@ -10,7 +16,7 @@ COPY . .
|
||||
# Build the application with DOCKER_ENABLE_SECURITY=false
|
||||
RUN DOCKER_ENABLE_SECURITY=true \
|
||||
STIRLING_PDF_DESKTOP_UI=false \
|
||||
./gradlew clean build
|
||||
./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube
|
||||
|
||||
# Main stage
|
||||
FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
|
||||
|
||||
@@ -120,17 +120,17 @@ Stirling-PDF currently supports 39 languages!
|
||||
| Azerbaijani (Azərbaycan Dili) (az_AZ) |  |
|
||||
| Basque (Euskara) (eu_ES) |  |
|
||||
| Bulgarian (Български) (bg_BG) |  |
|
||||
| Catalan (Català) (ca_CA) |  |
|
||||
| Catalan (Català) (ca_CA) |  |
|
||||
| Croatian (Hrvatski) (hr_HR) |  |
|
||||
| Czech (Česky) (cs_CZ) |  |
|
||||
| Danish (Dansk) (da_DK) |  |
|
||||
| Dutch (Nederlands) (nl_NL) |  |
|
||||
| Dutch (Nederlands) (nl_NL) |  |
|
||||
| English (English) (en_GB) |  |
|
||||
| English (US) (en_US) |  |
|
||||
| French (Français) (fr_FR) |  |
|
||||
| German (Deutsch) (de_DE) |  |
|
||||
| German (Deutsch) (de_DE) |  |
|
||||
| Greek (Ελληνικά) (el_GR) |  |
|
||||
| Hindi (हिंदी) (hi_IN) |  |
|
||||
| Hindi (हिंदी) (hi_IN) |  |
|
||||
| Hungarian (Magyar) (hu_HU) |  |
|
||||
| Indonesian (Bahasa Indonesia) (id_ID) |  |
|
||||
| Irish (Gaeilge) (ga_IE) |  |
|
||||
@@ -138,7 +138,7 @@ Stirling-PDF currently supports 39 languages!
|
||||
| Japanese (日本語) (ja_JP) |  |
|
||||
| Korean (한국어) (ko_KR) |  |
|
||||
| Norwegian (Norsk) (no_NB) |  |
|
||||
| Persian (فارسی) (fa_IR) |  |
|
||||
| Persian (فارسی) (fa_IR) |  |
|
||||
| Polish (Polski) (pl_PL) |  |
|
||||
| Portuguese (Português) (pt_PT) |  |
|
||||
| Portuguese Brazilian (Português) (pt_BR) |  |
|
||||
@@ -146,15 +146,15 @@ Stirling-PDF currently supports 39 languages!
|
||||
| Russian (Русский) (ru_RU) |  |
|
||||
| Serbian Latin alphabet (Srpski) (sr_LATN_RS) |  |
|
||||
| Simplified Chinese (简体中文) (zh_CN) |  |
|
||||
| Slovakian (Slovensky) (sk_SK) |  |
|
||||
| Slovakian (Slovensky) (sk_SK) |  |
|
||||
| Slovenian (Slovenščina) (sl_SI) |  |
|
||||
| Spanish (Español) (es_ES) |  |
|
||||
| Spanish (Español) (es_ES) |  |
|
||||
| Swedish (Svenska) (sv_SE) |  |
|
||||
| Thai (ไทย) (th_TH) |  |
|
||||
| Tibetan (བོད་ཡིག་) (zh_BO) |  |
|
||||
| Traditional Chinese (繁體中文) (zh_TW) |  |
|
||||
| Traditional Chinese (繁體中文) (zh_TW) |  |
|
||||
| Turkish (Türkçe) (tr_TR) |  |
|
||||
| Ukrainian (Українська) (uk_UA) |  |
|
||||
| Ukrainian (Українська) (uk_UA) |  |
|
||||
| Vietnamese (Tiếng Việt) (vi_VN) |  |
|
||||
|
||||
|
||||
|
||||
+19
-16
@@ -2,7 +2,7 @@ plugins {
|
||||
id "java"
|
||||
id "org.springframework.boot" version "3.4.3"
|
||||
id "io.spring.dependency-management" version "1.1.7"
|
||||
id "org.springdoc.openapi-gradle-plugin" version "1.8.0"
|
||||
id "org.springdoc.openapi-gradle-plugin" version "1.9.0"
|
||||
id "io.swagger.swaggerhub" version "1.3.2"
|
||||
id "edu.sc.seis.launch4j" version "3.0.6"
|
||||
id "com.diffplug.spotless" version "7.0.2"
|
||||
@@ -25,7 +25,7 @@ ext {
|
||||
}
|
||||
|
||||
group = "stirling.software"
|
||||
version = "0.44.0"
|
||||
version = "0.44.2"
|
||||
|
||||
java {
|
||||
// 17 is lowest but we support and recommend 21
|
||||
@@ -98,6 +98,7 @@ openApi {
|
||||
apiDocsUrl = "http://localhost:8080/v1/api-docs"
|
||||
outputDir = file("$projectDir")
|
||||
outputFileName = "SwaggerDoc.json"
|
||||
waitTimeInSeconds = 60 // Increase the wait time to 60 seconds
|
||||
}
|
||||
|
||||
//0.11.5 to 2024.11.5
|
||||
@@ -256,7 +257,7 @@ launch4j {
|
||||
|
||||
spotless {
|
||||
java {
|
||||
target project.fileTree('src/main/java')
|
||||
target project.fileTree('src').include('**/*.java')
|
||||
|
||||
googleJavaFormat("1.25.2").aosp().reorderImports(false)
|
||||
|
||||
@@ -284,17 +285,21 @@ sonar {
|
||||
// }
|
||||
tasks.wrapper {
|
||||
gradleVersion = "8.12"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
//tasks.withType(JavaCompile) {
|
||||
// options.compilerArgs << "-Xlint:deprecation"
|
||||
//}
|
||||
configurations.all {
|
||||
// Remove all commons-logging dependencies so that only spring-jcl is used
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
// Exclude Tomcat
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
||||
}
|
||||
dependencies {
|
||||
|
||||
//tmp for security bumps
|
||||
implementation 'ch.qos.logback:logback-core:1.5.17'
|
||||
implementation 'ch.qos.logback:logback-core:1.5.17'
|
||||
implementation 'ch.qos.logback:logback-classic:1.5.17'
|
||||
|
||||
|
||||
@@ -381,19 +386,13 @@ dependencies {
|
||||
//general PDF
|
||||
|
||||
// https://mvnrepository.com/artifact/com.opencsv/opencsv
|
||||
implementation ("com.opencsv:opencsv:5.10") {
|
||||
exclude group: "commons-logging", module: "commons-logging"
|
||||
}
|
||||
implementation ("com.opencsv:opencsv:5.10")
|
||||
|
||||
implementation ("org.apache.pdfbox:pdfbox:$pdfboxVersion") {
|
||||
exclude group: "commons-logging", module: "commons-logging"
|
||||
}
|
||||
implementation ("org.apache.pdfbox:pdfbox:$pdfboxVersion")
|
||||
implementation "org.apache.pdfbox:preflight:$pdfboxVersion"
|
||||
|
||||
|
||||
implementation ("org.apache.pdfbox:xmpbox:$pdfboxVersion") {
|
||||
exclude group: "commons-logging", module: "commons-logging"
|
||||
}
|
||||
implementation ("org.apache.pdfbox:xmpbox:$pdfboxVersion")
|
||||
|
||||
// https://mvnrepository.com/artifact/technology.tabula/tabula
|
||||
implementation ('technology.tabula:tabula:1.0.5') {
|
||||
@@ -407,7 +406,7 @@ dependencies {
|
||||
implementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion"
|
||||
implementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion"
|
||||
implementation "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
|
||||
implementation "io.micrometer:micrometer-core:1.14.4"
|
||||
implementation "io.micrometer:micrometer-core:1.14.5"
|
||||
implementation group: "com.google.zxing", name: "core", version: "3.5.3"
|
||||
// https://mvnrepository.com/artifact/org.commonmark/commonmark
|
||||
implementation "org.commonmark:commonmark:0.24.0"
|
||||
@@ -443,9 +442,9 @@ task writeVersion {
|
||||
swaggerhubUpload {
|
||||
// dependsOn = generateOpenApiDocs // Depends on your task generating Swagger docs
|
||||
api = "Stirling-PDF" // The name of your API on SwaggerHub
|
||||
owner = "Frooodle" // Your SwaggerHub username (or organization name)
|
||||
owner = "${System.getenv().getOrDefault('SWAGGERHUB_USER', 'Frooodle')}" // Your SwaggerHub username (or organization name)
|
||||
version = project.version // The version of your API
|
||||
inputFile = "./SwaggerDoc.json" // The path to your Swagger docs
|
||||
inputFile = file("SwaggerDoc.json") // The path to your Swagger docs
|
||||
token = "${System.getenv("SWAGGERHUB_API_KEY")}" // Your SwaggerHub API key, passed as an environment variable
|
||||
oas = "3.0.0" // The version of the OpenAPI Specification you"re using
|
||||
}
|
||||
@@ -473,3 +472,7 @@ task printMacVersion {
|
||||
println getMacVersion(project.version.toString())
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('generateOpenApiDocs') {
|
||||
doNotTrackState("Tracking state is not supported for this task")
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
whoami
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo "Devcontainer started..."
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.apache.pdfbox.examples.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.apache.pdfbox.io.RandomAccessReadBufferedFile;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/** A custom RandomAccessRead implementation that deletes the file when closed */
|
||||
@Slf4j
|
||||
public class DeletingRandomAccessFile extends RandomAccessReadBufferedFile {
|
||||
private final Path tempFilePath;
|
||||
|
||||
public DeletingRandomAccessFile(File file) throws IOException {
|
||||
super(file);
|
||||
this.tempFilePath = file.toPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
super.close();
|
||||
} finally {
|
||||
try {
|
||||
boolean deleted = Files.deleteIfExists(tempFilePath);
|
||||
if (deleted) {
|
||||
log.info("Successfully deleted temp file: {}", tempFilePath);
|
||||
} else {
|
||||
log.warn("Failed to delete temp file (may not exist): {}", tempFilePath);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error deleting temp file: {}", tempFilePath, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,17 +18,17 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/analysis")
|
||||
@Tag(name = "Analysis", description = "Analysis APIs")
|
||||
public class AnalysisController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public AnalysisController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public AnalysisController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AnalysisController {
|
||||
summary = "Get PDF page count",
|
||||
description = "Returns total number of pages in PDF. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, Integer> getPageCount(@ModelAttribute PDFFile file) throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
return Map.of("pageCount", document.getNumberOfPages());
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class AnalysisController {
|
||||
summary = "Get basic PDF information",
|
||||
description = "Returns page count, version, file size. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, Object> getBasicInfo(@ModelAttribute PDFFile file) throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
Map<String, Object> info = new HashMap<>();
|
||||
info.put("pageCount", document.getNumberOfPages());
|
||||
info.put("pdfVersion", document.getVersion());
|
||||
@@ -62,7 +62,7 @@ public class AnalysisController {
|
||||
description = "Returns title, author, subject, etc. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, String> getDocumentProperties(@ModelAttribute PDFFile file)
|
||||
throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
PDDocumentInformation info = document.getDocumentInformation();
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
properties.put("title", info.getTitle());
|
||||
@@ -83,7 +83,7 @@ public class AnalysisController {
|
||||
description = "Returns width and height of each page. Input:PDF Output:JSON Type:SISO")
|
||||
public List<Map<String, Float>> getPageDimensions(@ModelAttribute PDFFile file)
|
||||
throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
List<Map<String, Float>> dimensions = new ArrayList<>();
|
||||
PDPageTree pages = document.getPages();
|
||||
|
||||
@@ -103,7 +103,7 @@ public class AnalysisController {
|
||||
description =
|
||||
"Returns count and details of form fields. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, Object> getFormFields(@ModelAttribute PDFFile file) throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
Map<String, Object> formInfo = new HashMap<>();
|
||||
PDAcroForm form = document.getDocumentCatalog().getAcroForm();
|
||||
|
||||
@@ -125,7 +125,7 @@ public class AnalysisController {
|
||||
summary = "Get annotation information",
|
||||
description = "Returns count and types of annotations. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, Object> getAnnotationInfo(@ModelAttribute PDFFile file) throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
Map<String, Object> annotInfo = new HashMap<>();
|
||||
int totalAnnotations = 0;
|
||||
Map<String, Integer> annotationTypes = new HashMap<>();
|
||||
@@ -150,7 +150,7 @@ public class AnalysisController {
|
||||
description =
|
||||
"Returns list of fonts used in the document. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, Object> getFontInfo(@ModelAttribute PDFFile file) throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
Map<String, Object> fontInfo = new HashMap<>();
|
||||
Set<String> fontNames = new HashSet<>();
|
||||
|
||||
@@ -172,7 +172,7 @@ public class AnalysisController {
|
||||
description =
|
||||
"Returns encryption and permission details. Input:PDF Output:JSON Type:SISO")
|
||||
public Map<String, Object> getSecurityInfo(@ModelAttribute PDFFile file) throws IOException {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getFileInput())) {
|
||||
Map<String, Object> securityInfo = new HashMap<>();
|
||||
PDEncryption encryption = document.getEncryption();
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.CropPdfForm;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class CropController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public CropController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public CropController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,10 @@ public class CropController {
|
||||
@Operation(
|
||||
summary = "Crops a PDF document",
|
||||
description =
|
||||
"This operation takes an input PDF file and crops it according to the given coordinates. Input:PDF Output:PDF Type:SISO")
|
||||
"This operation takes an input PDF file and crops it according to the given"
|
||||
+ " coordinates. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> cropPdf(@ModelAttribute CropPdfForm form) throws IOException {
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(form.getFileInput().getBytes());
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(form);
|
||||
|
||||
PDDocument newDocument =
|
||||
pdfDocumentFactory.createNewDocumentBasedOnOldDocument(sourceDocument);
|
||||
|
||||
@@ -33,7 +33,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.MergePdfsRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -43,10 +43,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class MergeController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public MergeController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public MergeController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ public class MergeController {
|
||||
};
|
||||
case "byPDFTitle":
|
||||
return (file1, file2) -> {
|
||||
try (PDDocument doc1 = pdfDocumentFactory.load(file1.getBytes());
|
||||
PDDocument doc2 = pdfDocumentFactory.load(file2.getBytes())) {
|
||||
try (PDDocument doc1 = pdfDocumentFactory.load(file1);
|
||||
PDDocument doc2 = pdfDocumentFactory.load(file2)) {
|
||||
String title1 = doc1.getDocumentInformation().getTitle();
|
||||
String title2 = doc2.getDocumentInformation().getTitle();
|
||||
return title1.compareTo(title2);
|
||||
@@ -119,7 +119,9 @@ public class MergeController {
|
||||
@Operation(
|
||||
summary = "Merge multiple PDF files into one",
|
||||
description =
|
||||
"This endpoint merges multiple PDF files into a single PDF file. The merged file will contain all pages from the input files in the order they were provided. Input:PDF Output:PDF Type:MISO")
|
||||
"This endpoint merges multiple PDF files into a single PDF file. The merged"
|
||||
+ " file will contain all pages from the input files in the order they were"
|
||||
+ " provided. Input:PDF Output:PDF Type:MISO")
|
||||
public ResponseEntity<byte[]> mergePdfs(@ModelAttribute MergePdfsRequest form)
|
||||
throws IOException {
|
||||
List<File> filesToDelete = new ArrayList<>(); // List of temporary files to delete
|
||||
|
||||
@@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.MergeMultiplePagesRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -32,10 +32,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class MultiPageLayoutController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public MultiPageLayoutController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public MultiPageLayoutController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ public class MultiPageLayoutController {
|
||||
@Operation(
|
||||
summary = "Merge multiple pages of a PDF document into a single page",
|
||||
description =
|
||||
"This operation takes an input PDF file and the number of pages to merge into a single sheet in the output PDF file. Input:PDF Output:PDF Type:SISO")
|
||||
"This operation takes an input PDF file and the number of pages to merge into a"
|
||||
+ " single sheet in the output PDF file. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> mergeMultiplePagesIntoOne(
|
||||
@ModelAttribute MergeMultiplePagesRequest request) throws IOException {
|
||||
|
||||
@@ -63,7 +64,7 @@ public class MultiPageLayoutController {
|
||||
: (int) Math.sqrt(pagesPerSheet);
|
||||
int rows = pagesPerSheet == 2 || pagesPerSheet == 3 ? 1 : (int) Math.sqrt(pagesPerSheet);
|
||||
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(file.getBytes());
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(file);
|
||||
PDDocument newDocument =
|
||||
pdfDocumentFactory.createNewDocumentBasedOnOldDocument(sourceDocument);
|
||||
PDPage newPage = new PDPage(PDRectangle.A4);
|
||||
|
||||
@@ -15,7 +15,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.service.PdfImageRemovalService;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PdfImageRemovalController {
|
||||
// Service for removing images from PDFs
|
||||
private final PdfImageRemovalService pdfImageRemovalService;
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
/**
|
||||
* Constructor for dependency injection of PdfImageRemovalService.
|
||||
@@ -41,7 +41,7 @@ public class PdfImageRemovalController {
|
||||
@Autowired
|
||||
public PdfImageRemovalController(
|
||||
PdfImageRemovalService pdfImageRemovalService,
|
||||
CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfImageRemovalService = pdfImageRemovalService;
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
@@ -61,7 +61,8 @@ public class PdfImageRemovalController {
|
||||
@Operation(
|
||||
summary = "Remove images from file to reduce the file size.",
|
||||
description =
|
||||
"This endpoint remove images from file to reduce the file size.Input:PDF Output:PDF Type:MISO")
|
||||
"This endpoint remove images from file to reduce the file size.Input:PDF"
|
||||
+ " Output:PDF Type:MISO")
|
||||
public ResponseEntity<byte[]> removeImages(@ModelAttribute PDFFile file) throws IOException {
|
||||
// Load the PDF document
|
||||
PDDocument document = pdfDocumentFactory.load(file);
|
||||
|
||||
@@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.OverlayPdfsRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -35,10 +35,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class PdfOverlayController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public PdfOverlayController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public PdfOverlayController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ public class PdfOverlayController {
|
||||
@Operation(
|
||||
summary = "Overlay PDF files in various modes",
|
||||
description =
|
||||
"Overlay PDF files onto a base PDF with different modes: Sequential, Interleaved, or Fixed Repeat. Input:PDF Output:PDF Type:MIMO")
|
||||
"Overlay PDF files onto a base PDF with different modes: Sequential,"
|
||||
+ " Interleaved, or Fixed Repeat. Input:PDF Output:PDF Type:MIMO")
|
||||
public ResponseEntity<byte[]> overlayPdfs(@ModelAttribute OverlayPdfsRequest request)
|
||||
throws IOException {
|
||||
MultipartFile baseFile = request.getFileInput();
|
||||
|
||||
+11
-6
@@ -24,7 +24,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import stirling.software.SPDF.model.SortTypes;
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
import stirling.software.SPDF.model.api.general.RearrangePagesRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -34,10 +34,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class RearrangePagesPDFController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public RearrangePagesPDFController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public RearrangePagesPDFController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,9 @@ public class RearrangePagesPDFController {
|
||||
@Operation(
|
||||
summary = "Remove pages from a PDF file",
|
||||
description =
|
||||
"This endpoint removes specified pages from a given PDF file. Users can provide a comma-separated list of page numbers or ranges to delete. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint removes specified pages from a given PDF file. Users can provide"
|
||||
+ " a comma-separated list of page numbers or ranges to delete. Input:PDF"
|
||||
+ " Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> deletePages(@ModelAttribute PDFWithPageNums request)
|
||||
throws IOException {
|
||||
|
||||
@@ -242,7 +244,10 @@ public class RearrangePagesPDFController {
|
||||
@Operation(
|
||||
summary = "Rearrange pages in a PDF file",
|
||||
description =
|
||||
"This endpoint rearranges pages in a given PDF file based on the specified page order or custom mode. Users can provide a page order as a comma-separated list of page numbers or page ranges, or a custom mode. Input:PDF Output:PDF")
|
||||
"This endpoint rearranges pages in a given PDF file based on the specified page"
|
||||
+ " order or custom mode. Users can provide a page order as a"
|
||||
+ " comma-separated list of page numbers or page ranges, or a custom mode."
|
||||
+ " Input:PDF Output:PDF")
|
||||
public ResponseEntity<byte[]> rearrangePages(@ModelAttribute RearrangePagesRequest request)
|
||||
throws IOException {
|
||||
MultipartFile pdfFile = request.getFileInput();
|
||||
@@ -250,7 +255,7 @@ public class RearrangePagesPDFController {
|
||||
String sortType = request.getCustomMode();
|
||||
try {
|
||||
// Load the input PDF
|
||||
PDDocument document = pdfDocumentFactory.load(pdfFile.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(pdfFile);
|
||||
|
||||
// Split the page order string into an array of page numbers or range of numbers
|
||||
String[] pageOrderArr = pageOrder != null ? pageOrder.split(",") : new String[0];
|
||||
|
||||
@@ -18,7 +18,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.RotatePDFRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -26,10 +26,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class RotationController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public RotationController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public RotationController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -37,11 +37,18 @@ public class RotationController {
|
||||
@Operation(
|
||||
summary = "Rotate a PDF file",
|
||||
description =
|
||||
"This endpoint rotates a given PDF file by a specified angle. The angle must be a multiple of 90. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint rotates a given PDF file by a specified angle. The angle must be"
|
||||
+ " a multiple of 90. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> rotatePDF(@ModelAttribute RotatePDFRequest request)
|
||||
throws IOException {
|
||||
MultipartFile pdfFile = request.getFileInput();
|
||||
Integer angle = request.getAngle();
|
||||
|
||||
// Validate the angle is a multiple of 90
|
||||
if (angle % 90 != 0) {
|
||||
throw new IllegalArgumentException("Angle must be a multiple of 90");
|
||||
}
|
||||
|
||||
// Load the PDF document
|
||||
PDDocument document = pdfDocumentFactory.load(request);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.ScalePagesRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class ScalePagesController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ScalePagesController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ScalePagesController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -44,14 +44,15 @@ public class ScalePagesController {
|
||||
@Operation(
|
||||
summary = "Change the size of a PDF page/document",
|
||||
description =
|
||||
"This operation takes an input PDF file and the size to scale the pages to in the output PDF file. Input:PDF Output:PDF Type:SISO")
|
||||
"This operation takes an input PDF file and the size to scale the pages to in"
|
||||
+ " the output PDF file. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> scalePages(@ModelAttribute ScalePagesRequest request)
|
||||
throws IOException {
|
||||
MultipartFile file = request.getFileInput();
|
||||
String targetPDRectangle = request.getPageSize();
|
||||
float scaleFactor = request.getScaleFactor();
|
||||
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(file.getBytes());
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(file);
|
||||
PDDocument outputDocument =
|
||||
pdfDocumentFactory.createNewDocumentBasedOnOldDocument(sourceDocument);
|
||||
|
||||
@@ -123,7 +124,8 @@ public class ScalePagesController {
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid PDRectangle. It must be one of the following: A0, A1, A2, A3, A4, A5, A6, LETTER, LEGAL, KEEP");
|
||||
"Invalid PDRectangle. It must be one of the following: A0, A1, A2, A3, A4, A5, A6,"
|
||||
+ " LETTER, LEGAL, KEEP");
|
||||
}
|
||||
|
||||
private Map<String, PDRectangle> getSizeMap() {
|
||||
|
||||
@@ -28,7 +28,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -37,10 +37,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class SplitPDFController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public SplitPDFController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public SplitPDFController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,10 @@ public class SplitPDFController {
|
||||
@Operation(
|
||||
summary = "Split a PDF file into separate documents",
|
||||
description =
|
||||
"This endpoint splits a given PDF file into separate documents based on the specified page numbers or ranges. Users can specify pages using individual numbers, ranges, or 'all' for every page. Input:PDF Output:PDF Type:SIMO")
|
||||
"This endpoint splits a given PDF file into separate documents based on the"
|
||||
+ " specified page numbers or ranges. Users can specify pages using"
|
||||
+ " individual numbers, ranges, or 'all' for every page. Input:PDF"
|
||||
+ " Output:PDF Type:SIMO")
|
||||
public ResponseEntity<byte[]> splitPdf(@ModelAttribute PDFWithPageNums request)
|
||||
throws IOException {
|
||||
|
||||
@@ -62,7 +65,7 @@ public class SplitPDFController {
|
||||
String pages = request.getPageNumbers();
|
||||
// open the pdf document
|
||||
|
||||
document = pdfDocumentFactory.load(file.getBytes());
|
||||
document = pdfDocumentFactory.load(file);
|
||||
// PdfMetadata metadata = PdfMetadataService.extractMetadataFromPdf(document);
|
||||
int totalPages = document.getNumberOfPages();
|
||||
List<Integer> pageNumbers = request.getPageNumbersList(document, false);
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.PdfMetadata;
|
||||
import stirling.software.SPDF.model.api.SplitPdfByChaptersRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.service.PdfMetadataService;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -45,11 +45,11 @@ public class SplitPdfByChaptersController {
|
||||
|
||||
private final PdfMetadataService pdfMetadataService;
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public SplitPdfByChaptersController(
|
||||
PdfMetadataService pdfMetadataService, CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
PdfMetadataService pdfMetadataService, CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfMetadataService = pdfMetadataService;
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class SplitPdfByChaptersController {
|
||||
if (bookmarkLevel < 0) {
|
||||
return ResponseEntity.badRequest().body("Invalid bookmark level".getBytes());
|
||||
}
|
||||
sourceDocument = pdfDocumentFactory.load(file.getBytes());
|
||||
sourceDocument = pdfDocumentFactory.load(file);
|
||||
|
||||
PDDocumentOutline outline = sourceDocument.getDocumentCatalog().getDocumentOutline();
|
||||
|
||||
|
||||
+7
-5
@@ -31,7 +31,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.SplitPdfBySectionsRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -39,10 +39,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class SplitPdfBySectionsController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public SplitPdfBySectionsController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public SplitPdfBySectionsController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,15 @@ public class SplitPdfBySectionsController {
|
||||
@Operation(
|
||||
summary = "Split PDF pages into smaller sections",
|
||||
description =
|
||||
"Split each page of a PDF into smaller sections based on the user's choice (halves, thirds, quarters, etc.), both vertically and horizontally. Input:PDF Output:ZIP-PDF Type:SISO")
|
||||
"Split each page of a PDF into smaller sections based on the user's choice"
|
||||
+ " (halves, thirds, quarters, etc.), both vertically and horizontally."
|
||||
+ " Input:PDF Output:ZIP-PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> splitPdf(@ModelAttribute SplitPdfBySectionsRequest request)
|
||||
throws Exception {
|
||||
List<ByteArrayOutputStream> splitDocumentsBoas = new ArrayList<>();
|
||||
|
||||
MultipartFile file = request.getFileInput();
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(file.getBytes());
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(file);
|
||||
|
||||
// Process the PDF based on split parameters
|
||||
int horiz = request.getHorizontalDivisions() + 1;
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.general.SplitPdfBySizeOrCountRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -35,22 +35,25 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class SplitPdfBySizeController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public SplitPdfBySizeController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public SplitPdfBySizeController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
log.info(
|
||||
"SplitPdfBySizeController initialized with pdfDocumentFactory: {}",
|
||||
pdfDocumentFactory);
|
||||
pdfDocumentFactory.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/split-by-size-or-count", consumes = "multipart/form-data")
|
||||
@Operation(
|
||||
summary = "Auto split PDF pages into separate documents based on size or count",
|
||||
description =
|
||||
"split PDF into multiple paged documents based on size/count, ie if 20 pages and split into 5, it does 5 documents each 4 pages\r\n"
|
||||
+ " if 10MB and each page is 1MB and you enter 2MB then 5 docs each 2MB (rounded so that it accepts 1.9MB but not 2.1MB) Input:PDF Output:ZIP-PDF Type:SISO")
|
||||
"split PDF into multiple paged documents based on size/count, ie if 20 pages"
|
||||
+ " and split into 5, it does 5 documents each 4 pages\r\n"
|
||||
+ " if 10MB and each page is 1MB and you enter 2MB then 5 docs each 2MB"
|
||||
+ " (rounded so that it accepts 1.9MB but not 2.1MB) Input:PDF"
|
||||
+ " Output:ZIP-PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> autoSplitPdf(@ModelAttribute SplitPdfBySizeOrCountRequest request)
|
||||
throws Exception {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "General", description = "General APIs")
|
||||
public class ToSinglePageController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ToSinglePageController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ToSinglePageController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -40,12 +40,15 @@ public class ToSinglePageController {
|
||||
@Operation(
|
||||
summary = "Convert a multi-page PDF into a single long page PDF",
|
||||
description =
|
||||
"This endpoint converts a multi-page PDF document into a single paged PDF document. The width of the single page will be same as the input's width, but the height will be the sum of all the pages' heights. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint converts a multi-page PDF document into a single paged PDF"
|
||||
+ " document. The width of the single page will be same as the input's"
|
||||
+ " width, but the height will be the sum of all the pages' heights."
|
||||
+ " Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> pdfToSinglePage(@ModelAttribute PDFFile request)
|
||||
throws IOException {
|
||||
|
||||
// Load the source document
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(request.getFileInput().getBytes());
|
||||
PDDocument sourceDocument = pdfDocumentFactory.load(request);
|
||||
|
||||
// Calculate total height and max width
|
||||
float totalHeight = 0;
|
||||
|
||||
+5
-4
@@ -15,7 +15,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import stirling.software.SPDF.config.RuntimePathConfig;
|
||||
import stirling.software.SPDF.model.ApplicationProperties;
|
||||
import stirling.software.SPDF.model.api.converters.HTMLToPdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.FileToPdf;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -24,7 +24,7 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@RequestMapping("/api/v1/convert")
|
||||
public class ConvertHtmlToPDF {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
private final ApplicationProperties applicationProperties;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ConvertHtmlToPDF {
|
||||
|
||||
@Autowired
|
||||
public ConvertHtmlToPDF(
|
||||
CustomPDDocumentFactory pdfDocumentFactory,
|
||||
CustomPDFDocumentFactory pdfDocumentFactory,
|
||||
ApplicationProperties applicationProperties,
|
||||
RuntimePathConfig runtimePathConfig) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
@@ -45,7 +45,8 @@ public class ConvertHtmlToPDF {
|
||||
@Operation(
|
||||
summary = "Convert an HTML or ZIP (containing HTML and CSS) to PDF",
|
||||
description =
|
||||
"This endpoint takes an HTML or ZIP file input and converts it to a PDF format. Input:HTML Output:PDF Type:SISO")
|
||||
"This endpoint takes an HTML or ZIP file input and converts it to a PDF format."
|
||||
+ " Input:HTML Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> HtmlToPdf(@ModelAttribute HTMLToPdfRequest request)
|
||||
throws Exception {
|
||||
MultipartFile fileInput = request.getFileInput();
|
||||
|
||||
+13
-8
@@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.converters.ConvertToImageRequest;
|
||||
import stirling.software.SPDF.model.api.converters.ConvertToPdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.*;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
|
||||
@@ -43,10 +43,10 @@ import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
@Tag(name = "Convert", description = "Convert APIs")
|
||||
public class ConvertImgPDFController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ConvertImgPDFController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ConvertImgPDFController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,9 @@ public class ConvertImgPDFController {
|
||||
@Operation(
|
||||
summary = "Convert PDF to image(s)",
|
||||
description =
|
||||
"This endpoint converts a PDF file to image(s) with the specified image format, color type, and DPI. Users can choose to get a single image or multiple images. Input:PDF Output:Image Type:SI-Conditional")
|
||||
"This endpoint converts a PDF file to image(s) with the specified image format,"
|
||||
+ " color type, and DPI. Users can choose to get a single image or multiple"
|
||||
+ " images. Input:PDF Output:Image Type:SI-Conditional")
|
||||
public ResponseEntity<byte[]> convertToImage(@ModelAttribute ConvertToImageRequest request)
|
||||
throws NumberFormatException, Exception {
|
||||
MultipartFile file = request.getFileInput();
|
||||
@@ -74,7 +76,7 @@ public class ConvertImgPDFController {
|
||||
;
|
||||
try {
|
||||
// Load the input PDF
|
||||
byte[] newPdfBytes = rearrangePdfPages(file.getBytes(), pageOrderArr);
|
||||
byte[] newPdfBytes = rearrangePdfPages(file, pageOrderArr);
|
||||
|
||||
ImageType colorTypeResult = ImageType.RGB;
|
||||
if ("greyscale".equals(colorType)) {
|
||||
@@ -208,7 +210,9 @@ public class ConvertImgPDFController {
|
||||
@Operation(
|
||||
summary = "Convert images to a PDF file",
|
||||
description =
|
||||
"This endpoint converts one or more images to a PDF file. Users can specify whether to stretch the images to fit the PDF page, and whether to automatically rotate the images. Input:Image Output:PDF Type:MISO")
|
||||
"This endpoint converts one or more images to a PDF file. Users can specify"
|
||||
+ " whether to stretch the images to fit the PDF page, and whether to"
|
||||
+ " automatically rotate the images. Input:Image Output:PDF Type:MISO")
|
||||
public ResponseEntity<byte[]> convertToPdf(@ModelAttribute ConvertToPdfRequest request)
|
||||
throws IOException {
|
||||
MultipartFile[] file = request.getFileInput();
|
||||
@@ -243,9 +247,10 @@ public class ConvertImgPDFController {
|
||||
* @return A byte array of the rearranged PDF.
|
||||
* @throws IOException If an error occurs while processing the PDF.
|
||||
*/
|
||||
private byte[] rearrangePdfPages(byte[] pdfBytes, String[] pageOrderArr) throws IOException {
|
||||
private byte[] rearrangePdfPages(MultipartFile pdfFile, String[] pageOrderArr)
|
||||
throws IOException {
|
||||
// Load the input PDF
|
||||
PDDocument document = pdfDocumentFactory.load(pdfBytes);
|
||||
PDDocument document = pdfDocumentFactory.load(pdfFile);
|
||||
int totalPages = document.getNumberOfPages();
|
||||
List<Integer> newPageOrder = GeneralUtils.parsePageList(pageOrderArr, totalPages, false);
|
||||
|
||||
|
||||
+5
-4
@@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import stirling.software.SPDF.config.RuntimePathConfig;
|
||||
import stirling.software.SPDF.model.ApplicationProperties;
|
||||
import stirling.software.SPDF.model.api.GeneralFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.FileToPdf;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -34,14 +34,14 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@RequestMapping("/api/v1/convert")
|
||||
public class ConvertMarkdownToPdf {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
private final ApplicationProperties applicationProperties;
|
||||
private final RuntimePathConfig runtimePathConfig;
|
||||
|
||||
@Autowired
|
||||
public ConvertMarkdownToPdf(
|
||||
CustomPDDocumentFactory pdfDocumentFactory,
|
||||
CustomPDFDocumentFactory pdfDocumentFactory,
|
||||
ApplicationProperties applicationProperties,
|
||||
RuntimePathConfig runtimePathConfig) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
@@ -54,7 +54,8 @@ public class ConvertMarkdownToPdf {
|
||||
@Operation(
|
||||
summary = "Convert a Markdown file to PDF",
|
||||
description =
|
||||
"This endpoint takes a Markdown file input, converts it to HTML, and then to PDF format. Input:MARKDOWN Output:PDF Type:SISO")
|
||||
"This endpoint takes a Markdown file input, converts it to HTML, and then to"
|
||||
+ " PDF format. Input:MARKDOWN Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> markdownToPdf(@ModelAttribute GeneralFile request)
|
||||
throws Exception {
|
||||
MultipartFile fileInput = request.getFileInput();
|
||||
|
||||
+5
-4
@@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.config.RuntimePathConfig;
|
||||
import stirling.software.SPDF.model.api.GeneralFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@@ -34,12 +34,12 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@RequestMapping("/api/v1/convert")
|
||||
public class ConvertOfficeController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
private final RuntimePathConfig runtimePathConfig;
|
||||
|
||||
@Autowired
|
||||
public ConvertOfficeController(
|
||||
CustomPDDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) {
|
||||
CustomPDFDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
this.runtimePathConfig = runtimePathConfig;
|
||||
}
|
||||
@@ -93,7 +93,8 @@ public class ConvertOfficeController {
|
||||
@Operation(
|
||||
summary = "Convert a file to a PDF using LibreOffice",
|
||||
description =
|
||||
"This endpoint converts a given file to a PDF using LibreOffice API Input:ANY Output:PDF Type:SISO")
|
||||
"This endpoint converts a given file to a PDF using LibreOffice API Input:ANY"
|
||||
+ " Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> processFileToPDF(@ModelAttribute GeneralFile request)
|
||||
throws Exception {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
|
||||
+12
-8
@@ -21,7 +21,7 @@ import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.model.api.converters.PdfToPresentationRequest;
|
||||
import stirling.software.SPDF.model.api.converters.PdfToTextOrRTFRequest;
|
||||
import stirling.software.SPDF.model.api.converters.PdfToWordRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.PDFToFile;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -30,10 +30,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Convert", description = "Convert APIs")
|
||||
public class ConvertPDFToOffice {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ConvertPDFToOffice(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ConvertPDFToOffice(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ public class ConvertPDFToOffice {
|
||||
@Operation(
|
||||
summary = "Convert PDF to Presentation format",
|
||||
description =
|
||||
"This endpoint converts a given PDF file to a Presentation format. Input:PDF Output:PPT Type:SISO")
|
||||
"This endpoint converts a given PDF file to a Presentation format. Input:PDF"
|
||||
+ " Output:PPT Type:SISO")
|
||||
public ResponseEntity<byte[]> processPdfToPresentation(
|
||||
@ModelAttribute PdfToPresentationRequest request)
|
||||
throws IOException, InterruptedException {
|
||||
@@ -55,14 +56,15 @@ public class ConvertPDFToOffice {
|
||||
@Operation(
|
||||
summary = "Convert PDF to Text or RTF format",
|
||||
description =
|
||||
"This endpoint converts a given PDF file to Text or RTF format. Input:PDF Output:TXT Type:SISO")
|
||||
"This endpoint converts a given PDF file to Text or RTF format. Input:PDF"
|
||||
+ " Output:TXT Type:SISO")
|
||||
public ResponseEntity<byte[]> processPdfToRTForTXT(
|
||||
@ModelAttribute PdfToTextOrRTFRequest request)
|
||||
throws IOException, InterruptedException {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
String outputFormat = request.getOutputFormat();
|
||||
if ("txt".equals(request.getOutputFormat())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputFile.getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputFile)) {
|
||||
PDFTextStripper stripper = new PDFTextStripper();
|
||||
String text = stripper.getText(document);
|
||||
return WebResponseUtils.bytesToWebResponse(
|
||||
@@ -82,7 +84,8 @@ public class ConvertPDFToOffice {
|
||||
@Operation(
|
||||
summary = "Convert PDF to Word document",
|
||||
description =
|
||||
"This endpoint converts a given PDF file to a Word document format. Input:PDF Output:WORD Type:SISO")
|
||||
"This endpoint converts a given PDF file to a Word document format. Input:PDF"
|
||||
+ " Output:WORD Type:SISO")
|
||||
public ResponseEntity<byte[]> processPdfToWord(@ModelAttribute PdfToWordRequest request)
|
||||
throws IOException, InterruptedException {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
@@ -95,7 +98,8 @@ public class ConvertPDFToOffice {
|
||||
@Operation(
|
||||
summary = "Convert PDF to XML",
|
||||
description =
|
||||
"This endpoint converts a PDF file to an XML file. Input:PDF Output:XML Type:SISO")
|
||||
"This endpoint converts a PDF file to an XML file. Input:PDF Output:XML"
|
||||
+ " Type:SISO")
|
||||
public ResponseEntity<byte[]> processPdfToXML(@ModelAttribute PDFFile request)
|
||||
throws Exception {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
|
||||
+5
-4
@@ -21,7 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.config.RuntimePathConfig;
|
||||
import stirling.software.SPDF.model.api.converters.UrlToPdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
@@ -33,12 +33,12 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@RequestMapping("/api/v1/convert")
|
||||
public class ConvertWebsiteToPDF {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
private final RuntimePathConfig runtimePathConfig;
|
||||
|
||||
@Autowired
|
||||
public ConvertWebsiteToPDF(
|
||||
CustomPDDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) {
|
||||
CustomPDFDocumentFactory pdfDocumentFactory, RuntimePathConfig runtimePathConfig) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
this.runtimePathConfig = runtimePathConfig;
|
||||
}
|
||||
@@ -47,7 +47,8 @@ public class ConvertWebsiteToPDF {
|
||||
@Operation(
|
||||
summary = "Convert a URL to a PDF",
|
||||
description =
|
||||
"This endpoint fetches content from a URL and converts it to a PDF format. Input:N/A Output:PDF Type:SISO")
|
||||
"This endpoint fetches content from a URL and converts it to a PDF format."
|
||||
+ " Input:N/A Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> urlToPdf(@ModelAttribute UrlToPdfRequest request)
|
||||
throws IOException, InterruptedException {
|
||||
String URL = request.getUrlInput();
|
||||
|
||||
+6
-5
@@ -30,7 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
import stirling.software.SPDF.pdf.FlexibleCSVWriter;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
import technology.tabula.ObjectExtractor;
|
||||
import technology.tabula.Page;
|
||||
@@ -43,10 +43,10 @@ import technology.tabula.extractors.SpreadsheetExtractionAlgorithm;
|
||||
@Slf4j
|
||||
public class ExtractCSVController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ExtractCSVController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ExtractCSVController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -54,12 +54,13 @@ public class ExtractCSVController {
|
||||
@Operation(
|
||||
summary = "Extracts a CSV document from a PDF",
|
||||
description =
|
||||
"This operation takes an input PDF file and returns CSV file of whole page. Input:PDF Output:CSV Type:SISO")
|
||||
"This operation takes an input PDF file and returns CSV file of whole page."
|
||||
+ " Input:PDF Output:CSV Type:SISO")
|
||||
public ResponseEntity<?> pdfToCsv(@ModelAttribute PDFWithPageNums form) throws Exception {
|
||||
String baseName = getBaseName(form.getFileInput().getOriginalFilename());
|
||||
List<CsvEntry> csvEntries = new ArrayList<>();
|
||||
|
||||
try (PDDocument document = pdfDocumentFactory.load(form.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(form)) {
|
||||
List<Integer> pages = form.getPageNumbersList(document, true);
|
||||
SpreadsheetExtractionAlgorithm sea = new SpreadsheetExtractionAlgorithm();
|
||||
CSVFormat format =
|
||||
|
||||
@@ -23,7 +23,7 @@ import stirling.software.SPDF.model.api.filter.ContainsTextRequest;
|
||||
import stirling.software.SPDF.model.api.filter.FileSizeRequest;
|
||||
import stirling.software.SPDF.model.api.filter.PageRotationRequest;
|
||||
import stirling.software.SPDF.model.api.filter.PageSizeRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.PdfUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -32,10 +32,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Filter", description = "Filter APIs")
|
||||
public class FilterController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public FilterController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public FilterController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class FilterController {
|
||||
String text = request.getText();
|
||||
String pageNumber = request.getPageNumbers();
|
||||
|
||||
PDDocument pdfDocument = pdfDocumentFactory.load(inputFile.getBytes());
|
||||
PDDocument pdfDocument = pdfDocumentFactory.load(inputFile);
|
||||
if (PdfUtils.hasText(pdfDocument, pageNumber, text))
|
||||
return WebResponseUtils.pdfDocToWebResponse(
|
||||
pdfDocument, Filenames.toSimpleFileName(inputFile.getOriginalFilename()));
|
||||
@@ -66,7 +66,7 @@ public class FilterController {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
String pageNumber = request.getPageNumbers();
|
||||
|
||||
PDDocument pdfDocument = pdfDocumentFactory.load(inputFile.getBytes());
|
||||
PDDocument pdfDocument = pdfDocumentFactory.load(inputFile);
|
||||
if (PdfUtils.hasImages(pdfDocument, pageNumber))
|
||||
return WebResponseUtils.pdfDocToWebResponse(
|
||||
pdfDocument, Filenames.toSimpleFileName(inputFile.getOriginalFilename()));
|
||||
@@ -83,7 +83,7 @@ public class FilterController {
|
||||
String pageCount = request.getPageCount();
|
||||
String comparator = request.getComparator();
|
||||
// Load the PDF
|
||||
PDDocument document = pdfDocumentFactory.load(inputFile.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(inputFile);
|
||||
int actualPageCount = document.getNumberOfPages();
|
||||
|
||||
boolean valid = false;
|
||||
@@ -117,7 +117,7 @@ public class FilterController {
|
||||
String comparator = request.getComparator();
|
||||
|
||||
// Load the PDF
|
||||
PDDocument document = pdfDocumentFactory.load(inputFile.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(inputFile);
|
||||
|
||||
PDPage firstPage = document.getPage(0);
|
||||
PDRectangle actualPageSize = firstPage.getMediaBox();
|
||||
@@ -193,7 +193,7 @@ public class FilterController {
|
||||
String comparator = request.getComparator();
|
||||
|
||||
// Load the PDF
|
||||
PDDocument document = pdfDocumentFactory.load(inputFile.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(inputFile);
|
||||
|
||||
// Get the rotation of the first page
|
||||
PDPage firstPage = document.getPage(0);
|
||||
|
||||
@@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.ExtractHeaderRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -35,10 +35,10 @@ public class AutoRenameController {
|
||||
private static final float TITLE_FONT_SIZE_THRESHOLD = 20.0f;
|
||||
private static final int LINE_LIMIT = 200;
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public AutoRenameController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public AutoRenameController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -46,13 +46,14 @@ public class AutoRenameController {
|
||||
@Operation(
|
||||
summary = "Extract header from PDF file",
|
||||
description =
|
||||
"This endpoint accepts a PDF file and attempts to extract its title or header based on heuristics. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint accepts a PDF file and attempts to extract its title or header"
|
||||
+ " based on heuristics. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> extractHeader(@ModelAttribute ExtractHeaderRequest request)
|
||||
throws Exception {
|
||||
MultipartFile file = request.getFileInput();
|
||||
Boolean useFirstTextAsFallback = request.isUseFirstTextAsFallback();
|
||||
|
||||
PDDocument document = pdfDocumentFactory.load(file.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(file);
|
||||
PDFTextStripper reader =
|
||||
new PDFTextStripper() {
|
||||
List<LineInfo> lineInfos = new ArrayList<>();
|
||||
|
||||
+3
-3
@@ -35,7 +35,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.AutoSplitPdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -51,10 +51,10 @@ public class AutoSplitPdfController {
|
||||
"https://github.com/Frooodle/Stirling-PDF",
|
||||
"https://stirlingpdf.com"));
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public AutoSplitPdfController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public AutoSplitPdfController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.RemoveBlankPagesRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.PdfUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -40,10 +40,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class BlankPageController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public BlankPageController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public BlankPageController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -77,14 +77,16 @@ public class BlankPageController {
|
||||
@Operation(
|
||||
summary = "Remove blank pages from a PDF file",
|
||||
description =
|
||||
"This endpoint removes blank pages from a given PDF file. Users can specify the threshold and white percentage to tune the detection of blank pages. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint removes blank pages from a given PDF file. Users can specify the"
|
||||
+ " threshold and white percentage to tune the detection of blank pages."
|
||||
+ " Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> removeBlankPages(@ModelAttribute RemoveBlankPagesRequest request)
|
||||
throws IOException, InterruptedException {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
int threshold = request.getThreshold();
|
||||
float whitePercent = request.getWhitePercent();
|
||||
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputFile.getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputFile)) {
|
||||
PDPageTree pages = document.getDocumentCatalog().getPages();
|
||||
PDFTextStripper textStripper = new PDFTextStripper();
|
||||
|
||||
|
||||
+404
-308
@@ -3,13 +3,19 @@ package stirling.software.SPDF.controller.api.misc;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.imageio.IIOImage;
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -36,11 +42,15 @@ import io.github.pixee.security.Filenames;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.OptimizePdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.ImageProcessingUtils;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@@ -51,307 +61,373 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class CompressController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public CompressController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public CompressController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
private void compressImagesInPDF(Path pdfFile, double scaleFactor, float jpegQuality)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
private static class ImageReference {
|
||||
int pageNum; // Page number where the image appears
|
||||
COSName name; // The name used to reference this image
|
||||
}
|
||||
|
||||
public Path compressImagesInPDF(
|
||||
Path pdfFile, double scaleFactor, float jpegQuality, boolean convertToGrayscale)
|
||||
throws Exception {
|
||||
byte[] fileBytes = Files.readAllBytes(pdfFile);
|
||||
long originalFileSize = fileBytes.length;
|
||||
Path newCompressedPDF = Files.createTempFile("compressedPDF", ".pdf");
|
||||
long originalFileSize = Files.size(pdfFile);
|
||||
log.info(
|
||||
"Starting image compression with scale factor: {} and JPEG quality: {} on file size: {}",
|
||||
"Starting image compression with scale factor: {}, JPEG quality: {}, grayscale: {} on file size: {}",
|
||||
scaleFactor,
|
||||
jpegQuality,
|
||||
convertToGrayscale,
|
||||
GeneralUtils.formatBytes(originalFileSize));
|
||||
|
||||
// Track processed images to avoid recompression
|
||||
Set<String> processedImages = new HashSet<>();
|
||||
try (PDDocument doc = pdfDocumentFactory.load(pdfFile)) {
|
||||
|
||||
// Collect all unique images by content hash
|
||||
Map<String, List<ImageReference>> uniqueImages = new HashMap<>();
|
||||
Map<String, PDImageXObject> compressedVersions = new HashMap<>();
|
||||
|
||||
try (PDDocument doc = pdfDocumentFactory.load(fileBytes)) {
|
||||
int totalImages = 0;
|
||||
|
||||
for (int pageNum = 0; pageNum < doc.getNumberOfPages(); pageNum++) {
|
||||
PDPage page = doc.getPage(pageNum);
|
||||
PDResources res = page.getResources();
|
||||
if (res == null || res.getXObjectNames() == null) continue;
|
||||
|
||||
for (COSName name : res.getXObjectNames()) {
|
||||
PDXObject xobj = res.getXObject(name);
|
||||
if (!(xobj instanceof PDImageXObject)) continue;
|
||||
|
||||
totalImages++;
|
||||
PDImageXObject image = (PDImageXObject) xobj;
|
||||
String imageHash = generateImageHash(image);
|
||||
|
||||
// Store only page number and name reference
|
||||
ImageReference ref = new ImageReference();
|
||||
ref.pageNum = pageNum;
|
||||
ref.name = name;
|
||||
|
||||
uniqueImages.computeIfAbsent(imageHash, k -> new ArrayList<>()).add(ref);
|
||||
}
|
||||
}
|
||||
|
||||
int uniqueImagesCount = uniqueImages.size();
|
||||
int duplicatedImages = totalImages - uniqueImagesCount;
|
||||
log.info(
|
||||
"Found {} unique images and {} duplicated instances across {} pages",
|
||||
uniqueImagesCount,
|
||||
duplicatedImages,
|
||||
doc.getNumberOfPages());
|
||||
|
||||
// SECOND PASS: Process each unique image exactly once
|
||||
int compressedImages = 0;
|
||||
int skippedImages = 0;
|
||||
long totalOriginalBytes = 0;
|
||||
long totalCompressedBytes = 0;
|
||||
|
||||
// Minimum dimensions to preserve reasonable quality
|
||||
int MIN_WIDTH = 400; // Higher minimum
|
||||
int MIN_HEIGHT = 400; // Higher minimum
|
||||
for (Entry<String, List<ImageReference>> entry : uniqueImages.entrySet()) {
|
||||
String imageHash = entry.getKey();
|
||||
List<ImageReference> references = entry.getValue();
|
||||
|
||||
log.info("PDF has {} pages", doc.getNumberOfPages());
|
||||
if (references.isEmpty()) continue;
|
||||
|
||||
for (int pageNum = 0; pageNum < doc.getNumberOfPages(); pageNum++) {
|
||||
PDPage page = doc.getPage(pageNum);
|
||||
PDResources res = page.getResources();
|
||||
// Get the first instance of this image
|
||||
ImageReference firstRef = references.get(0);
|
||||
PDPage firstPage = doc.getPage(firstRef.pageNum);
|
||||
PDResources firstPageResources = firstPage.getResources();
|
||||
PDImageXObject originalImage =
|
||||
(PDImageXObject) firstPageResources.getXObject(firstRef.name);
|
||||
|
||||
if (res == null || res.getXObjectNames() == null) {
|
||||
continue;
|
||||
}
|
||||
// Track original size
|
||||
int originalSize = (int) originalImage.getCOSObject().getLength();
|
||||
totalOriginalBytes += originalSize;
|
||||
|
||||
int pageImages = 0;
|
||||
// Process this unique image once
|
||||
BufferedImage processedImage =
|
||||
processAndCompressImage(
|
||||
originalImage, scaleFactor, jpegQuality, convertToGrayscale);
|
||||
|
||||
for (COSName name : res.getXObjectNames()) {
|
||||
String imageName = name.getName();
|
||||
if (processedImage != null) {
|
||||
// Convert to bytes for storage
|
||||
byte[] compressedData = convertToBytes(processedImage, jpegQuality);
|
||||
|
||||
// Skip already processed images
|
||||
if (processedImages.contains(imageName)) {
|
||||
skippedImages++;
|
||||
continue;
|
||||
}
|
||||
// Check if compression is beneficial
|
||||
if (compressedData.length < originalSize || convertToGrayscale) {
|
||||
// Create a single compressed version
|
||||
PDImageXObject compressedImage =
|
||||
PDImageXObject.createFromByteArray(
|
||||
doc,
|
||||
compressedData,
|
||||
originalImage.getCOSObject().toString());
|
||||
|
||||
PDXObject xobj = res.getXObject(name);
|
||||
if (!(xobj instanceof PDImageXObject)) {
|
||||
continue;
|
||||
}
|
||||
// Store the compressed version only once in our map
|
||||
compressedVersions.put(imageHash, compressedImage);
|
||||
|
||||
totalImages++;
|
||||
pageImages++;
|
||||
PDImageXObject image = (PDImageXObject) xobj;
|
||||
BufferedImage bufferedImage = image.getImage();
|
||||
|
||||
int originalWidth = bufferedImage.getWidth();
|
||||
int originalHeight = bufferedImage.getHeight();
|
||||
|
||||
log.info(
|
||||
"Page {}, Image {}: Original dimensions: {}x{}",
|
||||
pageNum + 1,
|
||||
imageName,
|
||||
originalWidth,
|
||||
originalHeight);
|
||||
|
||||
// Skip if already small enough
|
||||
if (originalWidth <= MIN_WIDTH || originalHeight <= MIN_HEIGHT) {
|
||||
// Report compression stats
|
||||
double reductionPercentage =
|
||||
100.0 - ((compressedData.length * 100.0) / originalSize);
|
||||
log.info(
|
||||
"Page {}, Image {}: Skipping - below minimum dimensions threshold",
|
||||
pageNum + 1,
|
||||
imageName);
|
||||
skippedImages++;
|
||||
processedImages.add(imageName);
|
||||
continue;
|
||||
}
|
||||
"Image hash {}: Compressed from {} to {} (reduced by {}%)",
|
||||
imageHash,
|
||||
GeneralUtils.formatBytes(originalSize),
|
||||
GeneralUtils.formatBytes(compressedData.length),
|
||||
String.format("%.1f", reductionPercentage));
|
||||
|
||||
// Adjust scale factor for very large or very small images
|
||||
double adjustedScaleFactor = scaleFactor;
|
||||
if (originalWidth > 3000 || originalHeight > 3000) {
|
||||
// More aggressive for very large images
|
||||
adjustedScaleFactor = Math.min(scaleFactor, 0.75);
|
||||
log.info(
|
||||
"Page {}, Image {}: Very large image, using more aggressive scale: {}",
|
||||
pageNum + 1,
|
||||
imageName,
|
||||
adjustedScaleFactor);
|
||||
} else if (originalWidth < 1000 || originalHeight < 1000) {
|
||||
// More conservative for smaller images
|
||||
adjustedScaleFactor = Math.max(scaleFactor, 0.9);
|
||||
log.info(
|
||||
"Page {}, Image {}: Smaller image, using conservative scale: {}",
|
||||
pageNum + 1,
|
||||
imageName,
|
||||
adjustedScaleFactor);
|
||||
}
|
||||
// Replace ALL instances with the compressed version
|
||||
for (ImageReference ref : references) {
|
||||
// Get the page and resources when needed
|
||||
PDPage page = doc.getPage(ref.pageNum);
|
||||
PDResources resources = page.getResources();
|
||||
resources.put(ref.name, compressedImage);
|
||||
|
||||
int newWidth = (int) (originalWidth * adjustedScaleFactor);
|
||||
int newHeight = (int) (originalHeight * adjustedScaleFactor);
|
||||
|
||||
// Ensure minimum dimensions
|
||||
newWidth = Math.max(newWidth, MIN_WIDTH);
|
||||
newHeight = Math.max(newHeight, MIN_HEIGHT);
|
||||
|
||||
// Skip if change is negligible
|
||||
if ((double) newWidth / originalWidth > 0.95
|
||||
&& (double) newHeight / originalHeight > 0.95) {
|
||||
log.info(
|
||||
"Page {}, Image {}: Change too small, skipping compression",
|
||||
pageNum + 1,
|
||||
imageName);
|
||||
skippedImages++;
|
||||
processedImages.add(imageName);
|
||||
continue;
|
||||
}
|
||||
|
||||
log.info(
|
||||
"Page {}, Image {}: Resizing to {}x{} ({}% of original)",
|
||||
pageNum + 1,
|
||||
imageName,
|
||||
newWidth,
|
||||
newHeight,
|
||||
Math.round((newWidth * 100.0) / originalWidth));
|
||||
|
||||
// Use high quality scaling
|
||||
BufferedImage scaledImage =
|
||||
new BufferedImage(
|
||||
newWidth,
|
||||
newHeight,
|
||||
bufferedImage.getColorModel().hasAlpha()
|
||||
? BufferedImage.TYPE_INT_ARGB
|
||||
: BufferedImage.TYPE_INT_RGB);
|
||||
|
||||
Graphics2D g2d = scaledImage.createGraphics();
|
||||
g2d.setRenderingHint(
|
||||
RenderingHints.KEY_INTERPOLATION,
|
||||
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
g2d.setRenderingHint(
|
||||
RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
g2d.setRenderingHint(
|
||||
RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.drawImage(bufferedImage, 0, 0, newWidth, newHeight, null);
|
||||
g2d.dispose();
|
||||
|
||||
// Choose appropriate format and compression
|
||||
String format = bufferedImage.getColorModel().hasAlpha() ? "png" : "jpeg";
|
||||
|
||||
// First get the actual size of the original image by encoding it to the chosen
|
||||
// format
|
||||
ByteArrayOutputStream originalImageStream = new ByteArrayOutputStream();
|
||||
if (format.equals("jpeg")) {
|
||||
// Get the best available JPEG writer (prioritizes TwelveMonkeys if
|
||||
// available)
|
||||
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpeg");
|
||||
ImageWriter writer = null;
|
||||
|
||||
// Prefer TwelveMonkeys writer if available
|
||||
while (writers.hasNext()) {
|
||||
ImageWriter candidate = writers.next();
|
||||
if (candidate.getClass().getName().contains("twelvemonkeys")) {
|
||||
writer = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (writer == null) {
|
||||
writer = ImageIO.getImageWritersByFormatName("jpeg").next();
|
||||
log.info(
|
||||
"Replaced image on page {} with compressed version",
|
||||
ref.pageNum + 1);
|
||||
}
|
||||
|
||||
JPEGImageWriteParam param =
|
||||
(JPEGImageWriteParam) writer.getDefaultWriteParam();
|
||||
|
||||
// Set advanced compression parameters
|
||||
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
param.setCompressionQuality(jpegQuality);
|
||||
param.setOptimizeHuffmanTables(true); // Better compression
|
||||
param.setProgressiveMode(
|
||||
ImageWriteParam.MODE_DEFAULT); // Progressive scanning
|
||||
|
||||
// Write compressed image
|
||||
try (ImageOutputStream ios =
|
||||
ImageIO.createImageOutputStream(originalImageStream)) {
|
||||
writer.setOutput(ios);
|
||||
writer.write(null, new IIOImage(scaledImage, null, null), param);
|
||||
}
|
||||
writer.dispose();
|
||||
totalCompressedBytes += compressedData.length * references.size();
|
||||
compressedImages++;
|
||||
} else {
|
||||
ImageIO.write(bufferedImage, format, originalImageStream);
|
||||
}
|
||||
int originalEncodedSize = (int) image.getCOSObject().getLength();
|
||||
originalImageStream.close();
|
||||
|
||||
// Now compress the scaled image
|
||||
ByteArrayOutputStream compressedImageStream = new ByteArrayOutputStream();
|
||||
if (format.equals("jpeg")) {
|
||||
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(format);
|
||||
if (writers.hasNext()) {
|
||||
ImageWriter writer = writers.next();
|
||||
ImageWriteParam param = writer.getDefaultWriteParam();
|
||||
|
||||
if (param.canWriteCompressed()) {
|
||||
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
param.setCompressionQuality(jpegQuality);
|
||||
|
||||
ImageOutputStream imageOut =
|
||||
ImageIO.createImageOutputStream(compressedImageStream);
|
||||
writer.setOutput(imageOut);
|
||||
writer.write(null, new IIOImage(scaledImage, null, null), param);
|
||||
writer.dispose();
|
||||
imageOut.close();
|
||||
} else {
|
||||
ImageIO.write(scaledImage, format, compressedImageStream);
|
||||
}
|
||||
} else {
|
||||
ImageIO.write(scaledImage, format, compressedImageStream);
|
||||
}
|
||||
} else {
|
||||
ImageIO.write(scaledImage, format, compressedImageStream);
|
||||
}
|
||||
byte[] imageBytes = compressedImageStream.toByteArray();
|
||||
compressedImageStream.close();
|
||||
|
||||
// Format sizes using our utility method
|
||||
String originalSizeStr = GeneralUtils.formatBytes(originalEncodedSize);
|
||||
String compressedSizeStr = GeneralUtils.formatBytes(imageBytes.length);
|
||||
|
||||
// Calculate reduction percentage (how much smaller the new file is)
|
||||
double reductionPercentage =
|
||||
100.0 - ((imageBytes.length * 100.0) / originalEncodedSize);
|
||||
|
||||
if (imageBytes.length >= originalEncodedSize) {
|
||||
log.info(
|
||||
"Page {}, Image {}: Compressed size {} not smaller than original {}, skipping replacement",
|
||||
pageNum + 1,
|
||||
imageName,
|
||||
GeneralUtils.formatBytes(imageBytes.length),
|
||||
GeneralUtils.formatBytes(originalEncodedSize));
|
||||
|
||||
// Accumulate original size for both counters (no change)
|
||||
totalOriginalBytes += originalEncodedSize;
|
||||
totalCompressedBytes += originalEncodedSize;
|
||||
log.info("Image hash {}: Compression not beneficial, skipping", imageHash);
|
||||
totalCompressedBytes += originalSize * references.size();
|
||||
skippedImages++;
|
||||
processedImages.add(imageName);
|
||||
continue;
|
||||
}
|
||||
log.info(
|
||||
"Page {}, Image {}: Compressed from {} to {} (reduced by {}%)",
|
||||
pageNum + 1,
|
||||
imageName,
|
||||
originalSizeStr,
|
||||
compressedSizeStr,
|
||||
String.format("%.1f", reductionPercentage));
|
||||
|
||||
// Only replace if compressed size is smaller
|
||||
PDImageXObject compressedImage =
|
||||
PDImageXObject.createFromByteArray(
|
||||
doc, imageBytes, image.getCOSObject().toString());
|
||||
res.put(name, compressedImage);
|
||||
|
||||
// Update counters with compressed size
|
||||
totalOriginalBytes += originalEncodedSize;
|
||||
totalCompressedBytes += imageBytes.length;
|
||||
compressedImages++;
|
||||
processedImages.add(imageName);
|
||||
} else {
|
||||
log.info("Image hash {}: Not suitable for compression, skipping", imageHash);
|
||||
totalCompressedBytes += originalSize * references.size();
|
||||
skippedImages++;
|
||||
}
|
||||
}
|
||||
|
||||
// Log overall image compression statistics
|
||||
// Log compression statistics
|
||||
double overallImageReduction =
|
||||
totalOriginalBytes > 0
|
||||
? 100.0 - ((totalCompressedBytes * 100.0) / totalOriginalBytes)
|
||||
: 0;
|
||||
|
||||
log.info(
|
||||
"Image compression summary - Total: {}, Compressed: {}, Skipped: {}",
|
||||
totalImages,
|
||||
"Image compression summary - Total unique: {}, Compressed: {}, Skipped: {}, Duplicates: {}",
|
||||
uniqueImagesCount,
|
||||
compressedImages,
|
||||
skippedImages);
|
||||
skippedImages,
|
||||
duplicatedImages);
|
||||
log.info(
|
||||
"Total original image size: {}, compressed: {} (reduced by {:.1f}%)",
|
||||
"Total original image size: {}, compressed: {} (reduced by {}%)",
|
||||
GeneralUtils.formatBytes(totalOriginalBytes),
|
||||
GeneralUtils.formatBytes(totalCompressedBytes),
|
||||
overallImageReduction);
|
||||
String.format("%.1f", overallImageReduction));
|
||||
|
||||
// Free memory before saving
|
||||
compressedVersions.clear();
|
||||
uniqueImages.clear();
|
||||
|
||||
// Save the document
|
||||
log.info("Saving compressed PDF to {}", pdfFile.toString());
|
||||
doc.save(pdfFile.toString());
|
||||
log.info("Saving compressed PDF to {}", newCompressedPDF.toString());
|
||||
doc.save(newCompressedPDF.toString());
|
||||
|
||||
// Log overall file size reduction
|
||||
long compressedFileSize = Files.size(pdfFile);
|
||||
long compressedFileSize = Files.size(newCompressedPDF);
|
||||
double overallReduction = 100.0 - ((compressedFileSize * 100.0) / originalFileSize);
|
||||
log.info(
|
||||
"Overall PDF compression: {} → {} (reduced by {:.1f}%)",
|
||||
"Overall PDF compression: {} → {} (reduced by {}%)",
|
||||
GeneralUtils.formatBytes(originalFileSize),
|
||||
GeneralUtils.formatBytes(compressedFileSize),
|
||||
overallReduction);
|
||||
String.format("%.1f", overallReduction));
|
||||
return newCompressedPDF;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private BufferedImage convertToGrayscale(BufferedImage image) {
|
||||
BufferedImage grayImage =
|
||||
new BufferedImage(
|
||||
image.getWidth(), image.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
|
||||
|
||||
Graphics2D g = grayImage.createGraphics();
|
||||
g.drawImage(image, 0, 0, null);
|
||||
g.dispose();
|
||||
|
||||
return grayImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes and compresses an image if beneficial. Returns the processed image if compression
|
||||
* is worthwhile, null otherwise.
|
||||
*/
|
||||
private BufferedImage processAndCompressImage(
|
||||
PDImageXObject image, double scaleFactor, float jpegQuality, boolean convertToGrayscale)
|
||||
throws IOException {
|
||||
BufferedImage bufferedImage = image.getImage();
|
||||
int originalWidth = bufferedImage.getWidth();
|
||||
int originalHeight = bufferedImage.getHeight();
|
||||
|
||||
// Minimum dimensions to preserve reasonable quality
|
||||
int MIN_WIDTH = 400;
|
||||
int MIN_HEIGHT = 400;
|
||||
|
||||
log.info("Original dimensions: {}x{}", originalWidth, originalHeight);
|
||||
|
||||
// Skip if already small enough
|
||||
if ((originalWidth <= MIN_WIDTH || originalHeight <= MIN_HEIGHT) && !convertToGrayscale) {
|
||||
log.info("Skipping - below minimum dimensions threshold");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Convert to grayscale first if requested (before resizing for better quality)
|
||||
if (convertToGrayscale) {
|
||||
bufferedImage = convertToGrayscale(bufferedImage);
|
||||
log.info("Converted image to grayscale");
|
||||
}
|
||||
|
||||
// Adjust scale factor for very large or very small images
|
||||
double adjustedScaleFactor = scaleFactor;
|
||||
if (originalWidth > 3000 || originalHeight > 3000) {
|
||||
// More aggressive for very large images
|
||||
adjustedScaleFactor = Math.min(scaleFactor, 0.75);
|
||||
log.info("Very large image, using more aggressive scale: {}", adjustedScaleFactor);
|
||||
} else if (originalWidth < 1000 || originalHeight < 1000) {
|
||||
// More conservative for smaller images
|
||||
adjustedScaleFactor = Math.max(scaleFactor, 0.9);
|
||||
log.info("Smaller image, using conservative scale: {}", adjustedScaleFactor);
|
||||
}
|
||||
|
||||
int newWidth = (int) (originalWidth * adjustedScaleFactor);
|
||||
int newHeight = (int) (originalHeight * adjustedScaleFactor);
|
||||
|
||||
// Ensure minimum dimensions
|
||||
newWidth = Math.max(newWidth, MIN_WIDTH);
|
||||
newHeight = Math.max(newHeight, MIN_HEIGHT);
|
||||
|
||||
// Skip if change is negligible
|
||||
if ((double) newWidth / originalWidth > 0.95
|
||||
&& (double) newHeight / originalHeight > 0.95
|
||||
&& !convertToGrayscale) {
|
||||
log.info("Change too small, skipping compression");
|
||||
return null;
|
||||
}
|
||||
|
||||
log.info(
|
||||
"Resizing to {}x{} ({}% of original)",
|
||||
newWidth, newHeight, Math.round((newWidth * 100.0) / originalWidth));
|
||||
|
||||
BufferedImage scaledImage;
|
||||
if (convertToGrayscale) {
|
||||
// If already grayscale, maintain the grayscale format
|
||||
scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_BYTE_GRAY);
|
||||
} else {
|
||||
// Otherwise use original color model
|
||||
scaledImage =
|
||||
new BufferedImage(
|
||||
newWidth,
|
||||
newHeight,
|
||||
bufferedImage.getColorModel().hasAlpha()
|
||||
? BufferedImage.TYPE_INT_ARGB
|
||||
: BufferedImage.TYPE_INT_RGB);
|
||||
}
|
||||
Graphics2D g2d = scaledImage.createGraphics();
|
||||
g2d.setRenderingHint(
|
||||
RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.drawImage(bufferedImage, 0, 0, newWidth, newHeight, null);
|
||||
g2d.dispose();
|
||||
|
||||
return scaledImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a BufferedImage to a byte array with specified JPEG quality. Checks if compression
|
||||
* is beneficial compared to original.
|
||||
*/
|
||||
private byte[] convertToBytes(BufferedImage scaledImage, float jpegQuality) throws IOException {
|
||||
String format = scaledImage.getColorModel().hasAlpha() ? "png" : "jpeg";
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
|
||||
if ("jpeg".equals(format)) {
|
||||
// Get the best available JPEG writer
|
||||
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpeg");
|
||||
ImageWriter writer = writers.next();
|
||||
|
||||
JPEGImageWriteParam param = (JPEGImageWriteParam) writer.getDefaultWriteParam();
|
||||
|
||||
// Set compression parameters
|
||||
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
param.setCompressionQuality(jpegQuality);
|
||||
param.setOptimizeHuffmanTables(true); // Better compression
|
||||
param.setProgressiveMode(ImageWriteParam.MODE_DEFAULT); // Progressive scanning
|
||||
|
||||
// Write compressed image
|
||||
try (ImageOutputStream ios = ImageIO.createImageOutputStream(outputStream)) {
|
||||
writer.setOutput(ios);
|
||||
writer.write(null, new IIOImage(scaledImage, null, null), param);
|
||||
}
|
||||
writer.dispose();
|
||||
} else {
|
||||
ImageIO.write(scaledImage, format, outputStream);
|
||||
}
|
||||
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
/** Modified hash function to consistently identify identical image content */
|
||||
private String generateImageHash(PDImageXObject image) {
|
||||
try {
|
||||
// Create a stream for the raw stream data
|
||||
try (InputStream stream = image.getCOSObject().createRawInputStream()) {
|
||||
// Read up to first 8KB of data for the hash
|
||||
byte[] buffer = new byte[8192];
|
||||
int bytesRead = stream.read(buffer);
|
||||
if (bytesRead > 0) {
|
||||
byte[] dataToHash =
|
||||
bytesRead == buffer.length ? buffer : Arrays.copyOf(buffer, bytesRead);
|
||||
return bytesToHexString(generatMD5(dataToHash));
|
||||
}
|
||||
return "empty-stream";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error generating image hash", e);
|
||||
return "fallback-" + System.identityHashCode(image);
|
||||
}
|
||||
}
|
||||
|
||||
private String bytesToHexString(byte[] bytes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : bytes) {
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private byte[] generatMD5(byte[] data) throws IOException {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
return md.digest(data); // Get the MD5 hash of the image bytes
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("MD5 algorithm not available", e);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] generateImageMD5(PDImageXObject image) throws IOException {
|
||||
return generatMD5(ImageProcessingUtils.getImageData(image.getImage()));
|
||||
}
|
||||
|
||||
/** Generates a hash string from a byte array */
|
||||
private String generateHashFromBytes(byte[] data) {
|
||||
try {
|
||||
// Use the existing method to generate MD5 hash
|
||||
byte[] hash = generatMD5(data);
|
||||
return bytesToHexString(hash);
|
||||
} catch (Exception e) {
|
||||
log.error("Error generating hash from bytes", e);
|
||||
// Return a unique string as fallback
|
||||
return "fallback-" + System.identityHashCode(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,13 +458,14 @@ public class CompressController {
|
||||
@Operation(
|
||||
summary = "Optimize PDF file",
|
||||
description =
|
||||
"This endpoint accepts a PDF file and optimizes it based on the provided parameters. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint accepts a PDF file and optimizes it based on the provided"
|
||||
+ " parameters. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> optimizePdf(@ModelAttribute OptimizePdfRequest request)
|
||||
throws Exception {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
Integer optimizeLevel = request.getOptimizeLevel();
|
||||
String expectedOutputSizeString = request.getExpectedOutputSize();
|
||||
|
||||
Boolean convertToGrayscale = request.getGrayscale();
|
||||
if (expectedOutputSizeString == null && optimizeLevel == null) {
|
||||
throw new Exception("Both expected output size and optimize level are not specified");
|
||||
}
|
||||
@@ -400,48 +477,61 @@ public class CompressController {
|
||||
autoMode = true;
|
||||
}
|
||||
|
||||
Path tempInputFile = Files.createTempFile("input_", ".pdf");
|
||||
inputFile.transferTo(tempInputFile.toFile());
|
||||
|
||||
long inputFileSize = Files.size(tempInputFile);
|
||||
|
||||
Path tempOutputFile = null;
|
||||
byte[] pdfBytes;
|
||||
// Create initial input file
|
||||
Path originalFile = Files.createTempFile("input_", ".pdf");
|
||||
inputFile.transferTo(originalFile.toFile());
|
||||
long inputFileSize = Files.size(originalFile);
|
||||
|
||||
// Start with original as current working file
|
||||
Path currentFile = originalFile;
|
||||
|
||||
// Keep track of all temporary files for cleanup
|
||||
List<Path> tempFiles = new ArrayList<>();
|
||||
tempFiles.add(originalFile);
|
||||
|
||||
try {
|
||||
tempOutputFile = Files.createTempFile("output_", ".pdf");
|
||||
|
||||
if (autoMode) {
|
||||
double sizeReductionRatio = expectedOutputSize / (double) inputFileSize;
|
||||
optimizeLevel = determineOptimizeLevel(sizeReductionRatio);
|
||||
}
|
||||
|
||||
boolean sizeMet = false;
|
||||
boolean imageCompressionApplied = false; // Track if we've already compressed images
|
||||
boolean imageCompressionApplied = false;
|
||||
boolean qpdfCompressionApplied = false;
|
||||
|
||||
while (!sizeMet && optimizeLevel <= 9) {
|
||||
// Apply appropriate compression based on level
|
||||
|
||||
// Levels 4-9: Apply image compression
|
||||
if (optimizeLevel >= 4 && !imageCompressionApplied) {
|
||||
// Apply image compression for levels 4-9
|
||||
if ((optimizeLevel >= 4 || Boolean.TRUE.equals(convertToGrayscale))
|
||||
&& !imageCompressionApplied) {
|
||||
double scaleFactor = getScaleFactorForLevel(optimizeLevel);
|
||||
float jpegQuality = getJpegQualityForLevel(optimizeLevel);
|
||||
compressImagesInPDF(tempInputFile, scaleFactor, jpegQuality);
|
||||
imageCompressionApplied = true; // Mark that we've compressed images
|
||||
|
||||
// Use the returned path from compressImagesInPDF
|
||||
Path compressedImageFile = compressImagesInPDF(
|
||||
currentFile,
|
||||
scaleFactor,
|
||||
jpegQuality,
|
||||
Boolean.TRUE.equals(convertToGrayscale));
|
||||
|
||||
// Add to temp files list and update current file
|
||||
tempFiles.add(compressedImageFile);
|
||||
currentFile = compressedImageFile;
|
||||
imageCompressionApplied = true;
|
||||
}
|
||||
|
||||
// All levels (1-9): Apply QPDF compression
|
||||
// Apply QPDF compression for all levels
|
||||
if (!qpdfCompressionApplied) {
|
||||
long preQpdfSize = Files.size(tempInputFile);
|
||||
long preQpdfSize = Files.size(currentFile);
|
||||
log.info("Pre-QPDF file size: {}", GeneralUtils.formatBytes(preQpdfSize));
|
||||
|
||||
// For levels 1-3, map to qpdf compression levels 1-9
|
||||
int qpdfCompressionLevel = optimizeLevel;
|
||||
if (optimizeLevel <= 3) {
|
||||
qpdfCompressionLevel = optimizeLevel * 3; // Level 1->3, 2->6, 3->9
|
||||
} else {
|
||||
qpdfCompressionLevel = 9; // Max QPDF compression for levels 4-9
|
||||
}
|
||||
// Map optimization levels to QPDF compression levels
|
||||
int qpdfCompressionLevel = optimizeLevel <= 3
|
||||
? optimizeLevel * 3 // Level 1->3, 2->6, 3->9
|
||||
: 9; // Max compression for levels 4-9
|
||||
|
||||
// Create output file for QPDF
|
||||
Path qpdfOutputFile = Files.createTempFile("qpdf_output_", ".pdf");
|
||||
tempFiles.add(qpdfOutputFile);
|
||||
|
||||
// Run QPDF optimization
|
||||
List<String> command = new ArrayList<>();
|
||||
@@ -456,48 +546,50 @@ public class CompressController {
|
||||
command.add("--compression-level=" + qpdfCompressionLevel);
|
||||
command.add("--compress-streams=y");
|
||||
command.add("--object-streams=generate");
|
||||
command.add(tempInputFile.toString());
|
||||
command.add(tempOutputFile.toString());
|
||||
command.add(currentFile.toString());
|
||||
command.add(qpdfOutputFile.toString());
|
||||
|
||||
ProcessExecutorResult returnCode = null;
|
||||
try {
|
||||
returnCode =
|
||||
ProcessExecutor.getInstance(ProcessExecutor.Processes.QPDF)
|
||||
.runCommandWithOutputHandling(command);
|
||||
returnCode = ProcessExecutor.getInstance(ProcessExecutor.Processes.QPDF)
|
||||
.runCommandWithOutputHandling(command);
|
||||
qpdfCompressionApplied = true;
|
||||
|
||||
// Update current file to the QPDF output
|
||||
currentFile = qpdfOutputFile;
|
||||
|
||||
long postQpdfSize = Files.size(currentFile);
|
||||
double qpdfReduction = 100.0 - ((postQpdfSize * 100.0) / preQpdfSize);
|
||||
log.info(
|
||||
"Post-QPDF file size: {} (reduced by {}%)",
|
||||
GeneralUtils.formatBytes(postQpdfSize),
|
||||
String.format("%.1f", qpdfReduction));
|
||||
|
||||
} catch (Exception e) {
|
||||
if (returnCode != null && returnCode.getRc() != 3) {
|
||||
throw e;
|
||||
}
|
||||
// If QPDF fails, keep using the current file
|
||||
log.warn("QPDF compression failed, continuing with current file");
|
||||
}
|
||||
long postQpdfSize = Files.size(tempOutputFile);
|
||||
double qpdfReduction = 100.0 - ((postQpdfSize * 100.0) / preQpdfSize);
|
||||
log.info(
|
||||
"Post-QPDF file size: {} (reduced by {:.1f}%)",
|
||||
GeneralUtils.formatBytes(postQpdfSize), qpdfReduction);
|
||||
|
||||
} else {
|
||||
tempOutputFile = tempInputFile;
|
||||
}
|
||||
|
||||
// Check if file size is within expected size or not auto mode
|
||||
long outputFileSize = Files.size(tempOutputFile);
|
||||
long outputFileSize = Files.size(currentFile);
|
||||
if (outputFileSize <= expectedOutputSize || !autoMode) {
|
||||
sizeMet = true;
|
||||
} else {
|
||||
int newOptimizeLevel =
|
||||
incrementOptimizeLevel(
|
||||
optimizeLevel, outputFileSize, expectedOutputSize);
|
||||
int newOptimizeLevel = incrementOptimizeLevel(
|
||||
optimizeLevel, outputFileSize, expectedOutputSize);
|
||||
|
||||
// Check if we can't increase the level further
|
||||
if (newOptimizeLevel == optimizeLevel) {
|
||||
if (autoMode) {
|
||||
log.info(
|
||||
"Maximum optimization level reached without meeting target size.");
|
||||
log.info("Maximum optimization level reached without meeting target size.");
|
||||
sizeMet = true;
|
||||
}
|
||||
} else {
|
||||
// Reset image compression if moving to a new level
|
||||
// Reset flags for next iteration with higher optimization level
|
||||
imageCompressionApplied = false;
|
||||
qpdfCompressionApplied = false;
|
||||
optimizeLevel = newOptimizeLevel;
|
||||
@@ -505,26 +597,30 @@ public class CompressController {
|
||||
}
|
||||
}
|
||||
|
||||
// Read the optimized PDF file
|
||||
pdfBytes = Files.readAllBytes(tempOutputFile);
|
||||
Path finalFile = tempOutputFile;
|
||||
|
||||
// Check if optimized file is larger than the original
|
||||
if (pdfBytes.length > inputFileSize) {
|
||||
log.warn(
|
||||
"Optimized file is larger than the original. Returning the original file instead.");
|
||||
finalFile = tempInputFile;
|
||||
long finalFileSize = Files.size(currentFile);
|
||||
if (finalFileSize > inputFileSize) {
|
||||
log.warn("Optimized file is larger than the original. Using the original file instead.");
|
||||
// Use the stored reference to the original file
|
||||
currentFile = originalFile;
|
||||
}
|
||||
|
||||
String outputFilename =
|
||||
Filenames.toSimpleFileName(inputFile.getOriginalFilename())
|
||||
String outputFilename = Filenames.toSimpleFileName(inputFile.getOriginalFilename())
|
||||
.replaceFirst("[.][^.]+$", "")
|
||||
+ "_Optimized.pdf";
|
||||
|
||||
return WebResponseUtils.pdfDocToWebResponse(
|
||||
pdfDocumentFactory.load(finalFile.toFile()), outputFilename);
|
||||
pdfDocumentFactory.load(currentFile.toFile()), outputFilename);
|
||||
|
||||
} finally {
|
||||
Files.deleteIfExists(tempOutputFile);
|
||||
// Clean up all temporary files
|
||||
for (Path tempFile : tempFiles) {
|
||||
try {
|
||||
Files.deleteIfExists(tempFile);
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to delete temporary file: " + tempFile, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -34,10 +34,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class DecompressPdfController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public DecompressPdfController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public DecompressPdfController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DecompressPdfController {
|
||||
|
||||
MultipartFile file = request.getFileInput();
|
||||
|
||||
try (PDDocument document = pdfDocumentFactory.load(file.getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(file)) {
|
||||
// Process all objects in document
|
||||
processAllObjects(document);
|
||||
|
||||
|
||||
+8
-6
@@ -32,7 +32,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.ExtractImageScansRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.CheckProgramInstall;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
@@ -46,10 +46,10 @@ public class ExtractImageScansController {
|
||||
|
||||
private static final String REPLACEFIRST = "[.][^.]+$";
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ExtractImageScansController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ExtractImageScansController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,10 @@ public class ExtractImageScansController {
|
||||
@Operation(
|
||||
summary = "Extract image scans from an input file",
|
||||
description =
|
||||
"This endpoint extracts image scans from a given file based on certain parameters. Users can specify angle threshold, tolerance, minimum area, minimum contour area, and border size. Input:PDF Output:IMAGE/ZIP Type:SIMO")
|
||||
"This endpoint extracts image scans from a given file based on certain"
|
||||
+ " parameters. Users can specify angle threshold, tolerance, minimum area,"
|
||||
+ " minimum contour area, and border size. Input:PDF Output:IMAGE/ZIP"
|
||||
+ " Type:SIMO")
|
||||
public ResponseEntity<byte[]> extractImageScans(
|
||||
@RequestBody(
|
||||
description = "Form data containing file and extraction parameters",
|
||||
@@ -95,8 +98,7 @@ public class ExtractImageScansController {
|
||||
// Check if input file is a PDF
|
||||
if ("pdf".equalsIgnoreCase(extension)) {
|
||||
// Load PDF document
|
||||
try (PDDocument document =
|
||||
pdfDocumentFactory.load(form.getFileInput().getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(form.getFileInput())) {
|
||||
PDFRenderer pdfRenderer = new PDFRenderer(document);
|
||||
pdfRenderer.setSubsamplingAllowed(true);
|
||||
int pageCount = document.getNumberOfPages();
|
||||
|
||||
+7
-5
@@ -40,7 +40,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFExtractImagesRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.ImageProcessingUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -50,10 +50,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class ExtractImagesController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ExtractImagesController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ExtractImagesController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -61,13 +61,15 @@ public class ExtractImagesController {
|
||||
@Operation(
|
||||
summary = "Extract images from a PDF file",
|
||||
description =
|
||||
"This endpoint extracts images from a given PDF file and returns them in a zip file. Users can specify the output image format. Input:PDF Output:IMAGE/ZIP Type:SIMO")
|
||||
"This endpoint extracts images from a given PDF file and returns them in a zip"
|
||||
+ " file. Users can specify the output image format. Input:PDF"
|
||||
+ " Output:IMAGE/ZIP Type:SIMO")
|
||||
public ResponseEntity<byte[]> extractImages(@ModelAttribute PDFExtractImagesRequest request)
|
||||
throws IOException, InterruptedException, ExecutionException {
|
||||
MultipartFile file = request.getFileInput();
|
||||
String format = request.getFormat();
|
||||
boolean allowDuplicates = request.isAllowDuplicates();
|
||||
PDDocument document = pdfDocumentFactory.load(file.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(file);
|
||||
|
||||
// Determine if multithreading should be used based on PDF size or number of pages
|
||||
boolean useMultithreading = shouldUseMultithreading(file, document);
|
||||
|
||||
@@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.FlattenRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -35,10 +35,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class FlattenController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public FlattenController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public FlattenController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -46,11 +46,12 @@ public class FlattenController {
|
||||
@Operation(
|
||||
summary = "Flatten PDF form fields or full page",
|
||||
description =
|
||||
"Flattening just PDF form fields or converting each page to images to make text unselectable. Input:PDF, Output:PDF. Type:SISO")
|
||||
"Flattening just PDF form fields or converting each page to images to make text"
|
||||
+ " unselectable. Input:PDF, Output:PDF. Type:SISO")
|
||||
public ResponseEntity<byte[]> flatten(@ModelAttribute FlattenRequest request) throws Exception {
|
||||
MultipartFile file = request.getFileInput();
|
||||
|
||||
PDDocument document = pdfDocumentFactory.load(file.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(file);
|
||||
Boolean flattenOnlyForms = request.getFlattenOnlyForms();
|
||||
|
||||
if (Boolean.TRUE.equals(flattenOnlyForms)) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.MetadataRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
import stirling.software.SPDF.utils.propertyeditor.StringToMapPropertyEditor;
|
||||
|
||||
@@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.propertyeditor.StringToMapPropertyEditor;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class MetadataController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public MetadataController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public MetadataController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,9 @@ public class MetadataController {
|
||||
@Operation(
|
||||
summary = "Update metadata of a PDF file",
|
||||
description =
|
||||
"This endpoint allows you to update the metadata of a given PDF file. You can add, modify, or delete standard and custom metadata fields. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint allows you to update the metadata of a given PDF file. You can"
|
||||
+ " add, modify, or delete standard and custom metadata fields. Input:PDF"
|
||||
+ " Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> metadata(@ModelAttribute MetadataRequest request)
|
||||
throws IOException {
|
||||
|
||||
@@ -84,7 +86,7 @@ public class MetadataController {
|
||||
allRequestParams = new java.util.HashMap<String, String>();
|
||||
}
|
||||
// Load the PDF file into a PDDocument
|
||||
PDDocument document = pdfDocumentFactory.load(pdfFile.getBytes());
|
||||
PDDocument document = pdfDocumentFactory.load(pdfFile);
|
||||
|
||||
// Get the document information from the PDF
|
||||
PDDocumentInformation info = document.getDocumentInformation();
|
||||
|
||||
@@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.ApplicationProperties;
|
||||
import stirling.software.SPDF.model.api.misc.ProcessPdfWithOcrRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/misc")
|
||||
@@ -43,11 +43,11 @@ public class OCRController {
|
||||
|
||||
private final ApplicationProperties applicationProperties;
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
public OCRController(
|
||||
ApplicationProperties applicationProperties,
|
||||
CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.applicationProperties = applicationProperties;
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
@@ -70,7 +70,9 @@ public class OCRController {
|
||||
@Operation(
|
||||
summary = "Process PDF files with OCR using Tesseract",
|
||||
description =
|
||||
"Takes a PDF file as input, performs OCR using specified languages and OCR type (skip-text/force-ocr), and returns the processed PDF. Input:PDF Output:PDF Type:SISO")
|
||||
"Takes a PDF file as input, performs OCR using specified languages and OCR type"
|
||||
+ " (skip-text/force-ocr), and returns the processed PDF. Input:PDF"
|
||||
+ " Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> processPdfWithOCR(
|
||||
@ModelAttribute ProcessPdfWithOcrRequest request)
|
||||
throws IOException, InterruptedException {
|
||||
|
||||
+6
-4
@@ -18,7 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.OverlayImageRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.PdfUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -28,10 +28,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class OverlayImageController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public OverlayImageController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public OverlayImageController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,9 @@ public class OverlayImageController {
|
||||
@Operation(
|
||||
summary = "Overlay image onto a PDF file",
|
||||
description =
|
||||
"This endpoint overlays an image onto a PDF file at the specified coordinates. The image can be overlaid on every page of the PDF if specified. Input:PDF/IMAGE Output:PDF Type:SISO")
|
||||
"This endpoint overlays an image onto a PDF file at the specified coordinates."
|
||||
+ " The image can be overlaid on every page of the PDF if specified. "
|
||||
+ " Input:PDF/IMAGE Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> overlayImage(@ModelAttribute OverlayImageRequest request) {
|
||||
MultipartFile pdfFile = request.getFileInput();
|
||||
MultipartFile imageFile = request.getImageFile();
|
||||
|
||||
@@ -24,7 +24,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.AddPageNumbersRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class PageNumbersController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public PageNumbersController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public PageNumbersController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ public class PageNumbersController {
|
||||
@Operation(
|
||||
summary = "Add page numbers to a PDF document",
|
||||
description =
|
||||
"This operation takes an input PDF file and adds page numbers to it. Input:PDF Output:PDF Type:SISO")
|
||||
"This operation takes an input PDF file and adds page numbers to it. Input:PDF"
|
||||
+ " Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> addPageNumbers(@ModelAttribute AddPageNumbersRequest request)
|
||||
throws IOException {
|
||||
|
||||
@@ -55,8 +56,7 @@ public class PageNumbersController {
|
||||
String pagesToNumber = request.getPagesToNumber();
|
||||
String customText = request.getCustomText();
|
||||
int pageNumber = startingNumber;
|
||||
byte[] fileBytes = file.getBytes();
|
||||
PDDocument document = pdfDocumentFactory.load(fileBytes);
|
||||
PDDocument document = pdfDocumentFactory.load(file);
|
||||
float font_size = request.getFontSize();
|
||||
String font_type = request.getFontType();
|
||||
float marginFactor;
|
||||
|
||||
@@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor;
|
||||
import stirling.software.SPDF.utils.ProcessExecutor.ProcessExecutorResult;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class RepairController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public RepairController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public RepairController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ public class RepairController {
|
||||
@Operation(
|
||||
summary = "Repair a PDF file",
|
||||
description =
|
||||
"This endpoint repairs a given PDF file by running qpdf command. The PDF is first saved to a temporary location, repaired, read back, and then returned as a response. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint repairs a given PDF file by running qpdf command. The PDF is"
|
||||
+ " first saved to a temporary location, repaired, read back, and then"
|
||||
+ " returned as a response. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> repairPdf(@ModelAttribute PDFFile request)
|
||||
throws IOException, InterruptedException {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
|
||||
@@ -20,7 +20,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -28,10 +28,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class ShowJavascript {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public ShowJavascript(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public ShowJavascript(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ShowJavascript {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
String script = "";
|
||||
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputFile.getBytes())) {
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputFile)) {
|
||||
|
||||
if (document.getDocumentCatalog() != null
|
||||
&& document.getDocumentCatalog().getNames() != null) {
|
||||
|
||||
@@ -38,7 +38,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.misc.AddStampRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -46,10 +46,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class StampController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public StampController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public StampController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ public class StampController {
|
||||
@Operation(
|
||||
summary = "Add stamp to a PDF file",
|
||||
description =
|
||||
"This endpoint adds a stamp to a given PDF file. Users can specify the stamp type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint adds a stamp to a given PDF file. Users can specify the stamp"
|
||||
+ " type (text or image), rotation, opacity, width spacer, and height"
|
||||
+ " spacer. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> addStamp(@ModelAttribute AddStampRequest request)
|
||||
throws IOException, Exception {
|
||||
MultipartFile pdfFile = request.getFileInput();
|
||||
|
||||
+6
-6
@@ -68,7 +68,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.security.SignPDFWithCertRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -81,16 +81,16 @@ public class CertSignController {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public CertSignController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public CertSignController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
private static void sign(
|
||||
CustomPDDocumentFactory pdfDocumentFactory,
|
||||
byte[] input,
|
||||
CustomPDFDocumentFactory pdfDocumentFactory,
|
||||
MultipartFile input,
|
||||
OutputStream output,
|
||||
CreateSignature instance,
|
||||
Boolean showSignature,
|
||||
@@ -179,7 +179,7 @@ public class CertSignController {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
sign(
|
||||
pdfDocumentFactory,
|
||||
pdf.getBytes(),
|
||||
pdf,
|
||||
baos,
|
||||
createSignature,
|
||||
showSignature,
|
||||
|
||||
@@ -62,7 +62,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -73,10 +73,10 @@ public class GetInfoOnPDF {
|
||||
|
||||
static ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public GetInfoOnPDF(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public GetInfoOnPDF(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class GetInfoOnPDF {
|
||||
@Operation(summary = "Summary here", description = "desc. Input:PDF Output:JSON Type:SISO")
|
||||
public ResponseEntity<byte[]> getPdfInfo(@ModelAttribute PDFFile request) throws IOException {
|
||||
MultipartFile inputFile = request.getFileInput();
|
||||
try (PDDocument pdfBoxDoc = pdfDocumentFactory.load(inputFile.getBytes()); ) {
|
||||
try (PDDocument pdfBoxDoc = pdfDocumentFactory.load(inputFile); ) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
ObjectNode jsonOutput = objectMapper.createObjectNode();
|
||||
|
||||
|
||||
+8
-7
@@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.security.AddPasswordRequest;
|
||||
import stirling.software.SPDF.model.api.security.PDFPasswordRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -27,10 +27,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Security", description = "Security APIs")
|
||||
public class PasswordController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public PasswordController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public PasswordController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public class PasswordController {
|
||||
@Operation(
|
||||
summary = "Remove password from a PDF file",
|
||||
description =
|
||||
"This endpoint removes the password from a protected PDF file. Users need to provide the"
|
||||
+ " existing password. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint removes the password from a protected PDF file. Users need to"
|
||||
+ " provide the existing password. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> removePassword(@ModelAttribute PDFPasswordRequest request)
|
||||
throws IOException {
|
||||
MultipartFile fileInput = request.getFileInput();
|
||||
@@ -57,8 +57,9 @@ public class PasswordController {
|
||||
@Operation(
|
||||
summary = "Add password to a PDF file",
|
||||
description =
|
||||
"This endpoint adds password protection to a PDF file. Users can specify a set of"
|
||||
+ " permissions that should be applied to the file. Input:PDF Output:PDF")
|
||||
"This endpoint adds password protection to a PDF file. Users can specify a set"
|
||||
+ " of permissions that should be applied to the file. Input:PDF"
|
||||
+ " Output:PDF")
|
||||
public ResponseEntity<byte[]> addPassword(@ModelAttribute AddPasswordRequest request)
|
||||
throws IOException {
|
||||
MultipartFile fileInput = request.getFileInput();
|
||||
|
||||
@@ -35,7 +35,7 @@ import stirling.software.SPDF.model.api.security.ManualRedactPdfRequest;
|
||||
import stirling.software.SPDF.model.api.security.RedactPdfRequest;
|
||||
import stirling.software.SPDF.model.api.security.RedactionArea;
|
||||
import stirling.software.SPDF.pdf.TextFinder;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.GeneralUtils;
|
||||
import stirling.software.SPDF.utils.PdfUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@@ -47,10 +47,10 @@ import stirling.software.SPDF.utils.propertyeditor.StringToArrayListPropertyEdit
|
||||
@Tag(name = "Security", description = "Security APIs")
|
||||
public class RedactController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public RedactController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public RedactController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,9 @@ public class RedactController {
|
||||
@Operation(
|
||||
summary = "Redacts areas and pages in a PDF document",
|
||||
description =
|
||||
"This operation takes an input PDF file with a list of areas, page number(s)/range(s)/function(s) to redact. Input:PDF, Output:PDF, Type:SISO")
|
||||
"This operation takes an input PDF file with a list of areas, page"
|
||||
+ " number(s)/range(s)/function(s) to redact. Input:PDF, Output:PDF,"
|
||||
+ " Type:SISO")
|
||||
public ResponseEntity<byte[]> redactPDF(@ModelAttribute ManualRedactPdfRequest request)
|
||||
throws IOException {
|
||||
MultipartFile file = request.getFileInput();
|
||||
@@ -196,8 +198,8 @@ public class RedactController {
|
||||
@Operation(
|
||||
summary = "Redacts listOfText in a PDF document",
|
||||
description =
|
||||
"This operation takes an input PDF file and redacts the provided listOfText. Input:PDF,"
|
||||
+ " Output:PDF, Type:SISO")
|
||||
"This operation takes an input PDF file and redacts the provided listOfText."
|
||||
+ " Input:PDF, Output:PDF, Type:SISO")
|
||||
public ResponseEntity<byte[]> redactPdf(@ModelAttribute RedactPdfRequest request)
|
||||
throws Exception {
|
||||
MultipartFile file = request.getFileInput();
|
||||
|
||||
+5
-4
@@ -21,7 +21,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFFile;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -29,10 +29,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Security", description = "Security APIs")
|
||||
public class RemoveCertSignController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public RemoveCertSignController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public RemoveCertSignController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ public class RemoveCertSignController {
|
||||
@Operation(
|
||||
summary = "Remove digital signature from PDF",
|
||||
description =
|
||||
"This endpoint accepts a PDF file and returns the PDF file without the digital signature. Input:PDF, Output:PDF Type:SISO")
|
||||
"This endpoint accepts a PDF file and returns the PDF file without the digital"
|
||||
+ " signature. Input:PDF, Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> removeCertSignPDF(@ModelAttribute PDFFile request)
|
||||
throws Exception {
|
||||
MultipartFile pdf = request.getFileInput();
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.security.SanitizePdfRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@RestController
|
||||
@@ -33,10 +33,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Security", description = "Security APIs")
|
||||
public class SanitizeController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public SanitizeController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public SanitizeController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -35,19 +35,19 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import stirling.software.SPDF.model.api.security.SignatureValidationRequest;
|
||||
import stirling.software.SPDF.model.api.security.SignatureValidationResult;
|
||||
import stirling.software.SPDF.service.CertificateValidationService;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/security")
|
||||
@Tag(name = "Security", description = "Security APIs")
|
||||
public class ValidateSignatureController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
private final CertificateValidationService certValidationService;
|
||||
|
||||
@Autowired
|
||||
public ValidateSignatureController(
|
||||
CustomPDDocumentFactory pdfDocumentFactory,
|
||||
CustomPDFDocumentFactory pdfDocumentFactory,
|
||||
CertificateValidationService certValidationService) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
this.certValidationService = certValidationService;
|
||||
@@ -56,7 +56,8 @@ public class ValidateSignatureController {
|
||||
@Operation(
|
||||
summary = "Validate PDF Digital Signature",
|
||||
description =
|
||||
"Validates the digital signatures in a PDF file against default or custom certificates. Input:PDF Output:JSON Type:SISO")
|
||||
"Validates the digital signatures in a PDF file against default or custom"
|
||||
+ " certificates. Input:PDF Output:JSON Type:SISO")
|
||||
@PostMapping(value = "/validate-signature")
|
||||
public ResponseEntity<List<SignatureValidationResult>> validateSignature(
|
||||
@ModelAttribute SignatureValidationRequest request) throws IOException {
|
||||
|
||||
+6
-4
@@ -36,7 +36,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import stirling.software.SPDF.model.api.security.AddWatermarkRequest;
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
import stirling.software.SPDF.utils.PdfUtils;
|
||||
import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
|
||||
@@ -45,10 +45,10 @@ import stirling.software.SPDF.utils.WebResponseUtils;
|
||||
@Tag(name = "Security", description = "Security APIs")
|
||||
public class WatermarkController {
|
||||
|
||||
private final CustomPDDocumentFactory pdfDocumentFactory;
|
||||
private final CustomPDFDocumentFactory pdfDocumentFactory;
|
||||
|
||||
@Autowired
|
||||
public WatermarkController(CustomPDDocumentFactory pdfDocumentFactory) {
|
||||
public WatermarkController(CustomPDFDocumentFactory pdfDocumentFactory) {
|
||||
this.pdfDocumentFactory = pdfDocumentFactory;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,9 @@ public class WatermarkController {
|
||||
@Operation(
|
||||
summary = "Add watermark to a PDF file",
|
||||
description =
|
||||
"This endpoint adds a watermark to a given PDF file. Users can specify the watermark type (text or image), rotation, opacity, width spacer, and height spacer. Input:PDF Output:PDF Type:SISO")
|
||||
"This endpoint adds a watermark to a given PDF file. Users can specify the"
|
||||
+ " watermark type (text or image), rotation, opacity, width spacer, and"
|
||||
+ " height spacer. Input:PDF Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> addWatermark(@ModelAttribute AddWatermarkRequest request)
|
||||
throws IOException, Exception {
|
||||
MultipartFile pdfFile = request.getFileInput();
|
||||
|
||||
@@ -4,10 +4,12 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum UsernameAttribute {
|
||||
MAIL("mail"),
|
||||
EMAIL("email"),
|
||||
LOGIN("login"),
|
||||
PROFILE("profile"),
|
||||
NAME("name"),
|
||||
UID("uid"),
|
||||
USERNAME("username"),
|
||||
NICKNAME("nickname"),
|
||||
GIVEN_NAME("given_name"),
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.pdfbox.Loader;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
@@ -32,18 +30,6 @@ public class PDFWithPageNums extends PDFFile {
|
||||
requiredMode = RequiredMode.NOT_REQUIRED)
|
||||
private String pageNumbers;
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList(boolean zeroCount) {
|
||||
int pageCount = 0;
|
||||
try {
|
||||
pageCount = Loader.loadPDF(getFileInput().getBytes()).getNumberOfPages();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
log.error("exception", e);
|
||||
}
|
||||
return GeneralUtils.parsePageList(pageNumbers, pageCount, zeroCount);
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public List<Integer> getPageNumbersList(PDDocument doc, boolean oneBased) {
|
||||
int pageCount = 0;
|
||||
|
||||
+108
-59
@@ -10,9 +10,9 @@ import java.nio.file.StandardCopyOption;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.pdfbox.Loader;
|
||||
import org.apache.pdfbox.examples.util.DeletingRandomAccessFile;
|
||||
import org.apache.pdfbox.io.IOUtils;
|
||||
import org.apache.pdfbox.io.MemoryUsageSetting;
|
||||
import org.apache.pdfbox.io.RandomAccessReadBufferedFile;
|
||||
import org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction;
|
||||
import org.apache.pdfbox.io.ScratchFile;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
@@ -29,7 +29,7 @@ import stirling.software.SPDF.model.api.PDFFile;
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CustomPDDocumentFactory {
|
||||
public class CustomPDFDocumentFactory {
|
||||
|
||||
private final PdfMetadataService pdfMetadataService;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CustomPDDocumentFactory {
|
||||
// Counter for tracking temporary resources
|
||||
private static final AtomicLong tempCounter = new AtomicLong(0);
|
||||
|
||||
public CustomPDDocumentFactory(PdfMetadataService pdfMetadataService) {
|
||||
public CustomPDFDocumentFactory(PdfMetadataService pdfMetadataService) {
|
||||
this.pdfMetadataService = pdfMetadataService;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,21 @@ public class CustomPDDocumentFactory {
|
||||
return loadAdaptively(file, fileSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entry point for loading a PDF document from a Path. Automatically selects the most
|
||||
* appropriate loading strategy.
|
||||
*/
|
||||
public PDDocument load(Path path) throws IOException {
|
||||
if (path == null) {
|
||||
throw new IllegalArgumentException("File cannot be null");
|
||||
}
|
||||
|
||||
long fileSize = Files.size(path);
|
||||
log.info("Loading PDF from file, size: {}MB", fileSize / (1024 * 1024));
|
||||
|
||||
return loadAdaptively(path.toFile(), fileSize);
|
||||
}
|
||||
|
||||
/** Load a PDF from byte array with automatic optimization. */
|
||||
public PDDocument load(byte[] input) throws IOException {
|
||||
if (input == null) {
|
||||
@@ -102,16 +117,29 @@ public class CustomPDDocumentFactory {
|
||||
|
||||
// Since we don't know the size upfront, buffer to a temp file
|
||||
Path tempFile = createTempFile("pdf-stream-");
|
||||
try {
|
||||
Files.copy(input, tempFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
return loadAdaptively(tempFile.toFile(), Files.size(tempFile));
|
||||
} catch (IOException e) {
|
||||
cleanupFile(tempFile);
|
||||
throw e;
|
||||
}
|
||||
|
||||
Files.copy(input, tempFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
return loadAdaptively(tempFile.toFile(), Files.size(tempFile));
|
||||
}
|
||||
|
||||
private PDDocument loadAdaptively(Object source, long contentSize) throws IOException {
|
||||
/** Load with password from InputStream */
|
||||
public PDDocument load(InputStream input, String password) throws IOException {
|
||||
if (input == null) {
|
||||
throw new IllegalArgumentException("InputStream cannot be null");
|
||||
}
|
||||
|
||||
// Since we don't know the size upfront, buffer to a temp file
|
||||
Path tempFile = createTempFile("pdf-stream-");
|
||||
|
||||
Files.copy(input, tempFile, StandardCopyOption.REPLACE_EXISTING);
|
||||
return loadAdaptivelyWithPassword(tempFile.toFile(), Files.size(tempFile), password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the appropriate caching strategy based on file size and available memory. This
|
||||
* common method is used by both password and non-password loading paths.
|
||||
*/
|
||||
private StreamCacheCreateFunction getStreamCacheFunction(long contentSize) {
|
||||
long maxMemory = Runtime.getRuntime().maxMemory();
|
||||
long freeMemory = Runtime.getRuntime().freeMemory();
|
||||
long totalMemory = Runtime.getRuntime().totalMemory();
|
||||
@@ -129,32 +157,38 @@ public class CustomPDDocumentFactory {
|
||||
usedMemory / (1024 * 1024),
|
||||
maxMemory / (1024 * 1024));
|
||||
|
||||
// Determine caching strategy based on both file size and available memory
|
||||
StreamCacheCreateFunction cacheFunction;
|
||||
|
||||
// If free memory is critically low, always use file-based caching
|
||||
// In loadAdaptively method, replace current caching strategy decision with:
|
||||
if (freeMemoryPercent < MIN_FREE_MEMORY_PERCENTAGE
|
||||
|| actualFreeMemory < MIN_FREE_MEMORY_BYTES) {
|
||||
log.info(
|
||||
"Low memory detected ({}%), forcing file-based cache",
|
||||
String.format("%.2f", freeMemoryPercent));
|
||||
cacheFunction = createScratchFileCacheFunction(MemoryUsageSetting.setupTempFileOnly());
|
||||
return createScratchFileCacheFunction(MemoryUsageSetting.setupTempFileOnly());
|
||||
} else if (contentSize < SMALL_FILE_THRESHOLD) {
|
||||
log.info("Using memory-only cache for small document ({}KB)", contentSize / 1024);
|
||||
cacheFunction = IOUtils.createMemoryOnlyStreamCache();
|
||||
return IOUtils.createMemoryOnlyStreamCache();
|
||||
} else if (contentSize < LARGE_FILE_THRESHOLD) {
|
||||
// For medium files (10-50MB), use a mixed approach
|
||||
log.info(
|
||||
"Using mixed memory/file cache for medium document ({}MB)",
|
||||
contentSize / (1024 * 1024));
|
||||
cacheFunction =
|
||||
createScratchFileCacheFunction(MemoryUsageSetting.setupMixed(LARGE_FILE_USAGE));
|
||||
return createScratchFileCacheFunction(MemoryUsageSetting.setupMixed(LARGE_FILE_USAGE));
|
||||
} else {
|
||||
log.info("Using file-based cache for large document");
|
||||
cacheFunction = createScratchFileCacheFunction(MemoryUsageSetting.setupTempFileOnly());
|
||||
return createScratchFileCacheFunction(MemoryUsageSetting.setupTempFileOnly());
|
||||
}
|
||||
}
|
||||
|
||||
/** Update the existing loadAdaptively method to use the common function */
|
||||
private PDDocument loadAdaptively(Object source, long contentSize) throws IOException {
|
||||
// Get the appropriate caching strategy
|
||||
StreamCacheCreateFunction cacheFunction = getStreamCacheFunction(contentSize);
|
||||
|
||||
// If small handle as bytes and remove original file
|
||||
if (contentSize <= SMALL_FILE_THRESHOLD && source instanceof File file) {
|
||||
source = Files.readAllBytes(file.toPath());
|
||||
file.delete();
|
||||
}
|
||||
PDDocument document;
|
||||
if (source instanceof File file) {
|
||||
document = loadFromFile(file, contentSize, cacheFunction);
|
||||
@@ -168,6 +202,50 @@ public class CustomPDDocumentFactory {
|
||||
return document;
|
||||
}
|
||||
|
||||
/** Load a PDF with password protection using adaptive loading strategies */
|
||||
private PDDocument loadAdaptivelyWithPassword(Object source, long contentSize, String password)
|
||||
throws IOException {
|
||||
// Get the appropriate caching strategy
|
||||
StreamCacheCreateFunction cacheFunction = getStreamCacheFunction(contentSize);
|
||||
// If small handle as bytes and remove original file
|
||||
if (contentSize <= SMALL_FILE_THRESHOLD && source instanceof File file) {
|
||||
source = Files.readAllBytes(file.toPath());
|
||||
file.delete();
|
||||
}
|
||||
PDDocument document;
|
||||
if (source instanceof File file) {
|
||||
document = loadFromFileWithPassword(file, contentSize, cacheFunction, password);
|
||||
} else if (source instanceof byte[] bytes) {
|
||||
document = loadFromBytesWithPassword(bytes, contentSize, cacheFunction, password);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported source type: " + source.getClass());
|
||||
}
|
||||
|
||||
postProcessDocument(document);
|
||||
return document;
|
||||
}
|
||||
|
||||
/** Load a file with password */
|
||||
private PDDocument loadFromFileWithPassword(
|
||||
File file, long size, StreamCacheCreateFunction cache, String password)
|
||||
throws IOException {
|
||||
return Loader.loadPDF(new DeletingRandomAccessFile(file), password, null, null, cache);
|
||||
}
|
||||
|
||||
/** Load bytes with password */
|
||||
private PDDocument loadFromBytesWithPassword(
|
||||
byte[] bytes, long size, StreamCacheCreateFunction cache, String password)
|
||||
throws IOException {
|
||||
if (size >= SMALL_FILE_THRESHOLD) {
|
||||
log.info("Writing large byte array to temp file for password-protected PDF");
|
||||
Path tempFile = createTempFile("pdf-bytes-");
|
||||
|
||||
Files.write(tempFile, bytes);
|
||||
return Loader.loadPDF(tempFile.toFile(), password, null, null, cache);
|
||||
}
|
||||
return Loader.loadPDF(bytes, password, null, null, cache);
|
||||
}
|
||||
|
||||
private StreamCacheCreateFunction createScratchFileCacheFunction(MemoryUsageSetting settings) {
|
||||
return () -> {
|
||||
try {
|
||||
@@ -183,13 +261,10 @@ public class CustomPDDocumentFactory {
|
||||
removePassword(doc);
|
||||
}
|
||||
|
||||
|
||||
private PDDocument loadFromFile(File file, long size, StreamCacheCreateFunction cache)
|
||||
throws IOException {
|
||||
if (size >= EXTREMELY_LARGE_THRESHOLD) {
|
||||
log.info("Loading extremely large file via buffered access");
|
||||
return Loader.loadPDF(new RandomAccessReadBufferedFile(file), "", null, null, cache);
|
||||
}
|
||||
return Loader.loadPDF(file, "", null, null, cache);
|
||||
return Loader.loadPDF(new DeletingRandomAccessFile(file), "", null, null, cache);
|
||||
}
|
||||
|
||||
private PDDocument loadFromBytes(byte[] bytes, long size, StreamCacheCreateFunction cache)
|
||||
@@ -197,12 +272,9 @@ public class CustomPDDocumentFactory {
|
||||
if (size >= SMALL_FILE_THRESHOLD) {
|
||||
log.info("Writing large byte array to temp file");
|
||||
Path tempFile = createTempFile("pdf-bytes-");
|
||||
try {
|
||||
Files.write(tempFile, bytes);
|
||||
return Loader.loadPDF(tempFile.toFile(), "", null, null, cache);
|
||||
} finally {
|
||||
cleanupFile(tempFile);
|
||||
}
|
||||
|
||||
Files.write(tempFile, bytes);
|
||||
return loadFromFile(tempFile.toFile(), size, cache);
|
||||
}
|
||||
return Loader.loadPDF(bytes, "", null, null, cache);
|
||||
}
|
||||
@@ -225,12 +297,9 @@ public class CustomPDDocumentFactory {
|
||||
}
|
||||
} else {
|
||||
Path tempFile = createTempFile("pdf-save-");
|
||||
try {
|
||||
document.save(tempFile.toFile());
|
||||
return Files.readAllBytes(tempFile);
|
||||
} finally {
|
||||
cleanupFile(tempFile);
|
||||
}
|
||||
|
||||
document.save(tempFile.toFile());
|
||||
return Files.readAllBytes(tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,17 +327,6 @@ public class CustomPDDocumentFactory {
|
||||
return Files.createTempDirectory(prefix + tempCounter.incrementAndGet() + "-");
|
||||
}
|
||||
|
||||
/** Clean up a temporary file */
|
||||
private void cleanupFile(Path file) {
|
||||
try {
|
||||
if (Files.deleteIfExists(file)) {
|
||||
log.info("Deleted temp file: {}", file);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.info("Error deleting temp file {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
/** Create new document bytes based on an existing document */
|
||||
public byte[] createNewBytesBasedOnOldDocument(byte[] oldDocument) throws IOException {
|
||||
try (PDDocument document = load(oldDocument)) {
|
||||
@@ -339,20 +397,11 @@ public class CustomPDDocumentFactory {
|
||||
|
||||
/** Load from a MultipartFile */
|
||||
public PDDocument load(MultipartFile pdfFile) throws IOException {
|
||||
return load(pdfFile.getBytes());
|
||||
return load(pdfFile.getInputStream());
|
||||
}
|
||||
|
||||
/** Load with password from MultipartFile */
|
||||
public PDDocument load(MultipartFile fileInput, String password) throws IOException {
|
||||
return load(fileInput.getBytes(), password);
|
||||
}
|
||||
|
||||
/** Load with password from byte array */
|
||||
private PDDocument load(byte[] bytes, String password) throws IOException {
|
||||
// Since we don't have direct password support in the adaptive loader,
|
||||
// we'll need to use PDFBox's Loader directly
|
||||
PDDocument document = Loader.loadPDF(bytes, password);
|
||||
pdfMetadataService.setDefaultMetadata(document);
|
||||
return document;
|
||||
return load(fileInput.getInputStream(), password);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Locale;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -27,11 +28,11 @@ public class FileInfo {
|
||||
// Formats the file size into a human-readable string.
|
||||
public String getFormattedFileSize() {
|
||||
if (fileSize >= 1024 * 1024 * 1024) {
|
||||
return String.format("%.2f GB", fileSize / (1024.0 * 1024 * 1024));
|
||||
return String.format(Locale.US, "%.2f GB", fileSize / (1024.0 * 1024 * 1024));
|
||||
} else if (fileSize >= 1024 * 1024) {
|
||||
return String.format("%.2f MB", fileSize / (1024.0 * 1024));
|
||||
return String.format(Locale.US, "%.2f MB", fileSize / (1024.0 * 1024));
|
||||
} else if (fileSize >= 1024) {
|
||||
return String.format("%.2f KB", fileSize / 1024.0);
|
||||
return String.format(Locale.US, "%.2f KB", fileSize / 1024.0);
|
||||
} else {
|
||||
return String.format("%d Bytes", fileSize);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,15 @@ public class GeneralUtils {
|
||||
|
||||
public static File convertMultipartFileToFile(MultipartFile multipartFile) throws IOException {
|
||||
File tempFile = Files.createTempFile("temp", null).toFile();
|
||||
try (FileOutputStream os = new FileOutputStream(tempFile)) {
|
||||
os.write(multipartFile.getBytes());
|
||||
try (InputStream inputStream = multipartFile.getInputStream();
|
||||
FileOutputStream outputStream = new FileOutputStream(tempFile)) {
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
int bytesRead;
|
||||
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import io.github.pixee.security.Filenames;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.service.CustomPDDocumentFactory;
|
||||
import stirling.software.SPDF.service.CustomPDFDocumentFactory;
|
||||
|
||||
@Slf4j
|
||||
public class PdfUtils {
|
||||
@@ -127,7 +127,7 @@ public class PdfUtils {
|
||||
}
|
||||
|
||||
public static byte[] convertFromPdf(
|
||||
CustomPDDocumentFactory pdfDocumentFactory,
|
||||
CustomPDFDocumentFactory pdfDocumentFactory,
|
||||
byte[] inputStream,
|
||||
String imageType,
|
||||
ImageType colorType,
|
||||
@@ -315,7 +315,7 @@ public class PdfUtils {
|
||||
String fitOption,
|
||||
boolean autoRotate,
|
||||
String colorType,
|
||||
CustomPDDocumentFactory pdfDocumentFactory)
|
||||
CustomPDFDocumentFactory pdfDocumentFactory)
|
||||
throws IOException {
|
||||
try (PDDocument doc = pdfDocumentFactory.createNewDocument()) {
|
||||
for (MultipartFile file : files) {
|
||||
@@ -405,7 +405,7 @@ public class PdfUtils {
|
||||
}
|
||||
|
||||
public static byte[] overlayImage(
|
||||
CustomPDDocumentFactory pdfDocumentFactory,
|
||||
CustomPDFDocumentFactory pdfDocumentFactory,
|
||||
byte[] pdfBytes,
|
||||
byte[] imageBytes,
|
||||
float x,
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=إصلاح
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=قم بسحب الملفات وإفلاتها
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=قم بسحب المفات وإفلاتها هنا
|
||||
fileChooser.extractPDF=جاري الاستخراج...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Son səhifə
|
||||
sign.next=Növbəti səhifə
|
||||
sign.previous=Əvvəlki səhifə
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Bərpa Et
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Buraxılışlar
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Последна страница
|
||||
sign.next=Следваща страница
|
||||
sign.previous=Предишна стараница
|
||||
sign.maintainRatio=Превключване за поддържане на съотношението на страните
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Поправи
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Влачете и пуснете
|
||||
fileChooser.dragAndDropPDF=Влачете и пуснете PDF файл
|
||||
fileChooser.dragAndDropImage=Влачете и пуснете изображение
|
||||
fileChooser.hoveredDragAndDrop=Влачете и пуснете файл(ове) тук
|
||||
fileChooser.extractPDF=Извличане...
|
||||
|
||||
#release notes
|
||||
releases.footer=Версии
|
||||
|
||||
@@ -138,7 +138,7 @@ analytics.settings=Pots canviar la configuració de les analítiques al fitxer c
|
||||
# NAVBAR #
|
||||
#############
|
||||
navbar.favorite=Favorits
|
||||
navbar.recent=New and recently updated
|
||||
navbar.recent=Nou i recentment actualitzat
|
||||
navbar.darkmode=Mode Fosc
|
||||
navbar.language=Idiomes
|
||||
navbar.settings=Opcions
|
||||
@@ -264,221 +264,221 @@ home.searchBar=Cerca funcions...
|
||||
|
||||
home.viewPdf.title=View/Edit PDF
|
||||
home.viewPdf.desc=Visualitza, anota, afegeix text o imatges
|
||||
viewPdf.tags=view,read,annotate,text,image
|
||||
viewPdf.tags=veure,llegir,anotar,text,imatge
|
||||
|
||||
home.setFavorites=Set Favourites
|
||||
home.hideFavorites=Hide Favourites
|
||||
home.showFavorites=Show Favourites
|
||||
home.legacyHomepage=Old homepage
|
||||
home.newHomePage=Try our new homepage!
|
||||
home.alphabetical=Alphabetical
|
||||
home.globalPopularity=Global Popularity
|
||||
home.sortBy=Sort by:
|
||||
home.setFavorites=Configura els favorits
|
||||
home.hideFavorites=Amaga els favorits
|
||||
home.showFavorites=Mostra els favorits
|
||||
home.legacyHomepage=Pàgina d'inici antiga
|
||||
home.newHomePage=Prova la nostra nova pàgina d'inici!
|
||||
home.alphabetical=Alfabètic
|
||||
home.globalPopularity=Popularitat global
|
||||
home.sortBy=Ordena per:
|
||||
|
||||
home.multiTool.title=Eina Multifunció de PDF
|
||||
home.multiTool.desc=Fusiona, Rota, Reorganitza i Esborra pàgines
|
||||
multiTool.tags=Multi Tool,Multi operation,UI,click drag,front end,client side
|
||||
multiTool.tags=Eina Multifunció,operacions múltiples,UI,clic i arrossega,costat frontal,client
|
||||
|
||||
home.merge.title=Fusiona
|
||||
home.merge.desc=Fusiona fàcilment pàgines en una.
|
||||
merge.tags=merge,Page operations,Back end,server side
|
||||
home.merge.desc=Fusiona fàcilment pàgines en una sola.
|
||||
merge.tags=fusió,operacions de pàgina,backend,servidor
|
||||
|
||||
home.split.title=Divideix
|
||||
home.split.desc=Divideix PDFs en múltiples documents
|
||||
split.tags=Page operations,divide,Multi Page,cut,server side
|
||||
split.tags=operacions de pàgina,divideix,Multi-Pàgina,talla,servidor
|
||||
|
||||
home.rotate.title=Rota
|
||||
home.rotate.desc=Rota els PDFs.
|
||||
rotate.tags=server side
|
||||
rotate.tags=servidor
|
||||
|
||||
|
||||
home.imageToPdf.title=Imatge a PDF
|
||||
home.imageToPdf.desc=Converteix imatge (PNG, JPEG, GIF) a PDF.
|
||||
imageToPdf.tags=conversion,img,jpg,picture,photo
|
||||
imageToPdf.tags=conversió,img,jpg,imatge,foto
|
||||
|
||||
home.pdfToImage.title=PDF a Imatge
|
||||
home.pdfToImage.desc=Converteix PDF a imatge. (PNG, JPEG, GIF)
|
||||
pdfToImage.tags=conversion,img,jpg,picture,photo
|
||||
home.pdfToImage.desc=Converteix PDF a imatge (PNG, JPEG, GIF)
|
||||
pdfToImage.tags=conversió,img,jpg,imatge,foto
|
||||
|
||||
home.pdfOrganiser.title=Organitza
|
||||
home.pdfOrganiser.desc=Elimina/Reorganitza pàgines en qualsevol ordre
|
||||
pdfOrganiser.tags=duplex,even,odd,sort,move
|
||||
home.pdfOrganiser.desc=Elimina/reorganitza pàgines en qualsevol ordre
|
||||
pdfOrganiser.tags=duplex,parells,senars,ordenar,moure
|
||||
|
||||
|
||||
home.addImage.title=Afegir imatge a PDF
|
||||
home.addImage.desc=Afegeix imatge en un PDF (En progrés)
|
||||
addImage.tags=img,jpg,picture,photo
|
||||
home.addImage.desc=Afegeix una imatge en un PDF (en progrés)
|
||||
addImage.tags=img,jpg,imatge,foto
|
||||
|
||||
home.watermark.title=Afegir Marca d'aigua
|
||||
home.watermark.desc=Afegir Marca d'aigua personalitzada en un PDF
|
||||
watermark.tags=Text,repeating,label,own,copyright,trademark,img,jpg,picture,photo
|
||||
home.watermark.desc=Afegir una marca d'aigua personalitzada en un PDF
|
||||
watermark.tags=text,repetició,etiqueta,propia,copyright,marca registrada,img,jpg,imatge,foto
|
||||
|
||||
home.permissions.title=Canvia permissos
|
||||
home.permissions.desc=Canvia permisos del document PDF
|
||||
permissions.tags=read,write,edit,print
|
||||
home.permissions.title=Canvia permisos
|
||||
home.permissions.desc=Canvia els permisos del document PDF
|
||||
permissions.tags=lectura,escriptura,editar,imprimir
|
||||
|
||||
|
||||
home.removePages.title=Elimina
|
||||
home.removePages.desc=Elimina pàgines del document PDF.
|
||||
removePages.tags=Remove pages,delete pages
|
||||
removePages.tags=eliminar pàgines,suprimir pàgines
|
||||
|
||||
home.addPassword.title=Afegir Contrasenya
|
||||
home.addPassword.desc=Xifra document PDF amb contrasenya.
|
||||
addPassword.tags=secure,security
|
||||
home.addPassword.desc=Xifra el document PDF amb contrasenya.
|
||||
addPassword.tags=segur,seguretat
|
||||
|
||||
home.removePassword.title=Elimina Contrasenya
|
||||
home.removePassword.desc=Elimia contrasenya de document PDF.
|
||||
removePassword.tags=secure,Decrypt,security,unpassword,delete password
|
||||
home.removePassword.desc=Elimina la contrasenya del document PDF.
|
||||
removePassword.tags=segur,desencripta,seguretat,eliminar contrasenya,suprimir contrasenya
|
||||
|
||||
home.compressPdfs.title=Comprimeix
|
||||
home.compressPdfs.desc=Comprimeix PDFs per reduir la mida.
|
||||
compressPdfs.tags=squish,small,tiny
|
||||
home.compressPdfs.desc=Comprimeix PDFs per reduir-ne la mida.
|
||||
compressPdfs.tags=estrènyer,petit,minúscul
|
||||
|
||||
|
||||
home.changeMetadata.title=Canvia Metadades
|
||||
home.changeMetadata.desc=Canvia/Treu/Afegeix matadades al document PDF.
|
||||
changeMetadata.tags=Title,author,date,creation,time,publisher,producer,stats
|
||||
home.changeMetadata.desc=Canvia/Treu/Afegeix metadades al document PDF.
|
||||
changeMetadata.tags=Títol,autor,data,creació,hora,editor,productor,estadístiques
|
||||
|
||||
home.fileToPDF.title=Converteix arxiu a PDF
|
||||
home.fileToPDF.desc=Converteix qualsevol arxiu a PDF (DOCX, PNG, XLS, PPT, TXT i més)
|
||||
fileToPDF.tags=transformation,format,document,picture,slide,text,conversion,office,docs,word,excel,powerpoint
|
||||
fileToPDF.tags=transformació,format,document,imatge,diapositiva,text,conversió,oficina,docs,word,excel,powerpoint
|
||||
|
||||
home.ocr.title=Executa exploracions OCR i/o neteja escanejos
|
||||
home.ocr.desc=Neteja escanejats i detecta text d'imatges dins d'un PDF i el torna a afegir com a text.
|
||||
ocr.tags=recognition,text,image,scan,read,identify,detection,editable
|
||||
home.ocr.title=Executa OCR i neteja escaneigs
|
||||
home.ocr.desc=Neteja escanejats i detecta text d'imatges dins d'un PDF, tornant-lo a afegir com a text.
|
||||
ocr.tags=reconeixement,text,imatge,escaneig,lectura,identificació,detecció,editable
|
||||
|
||||
|
||||
home.extractImages.title=Extreu Imatges
|
||||
home.extractImages.desc=Extreu les Imatges del PDF i les desa a zip
|
||||
extractImages.tags=picture,photo,save,archive,zip,capture,grab
|
||||
home.extractImages.desc=Extreu les imatges del PDF i desa-les en un arxiu zip
|
||||
extractImages.tags=imatge,foto,desa,arxiva,zip,captura,agafa
|
||||
|
||||
home.pdfToPDFA.title=PDF a PDF/A
|
||||
home.pdfToPDFA.desc=Converteix PDF a PDF/A per desar a llarg termini.
|
||||
pdfToPDFA.tags=archive,long-term,standard,conversion,storage,preservation
|
||||
home.pdfToPDFA.desc=Converteix PDF a PDF/A per a l'emmagatzematge a llarg termini.
|
||||
pdfToPDFA.tags=arxiu,llarg termini,estàndard,conversió,emmagatzematge,preservació
|
||||
|
||||
home.PDFToWord.title=PDF a Word
|
||||
home.PDFToWord.desc=Converteix PDF a formats de Word (DOC, DOCX and ODT)
|
||||
PDFToWord.tags=doc,docx,odt,word,transformation,format,conversion,office,microsoft,docfile
|
||||
home.PDFToWord.desc=Converteix PDF a formats de Word (DOC, DOCX i ODT)
|
||||
PDFToWord.tags=doc,docx,odt,word,transformació,format,conversió,oficina,microsoft,fitxer doc
|
||||
|
||||
home.PDFToPresentation.title=PDF a Presentació
|
||||
home.PDFToPresentation.desc=Converteix PDF a formats de Presentació (PPT, PPTX i ODP)
|
||||
PDFToPresentation.tags=slides,show,office,microsoft
|
||||
home.PDFToPresentation.desc=Converteix PDF a formats de presentació (PPT, PPTX i ODP)
|
||||
PDFToPresentation.tags=diapositives,presentació,oficina,microsoft
|
||||
|
||||
home.PDFToText.title=PDF a Text/RTF
|
||||
home.PDFToText.desc=Converteix PDF a Text o format RTF
|
||||
PDFToText.tags=richformat,richtextformat,rich text format
|
||||
home.PDFToText.desc=Converteix PDF a text o format RTF
|
||||
PDFToText.tags=format ric,format de text ric,format de text enriquit
|
||||
|
||||
home.PDFToHTML.title=PDF a HTML
|
||||
home.PDFToHTML.desc=Converteix PDF a format HTML
|
||||
PDFToHTML.tags=web content,browser friendly
|
||||
PDFToHTML.tags=contingut web,compatible amb navegadors
|
||||
|
||||
|
||||
home.PDFToXML.title=PDF a XML
|
||||
home.PDFToXML.desc=Converteix PDF a format XML
|
||||
PDFToXML.tags=data-extraction,structured-content,interop,transformation,convert
|
||||
PDFToXML.tags=extracció de dades,contingut estructurat,interop,transformació,convertir
|
||||
|
||||
home.ScannerImageSplit.title=Detecta/Divideix fotos escanejades
|
||||
home.ScannerImageSplit.desc=Divideix múltiples fotos dins del PDF/foto
|
||||
ScannerImageSplit.tags=separate,auto-detect,scans,multi-photo,organize
|
||||
ScannerImageSplit.tags=separa,detecció automàtica,escaneigs,multifoto,organitzar
|
||||
|
||||
home.sign.title=Signa
|
||||
home.sign.desc=Afegeix signatura al PDF mitjançant dibuix, text o imatge
|
||||
sign.tags=authorize,initials,drawn-signature,text-sign,image-signature
|
||||
sign.tags=autoritza,inicis,signatura dibuixada,signatura de text,signatura amb imatge
|
||||
|
||||
home.flatten.title=Aplanar
|
||||
home.flatten.desc=Elimineu tots els elements i formularis interactius d'un PDF
|
||||
flatten.tags=static,deactivate,non-interactive,streamline
|
||||
home.flatten.desc=Elimina tots els elements i formularis interactius d'un PDF
|
||||
flatten.tags=estàtic,desactivar,no interactiu,simplifica
|
||||
|
||||
home.repair.title=Reparar
|
||||
home.repair.desc=Intenta reparar un PDF danyat o trencat
|
||||
repair.tags=fix,restore,correction,recover
|
||||
repair.tags=repara,restaura,correcció,recupera
|
||||
|
||||
home.removeBlanks.title=Elimina les pàgines en blanc
|
||||
home.removeBlanks.desc=Detecta i elimina les pàgines en blanc d'un document
|
||||
removeBlanks.tags=cleanup,streamline,non-content,organize
|
||||
removeBlanks.tags=neteja,simplifica,sense contingut,organitza
|
||||
|
||||
home.removeAnnotations.title=Elimina Anotacions
|
||||
home.removeAnnotations.desc=Elimina tots els comentaris/anotacions d'un PDF
|
||||
removeAnnotations.tags=comments,highlight,notes,markup,remove
|
||||
removeAnnotations.tags=comentaris,ressalta,notes,marcatge,elimina
|
||||
|
||||
home.compare.title=Compara
|
||||
home.compare.desc=Compara i mostra les diferències entre 2 documents PDF
|
||||
compare.tags=differentiate,contrast,changes,analysis
|
||||
compare.tags=diferencia,contrasta,canvis,anàlisi
|
||||
|
||||
home.certSign.title=Signa amb Certificat
|
||||
home.certSign.desc=Signa PDF amb Certificat/Clau (PEM/P12)
|
||||
certSign.tags=authentica,PEM,P12,official,encripta
|
||||
home.certSign.desc=Signa un PDF amb Certificat/Clau (PEM/P12)
|
||||
certSign.tags=autentica,PEM,P12,oficial,encripta
|
||||
|
||||
home.removeCertSign.title=Elimina Signatura de Certificat
|
||||
home.removeCertSign.desc=Elimina la signatura de certificat d'un PDF
|
||||
removeCertSign.tags=authenticate,PEM,P12,official,decrypt
|
||||
removeCertSign.tags=autentica,PEM,P12,oficial,desencripta
|
||||
|
||||
home.pageLayout.title=Disposició Multi-Pàgina
|
||||
home.pageLayout.desc=Fusiona diverses pàgines d'un document PDF en una sola pàgina
|
||||
pageLayout.tags=merge,composite,single-view,organize
|
||||
pageLayout.tags=fusió,composició,vista única,organitzar
|
||||
|
||||
home.scalePages.title=Ajusta la mida/escala de la pàgina
|
||||
home.scalePages.desc=Canvia la mida/escala de la pàgina i/o del seu contingut.
|
||||
scalePages.tags=resize,modify,dimension,adapt
|
||||
scalePages.tags=redimensionar,modificar,dimensió,adaptar
|
||||
|
||||
home.pipeline.title=Procés
|
||||
home.pipeline.desc=Executa múltiples accions en PDFs definint scripts de procés
|
||||
pipeline.tags=automate,sequence,scripted,batch-process
|
||||
pipeline.tags=automatitzar,seqüència,scriptat,procés per lots
|
||||
|
||||
home.add-page-numbers.title=Afegir Números de Pàgina
|
||||
home.add-page-numbers.desc=Afegir Números de Pàgina en una localització
|
||||
add-page-numbers.tags=pagina,etiqueta,organitza,indexa
|
||||
home.add-page-numbers.desc=Afegir números de pàgina en una localització
|
||||
add-page-numbers.tags=pàgina,etiqueta,organitza,indexa
|
||||
|
||||
home.auto-rename.title=Canvia Automàticament el Nom del Fitxer PDF
|
||||
home.auto-rename.desc=Canvia automàticament el nom d'un fitxer PDF en funció de la capçalera detectada
|
||||
auto-rename.tags=auto-detect,header-based,organize,relabel
|
||||
auto-rename.tags=autodetect,basat en capçalera,organitzar,reetiquetar
|
||||
|
||||
home.adjust-contrast.title=Ajusta Colors/Contrast
|
||||
home.adjust-contrast.desc=Ajusta Colors/Contrast, Saturació i Brillantor
|
||||
adjust-contrast.tags=color-correction,tune,modify,enhance
|
||||
home.adjust-contrast.desc=Ajusta colors/contrast, saturació i brillantor
|
||||
adjust-contrast.tags=correcció de color,ajustar,modificar,millorar
|
||||
|
||||
home.crop.title=Talla PDF
|
||||
home.crop.desc=Talla PDF per reduïr la mida (manté text!)
|
||||
crop.tags=trim,shrink,edit,shape
|
||||
home.crop.desc=Talla PDF per reduir la mida (manté el text!)
|
||||
crop.tags=retallar,reduir,editar,donar forma
|
||||
|
||||
home.autoSplitPDF.title=Divisió Automàtica de Pàgines
|
||||
home.autoSplitPDF.desc=Divideix automàticament un PDF escanejat amb un codi QR de separació de pàgines escanejades
|
||||
autoSplitPDF.tags=QR-based,separate,scan-segment,organize
|
||||
autoSplitPDF.tags=basat en QR,separar,segmentació d'escaneig,organitzar
|
||||
|
||||
home.sanitizePdf.title=Neteja
|
||||
home.sanitizePdf.desc=Elimina scripts i altres elements dels fitxers PDF
|
||||
sanitizePdf.tags=clean,secure,safe,remove-threats
|
||||
sanitizePdf.tags=netejar,segur,sense riscos,eliminar amenaces
|
||||
|
||||
home.URLToPDF.title=URL/Lloc Web a PDF
|
||||
home.URLToPDF.desc=Converteix qualsevol URL http(s) a PDF
|
||||
URLToPDF.tags=web-capture,save-page,web-to-doc,archive
|
||||
URLToPDF.tags=captura web,desa pàgina,web a document,arxiu
|
||||
|
||||
home.HTMLToPDF.title=HTML a PDF
|
||||
home.HTMLToPDF.desc=Converteix qualsevol fitxer HTML o arxiu comprimit a PDF
|
||||
HTMLToPDF.tags=markup,web-content,transformation,convert
|
||||
HTMLToPDF.tags=marcatge,contingut web,transformació,convertir
|
||||
|
||||
|
||||
home.MarkdownToPDF.title=Markdown a PDF
|
||||
home.MarkdownToPDF.desc=Converteix qualsevol fitxer Markdown a PDF
|
||||
MarkdownToPDF.tags=markup,web-content,transformation,convert
|
||||
MarkdownToPDF.tags=marcatge,contingut web,transformació,convertir
|
||||
|
||||
home.PDFToMarkdown.title=PDF to Markdown
|
||||
home.PDFToMarkdown.desc=Converts any PDF to Markdown
|
||||
PDFToMarkdown.tags=markup,web-content,transformation,convert,md
|
||||
PDFToMarkdown.tags=marcatge,contingut web,transformació,convertir,md
|
||||
|
||||
home.getPdfInfo.title=Obteniu Tota la Informació sobre el PDF
|
||||
home.getPdfInfo.desc=Recupera tota la informació possible sobre els PDFs
|
||||
getPdfInfo.tags=infomation,data,stats,statistics
|
||||
getPdfInfo.tags=informació,dades,estadístiques,estadístiques
|
||||
|
||||
|
||||
home.extractPage.title=Extreu pàgina(es)
|
||||
home.extractPage.desc=Extreu pàgines seleccionades d'un PDF
|
||||
extractPage.tags=extract
|
||||
extractPage.tags=extreure
|
||||
|
||||
|
||||
home.PdfToSinglePage.title=PDF a Una Sola Pàgina Gran
|
||||
home.PdfToSinglePage.desc=Fusiona totes les pàgines d'un PDF en una sola pàgina gran
|
||||
PdfToSinglePage.tags=single page
|
||||
PdfToSinglePage.tags=pàgina única
|
||||
|
||||
|
||||
home.showJS.title=Mostra Javascript
|
||||
@@ -487,47 +487,47 @@ showJS.tags=JS
|
||||
|
||||
home.autoRedact.title=Redacció Automàtica
|
||||
home.autoRedact.desc=Redacta automàticament (enfosqueix) text en un PDF basat en el text introduït
|
||||
autoRedact.tags=Redact,Hide,black out,black,marker,hidden
|
||||
autoRedact.tags=Redactar,Amagar,ressaltar en negre,negre,marcador,ocult
|
||||
|
||||
home.redact.title=Manual Redaction
|
||||
home.redact.desc=Redacts a PDF based on selected text, drawn shapes and/or selected page(s)
|
||||
redact.tags=Redact,Hide,black out,black,marker,hidden,manual
|
||||
home.redact.title=Redacció manual
|
||||
home.redact.desc=Redacta un PDF segons el text seleccionat, les formes dibuixades i/o les pàgines seleccionades
|
||||
redact.tags=Redactar,Amagar,ressaltar en negre,negre,marcador,ocult,manual
|
||||
|
||||
home.tableExtraxt.title=PDF a CSV
|
||||
home.tableExtraxt.desc=Extreu taules d'un PDF convertint-les a CSV
|
||||
tableExtraxt.tags=CSV,Table Extraction,extract,convert
|
||||
tableExtraxt.tags=CSV,Extracció de taules,extreure,convertir
|
||||
|
||||
|
||||
home.autoSizeSplitPDF.title=Divisió Automàtica per Mida/Quantitat
|
||||
home.autoSizeSplitPDF.desc=Divideix un únic PDF en múltiples documents basant-se en la mida, el nombre de pàgines o el nombre de documents
|
||||
autoSizeSplitPDF.tags=pdf,split,document,organization
|
||||
autoSizeSplitPDF.tags=pdf,dividir,document,organització
|
||||
|
||||
|
||||
home.overlay-pdfs.title=Superposar PDFs
|
||||
home.overlay-pdfs.desc=Superposa PDFs sobre un altre PDF
|
||||
overlay-pdfs.tags=Overlay
|
||||
overlay-pdfs.tags=Superposició
|
||||
|
||||
home.split-by-sections.title=Divideix PDF per Seccions
|
||||
home.split-by-sections.desc=Divideix cada pàgina d'un PDF en seccions horitzontals i verticals més petites
|
||||
split-by-sections.tags=Section Split, Divide, Customize
|
||||
split-by-sections.tags=Divisió per seccions,Divideix,Personalitza
|
||||
|
||||
home.AddStampRequest.title=Afegeix Segell al PDF
|
||||
home.AddStampRequest.title=Afegeix segell al PDF
|
||||
home.AddStampRequest.desc=Afegeix segells de text o imatge en ubicacions establertes
|
||||
AddStampRequest.tags=Stamp, Add image, center image, Watermark, PDF, Embed, Customize
|
||||
AddStampRequest.tags=Segell, Afegeix imatge, Centra imatge, Marca d'aigua, PDF, Insereix, Personalitza
|
||||
|
||||
|
||||
home.removeImagePdf.title=Elimina imatge
|
||||
home.removeImagePdf.desc=Elimina imatges d'un PDF per reduir la mida del fitxer
|
||||
removeImagePdf.tags=Remove Image,Page operations,Back end,server side
|
||||
removeImagePdf.tags=Elimina imatge,Operacions de pàgina,Back-end,Servidor
|
||||
|
||||
|
||||
home.splitPdfByChapters.title=Divideix PDF per Capítols
|
||||
home.splitPdfByChapters.desc=Divideix un PDF en múltiples fitxers segons la seva estructura de capítols.
|
||||
splitPdfByChapters.tags=split,chapters,bookmarks,organize
|
||||
splitPdfByChapters.tags=dividir,capítols,marcadors,organitza
|
||||
|
||||
home.validateSignature.title=Validate PDF Signature
|
||||
home.validateSignature.desc=Verify digital signatures and certificates in PDF documents
|
||||
validateSignature.tags=signature,verify,validate,pdf,certificate,digital signature,Validate Signature,Validate certificate
|
||||
home.validateSignature.title=Validar Signatura PDF
|
||||
home.validateSignature.desc=Verifica les signatures digitals i els certificats en documents PDF
|
||||
validateSignature.tags=signatura,verifica,valida,pdf,certificat,signatura digital,Validar signatura,Validar certificat
|
||||
|
||||
#replace-invert-color
|
||||
replace-color.title=Reemplaça-Inverteix-Color
|
||||
@@ -591,31 +591,31 @@ autoRedact.convertPDFToImageLabel=Converteix PDF a Imatge PDF (S'utilitza per el
|
||||
autoRedact.submitButton=Envia
|
||||
|
||||
#redact
|
||||
redact.title=Manual Redaction
|
||||
redact.header=Manual Redaction
|
||||
redact.submit=Redact
|
||||
redact.textBasedRedaction=Text based Redaction
|
||||
redact.pageBasedRedaction=Page-based Redaction
|
||||
redact.convertPDFToImageLabel=Convert PDF to PDF-Image (Used to remove text behind the box)
|
||||
redact.pageRedactionNumbers.title=Pages
|
||||
redact.pageRedactionNumbers.placeholder=(e.g. 1,2,8 or 4,7,12-16 or 2n-1)
|
||||
redact.redactionColor.title=Redaction Color
|
||||
redact.export=Export
|
||||
redact.upload=Upload
|
||||
redact.boxRedaction=Box draw redaction
|
||||
redact.title=Redacció manual
|
||||
redact.header=Redacció manual
|
||||
redact.submit=Redacta
|
||||
redact.textBasedRedaction=Redacció basada en text
|
||||
redact.pageBasedRedaction=Redacció basada en pàgines
|
||||
redact.convertPDFToImageLabel=Converteix PDF a PDF-imatge (utilitzat per eliminar text darrere del quadre)
|
||||
redact.pageRedactionNumbers.title=Pàgines
|
||||
redact.pageRedactionNumbers.placeholder=(p. ex. 1,2,8 o 4,7,12-16 o 2n-1)
|
||||
redact.redactionColor.title=Color de redacció
|
||||
redact.export=Exporta
|
||||
redact.upload=Puja
|
||||
redact.boxRedaction=Redacció amb dibuix de quadre
|
||||
redact.zoom=Zoom
|
||||
redact.zoomIn=Zoom in
|
||||
redact.zoomOut=Zoom out
|
||||
redact.nextPage=Next Page
|
||||
redact.previousPage=Previous Page
|
||||
redact.toggleSidebar=Toggle Sidebar
|
||||
redact.showThumbnails=Show Thumbnails
|
||||
redact.showDocumentOutline=Show Document Outline (double-click to expand/collapse all items)
|
||||
redact.showAttatchments=Show Attachments
|
||||
redact.showLayers=Show Layers (double-click to reset all layers to the default state)
|
||||
redact.colourPicker=Colour Picker
|
||||
redact.findCurrentOutlineItem=Find current outline item
|
||||
redact.applyChanges=Apply Changes
|
||||
redact.zoomIn=Apropa
|
||||
redact.zoomOut=Allunya
|
||||
redact.nextPage=Pàgina següent
|
||||
redact.previousPage=Pàgina anterior
|
||||
redact.toggleSidebar=Commuta la barra lateral
|
||||
redact.showThumbnails=Mostra miniatures
|
||||
redact.showDocumentOutline=Mostra l'esquema del document (doble clic per expandir/contraure tots els elements)
|
||||
redact.showAttatchments=Mostra els adjunts
|
||||
redact.showLayers=Mostra les capes (doble clic per restablir totes les capes a l'estat per defecte)
|
||||
redact.colourPicker=Selector de colors
|
||||
redact.findCurrentOutlineItem=Troba l'element actual de l'esquema
|
||||
redact.applyChanges=Aplica els canvis
|
||||
|
||||
#showJS
|
||||
showJS.title=Mostra Javascript
|
||||
@@ -647,9 +647,9 @@ getPdfInfo.downloadJson=Descarrega JSON
|
||||
#markdown-to-pdf
|
||||
MarkdownToPDF.title=Markdown To PDF
|
||||
MarkdownToPDF.header=Markdown To PDF
|
||||
MarkdownToPDF.submit=Convert
|
||||
MarkdownToPDF.help=Work in progress
|
||||
MarkdownToPDF.credit=Uses WeasyPrint
|
||||
MarkdownToPDF.submit=Converteix
|
||||
MarkdownToPDF.help=Treball en curs
|
||||
MarkdownToPDF.credit=Utilitza WeasyPrint
|
||||
|
||||
|
||||
#pdf-to-markdown
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparar
|
||||
@@ -976,42 +977,42 @@ pdfOrganiser.placeholder=(p. ex. 1,3,2 o 4-8,2,10-12 o 2n-1)
|
||||
|
||||
|
||||
#multiTool
|
||||
multiTool.title=Eina Multifunció de PDF
|
||||
multiTool.header=Eina Multifunció de PDF
|
||||
multiTool.title=Eina multifunció de PDF
|
||||
multiTool.header=Eina multifunció de PDF
|
||||
multiTool.uploadPrompts=Nom del fitxer
|
||||
multiTool.selectAll=Select All
|
||||
multiTool.deselectAll=Deselect All
|
||||
multiTool.selectPages=Page Select
|
||||
multiTool.selectedPages=Selected Pages
|
||||
multiTool.page=Page
|
||||
multiTool.deleteSelected=Delete Selected
|
||||
multiTool.downloadAll=Export
|
||||
multiTool.downloadSelected=Export Selected
|
||||
multiTool.selectAll=Selecciona-ho tot
|
||||
multiTool.deselectAll=Desselecciona-ho tot
|
||||
multiTool.selectPages=Selecció de pàgines
|
||||
multiTool.selectedPages=Pàgines seleccionades
|
||||
multiTool.page=Pàgina
|
||||
multiTool.deleteSelected=Suprimeix seleccionades
|
||||
multiTool.downloadAll=Exporta
|
||||
multiTool.downloadSelected=Exporta seleccionades
|
||||
|
||||
multiTool.insertPageBreak=Insert Page Break
|
||||
multiTool.addFile=Add File
|
||||
multiTool.rotateLeft=Rotate Left
|
||||
multiTool.rotateRight=Rotate Right
|
||||
multiTool.split=Split
|
||||
multiTool.moveLeft=Move Left
|
||||
multiTool.moveRight=Move Right
|
||||
multiTool.delete=Delete
|
||||
multiTool.dragDropMessage=Page(s) Selected
|
||||
multiTool.undo=Undo
|
||||
multiTool.redo=Redo
|
||||
multiTool.insertPageBreak=Insereix un salt de pàgina
|
||||
multiTool.addFile=Afegeix fitxer
|
||||
multiTool.rotateLeft=Gira a l'esquerra
|
||||
multiTool.rotateRight=Gira a la dreta
|
||||
multiTool.split=Divideix
|
||||
multiTool.moveLeft=Mou a l'esquerra
|
||||
multiTool.moveRight=Mou a la dreta
|
||||
multiTool.delete=Suprimeix
|
||||
multiTool.dragDropMessage=Pàgina(es) seleccionada(es)
|
||||
multiTool.undo=Desfés
|
||||
multiTool.redo=Refés
|
||||
|
||||
#decrypt
|
||||
decrypt.passwordPrompt=This file is password-protected. Please enter the password:
|
||||
decrypt.cancelled=Operation cancelled for PDF: {0}
|
||||
decrypt.noPassword=No password provided for encrypted PDF: {0}
|
||||
decrypt.invalidPassword=Please try again with the correct password.
|
||||
decrypt.invalidPasswordHeader=Incorrect password or unsupported encryption for PDF: {0}
|
||||
decrypt.unexpectedError=There was an error processing the file. Please try again.
|
||||
decrypt.serverError=Server error while decrypting: {0}
|
||||
decrypt.success=File decrypted successfully.
|
||||
decrypt.passwordPrompt=Aquest fitxer està protegit amb contrasenya. Si us plau, introdueix la contrasenya:
|
||||
decrypt.cancelled=Operació cancel·lada per al PDF: {0}
|
||||
decrypt.noPassword=No s'ha proporcionat cap contrasenya per al PDF xifrat: {0}
|
||||
decrypt.invalidPassword=Si us plau, torna-ho a intentar amb la contrasenya correcta.
|
||||
decrypt.invalidPasswordHeader=Contrasenya incorrecta o xifratge no compatible per al PDF: {0}
|
||||
decrypt.unexpectedError=S'ha produït un error en processar el fitxer. Si us plau, torna-ho a intentar.
|
||||
decrypt.serverError=Error del servidor en desxifrar: {0}
|
||||
decrypt.success=Fitxer desxifrat correctament.
|
||||
|
||||
#multiTool-advert
|
||||
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
|
||||
multiTool-advert.message=Aquesta funcionalitat també està disponible a la nostra <a href="{0}">pàgina d'eines múltiples</a>. Fes-hi una ullada per obtenir una interfície millorada per pàgina i funcions addicionals!
|
||||
|
||||
#view pdf
|
||||
viewPdf.title=View/Edit PDF
|
||||
@@ -1323,51 +1324,52 @@ splitByChapters.desc.4=Permetre Duplicats: Si està marcat, permet diversos marc
|
||||
splitByChapters.submit=Divideix PDF
|
||||
|
||||
#File Chooser
|
||||
fileChooser.click=Click
|
||||
fileChooser.or=or
|
||||
fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.click=Clica
|
||||
fileChooser.or=o
|
||||
fileChooser.dragAndDrop=Arrossega i deixa anar
|
||||
fileChooser.dragAndDropPDF=Arrossega i deixa anar un fitxer PDF
|
||||
fileChooser.dragAndDropImage=Arrossega i deixa anar un fitxer d'imatge
|
||||
fileChooser.hoveredDragAndDrop=Arrossega i deixa anar fitxer(s) aquí
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
releases.title=Release Notes
|
||||
releases.header=Release Notes
|
||||
releases.current.version=Current Release
|
||||
releases.note=Release notes are only available in English
|
||||
releases.footer=Llançaments
|
||||
releases.title=Notes de Llançament
|
||||
releases.header=Notes de Llançament
|
||||
releases.current.version=Llançament Actual
|
||||
releases.note=Les notes de llançament només estan disponibles en anglès
|
||||
|
||||
#Validate Signature
|
||||
validateSignature.title=Validate PDF Signatures
|
||||
validateSignature.header=Validate Digital Signatures
|
||||
validateSignature.selectPDF=Select signed PDF file
|
||||
validateSignature.submit=Validate Signatures
|
||||
validateSignature.results=Validation Results
|
||||
validateSignature.status=Status
|
||||
validateSignature.signer=Signer
|
||||
validateSignature.date=Date
|
||||
validateSignature.reason=Reason
|
||||
validateSignature.location=Location
|
||||
validateSignature.noSignatures=No digital signatures found in this document
|
||||
validateSignature.status.valid=Valid
|
||||
validateSignature.status.invalid=Invalid
|
||||
validateSignature.chain.invalid=Certificate chain validation failed - cannot verify signer's identity
|
||||
validateSignature.trust.invalid=Certificate not in trust store - source cannot be verified
|
||||
validateSignature.cert.expired=Certificate has expired
|
||||
validateSignature.cert.revoked=Certificate has been revoked
|
||||
validateSignature.signature.info=Signature Information
|
||||
validateSignature.signature=Signature
|
||||
validateSignature.signature.mathValid=Signature is mathematically valid BUT:
|
||||
validateSignature.selectCustomCert=Custom Certificate File X.509 (Optional)
|
||||
validateSignature.cert.info=Certificate Details
|
||||
validateSignature.cert.issuer=Issuer
|
||||
validateSignature.cert.subject=Subject
|
||||
validateSignature.cert.serialNumber=Serial Number
|
||||
validateSignature.cert.validFrom=Valid From
|
||||
validateSignature.cert.validUntil=Valid Until
|
||||
validateSignature.cert.algorithm=Algorithm
|
||||
validateSignature.cert.keySize=Key Size
|
||||
validateSignature.cert.version=Version
|
||||
validateSignature.cert.keyUsage=Key Usage
|
||||
validateSignature.cert.selfSigned=Self-Signed
|
||||
validateSignature.title=Validar Signatures PDF
|
||||
validateSignature.header=Validar Signatures Digitals
|
||||
validateSignature.selectPDF=Selecciona fitxer PDF signat
|
||||
validateSignature.submit=Validar Signatures
|
||||
validateSignature.results=Resultats de Validació
|
||||
validateSignature.status=Estat
|
||||
validateSignature.signer=Signant
|
||||
validateSignature.date=Data
|
||||
validateSignature.reason=Motiu
|
||||
validateSignature.location=Ubicació
|
||||
validateSignature.noSignatures=No s'han trobat signatures digitals en aquest document
|
||||
validateSignature.status.valid=Vàlid
|
||||
validateSignature.status.invalid=Invàlid
|
||||
validateSignature.chain.invalid=La validació de la cadena de certificats ha fallat - no es pot verificar la identitat del signant
|
||||
validateSignature.trust.invalid=El certificat no es troba en el magatzem de confiança - no es pot verificar la font
|
||||
validateSignature.cert.expired=El certificat ha expirat
|
||||
validateSignature.cert.revoked=El certificat ha estat revocat
|
||||
validateSignature.signature.info=Informació de la Signatura
|
||||
validateSignature.signature=Signatura
|
||||
validateSignature.signature.mathValid=La signatura és matemàticament vàlida, PERÒ:
|
||||
validateSignature.selectCustomCert=Fitxer de Certificat Personalitzat X.509 (Opcional)
|
||||
validateSignature.cert.info=Detalls del Certificat
|
||||
validateSignature.cert.issuer=Emissor
|
||||
validateSignature.cert.subject=Assumpte
|
||||
validateSignature.cert.serialNumber=Número de sèrie
|
||||
validateSignature.cert.validFrom=Vàlid des de
|
||||
validateSignature.cert.validUntil=Vàlid fins a
|
||||
validateSignature.cert.algorithm=Algorisme
|
||||
validateSignature.cert.keySize=Mida de la clau
|
||||
validateSignature.cert.version=Versió
|
||||
validateSignature.cert.keyUsage=Ús de la clau
|
||||
validateSignature.cert.selfSigned=Autofirmat
|
||||
validateSignature.cert.bits=bits
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Poslední stránka
|
||||
sign.next=Další stránka
|
||||
sign.previous=Předchozí stránka
|
||||
sign.maintainRatio=Přepnout zachování poměru stran
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Opravit
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Přetáhnout
|
||||
fileChooser.dragAndDropPDF=Přetáhnout PDF soubor
|
||||
fileChooser.dragAndDropImage=Přetáhnout obrázek
|
||||
fileChooser.hoveredDragAndDrop=Přetáhněte soubor(y) sem
|
||||
fileChooser.extractPDF=Extrahování...
|
||||
|
||||
#release notes
|
||||
releases.footer=Vydání
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparér
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Letzte Seite
|
||||
sign.next=Nächste Seite
|
||||
sign.previous=Vorherige Seite
|
||||
sign.maintainRatio=Seitenverhältnis beibehalten ein-/ausschalten
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparieren
|
||||
@@ -1280,15 +1281,15 @@ survey.please=Bitte nehmen Sie an unserer Umfrage teil!
|
||||
survey.disabled=(Das Umfrage-Popup wird in folgenden Updates deaktiviert, ist aber am Fuß der Seite verfügbar.)
|
||||
survey.button=Umfrage durchführen
|
||||
survey.dontShowAgain=Nicht mehr anzeigen
|
||||
survey.meeting.1=If you're using Stirling PDF at work, we'd love to speak to you. We're offering technical support sessions in exchange for a 15 minute user discovery session.
|
||||
survey.meeting.2=This is a chance to:
|
||||
survey.meeting.3=Get help with deployment, integrations, or troubleshooting
|
||||
survey.meeting.4=Provide direct feedback on performance, edge cases, and feature gaps
|
||||
survey.meeting.5=Help us refine Stirling PDF for real-world enterprise use
|
||||
survey.meeting.6=If you're interested, you can book time with our team directly. (English speaking only)
|
||||
survey.meeting.7=Looking forward to digging into your use cases and making Stirling PDF even better!
|
||||
survey.meeting.notInterested=Not a business and/or interested in a meeting?
|
||||
survey.meeting.button=Book meeting
|
||||
survey.meeting.1=Wenn Sie Stirling PDF bei der Arbeit verwenden, würden wir gerne mit Ihnen sprechen. Wir bieten technische Supportsitzungen im Austausch für eine 15-minütige Benutzereinführungssitzung an.
|
||||
survey.meeting.2=Ihr Vorteil:
|
||||
survey.meeting.3=Sie erhalten Hilfe bei der Bereitstellung, Integration oder Fehlerbehebung
|
||||
survey.meeting.4=Sie können direktes Feedback zu Leistung, Randfällen und Funktionslücken geben
|
||||
survey.meeting.5=Sie helfen Stirling PDF für den Einsatz in Unternehmen zu verbessern
|
||||
survey.meeting.6=Bei Interesse können Sie direkt einen Termin bei unserem Team buchen. (Nur englischsprachig)
|
||||
survey.meeting.7=Ich freue mich darauf, mich mit Ihren Anwendungsfällen zu befassen und Stirling PDF noch besser zu machen!
|
||||
survey.meeting.notInterested=Sie sind kein Unternehmen und/oder an einem Treffen interessiert?
|
||||
survey.meeting.button=Besprechung buchen
|
||||
|
||||
#error
|
||||
error.sorry=Entschuldigung für das Problem!
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF-Datei
|
||||
fileChooser.dragAndDropImage=Drag & Drop Bilddatei
|
||||
fileChooser.hoveredDragAndDrop=Datei(en) hierhin Ziehen & Fallenlassen
|
||||
fileChooser.extractPDF=Extrahiere...
|
||||
|
||||
#release notes
|
||||
releases.footer=Veröffentlichungen
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Τελευταία σελίδα
|
||||
sign.next=Επόμενη σελίδα
|
||||
sign.previous=Προηγούμενη σελίδα
|
||||
sign.maintainRatio=Εναλλαγή διατήρησης αναλογίας διαστάσεων
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Επιδιόρθωση
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Σύρετε & αφήστε
|
||||
fileChooser.dragAndDropPDF=Σύρετε & αφήστε αρχείο PDF
|
||||
fileChooser.dragAndDropImage=Σύρετε & αφήστε αρχείο εικόνας
|
||||
fileChooser.hoveredDragAndDrop=Σύρετε & αφήστε αρχείο(α) εδώ
|
||||
fileChooser.extractPDF=Εξαγωγή...
|
||||
|
||||
#release notes
|
||||
releases.footer=Εκδόσεις
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Repair
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Repair
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -66,7 +66,7 @@ downgradeCurrentUserLongMessage=No se puede degradar el rol del usuario actual.
|
||||
userAlreadyExistsOAuthMessage=La usuario ya existe como usuario de OAuth2.
|
||||
userAlreadyExistsWebMessage=El usuario ya existe como usuario web.
|
||||
error=Error
|
||||
oops=Ups!
|
||||
oops=¡Ups!
|
||||
help=Ayuda
|
||||
goHomepage=Ir a la página principal
|
||||
joinDiscord=Únase a nuestro servidor Discord
|
||||
@@ -81,8 +81,8 @@ page=Página
|
||||
pages=Páginas
|
||||
loading=Cargando...
|
||||
addToDoc=Agregar al Documento
|
||||
reset=Reset
|
||||
apply=Apply
|
||||
reset=Restablecer
|
||||
apply=Aplicar
|
||||
|
||||
legal.privacy=Política de Privacidad
|
||||
legal.terms=Términos y Condiciones
|
||||
@@ -143,7 +143,7 @@ navbar.darkmode=Modo oscuro
|
||||
navbar.language=Idiomas
|
||||
navbar.settings=Configuración
|
||||
navbar.allTools=Herramientas
|
||||
navbar.multiTool=Multi herramientas
|
||||
navbar.multiTool=Multi-herramientas
|
||||
navbar.search=Buscar
|
||||
navbar.sections.organize=Organizar
|
||||
navbar.sections.convertTo=Convertir a PDF
|
||||
@@ -210,7 +210,7 @@ adminUserSettings.user=Usuario
|
||||
adminUserSettings.addUser=Añadir Nuevo Usuario
|
||||
adminUserSettings.deleteUser=Eliminar Usuario
|
||||
adminUserSettings.confirmDeleteUser=¿Se debe eliminar al usuario?
|
||||
adminUserSettings.confirmChangeUserStatus=Se debe habilitar/deshabilitar el usuario?
|
||||
adminUserSettings.confirmChangeUserStatus=¿Se debe habilitar/deshabilitar el usuario?
|
||||
adminUserSettings.usernameInfo=El nombre de usuario solo puede contener letras, números y los siguientes caracteres especiales @._+- o debe ser una dirección de correo electrónico válida.
|
||||
adminUserSettings.roles=Roles
|
||||
adminUserSettings.role=Rol
|
||||
@@ -240,7 +240,7 @@ database.creationDate=Fecha de creación
|
||||
database.fileSize=Tamaño de archivo
|
||||
database.deleteBackupFile=Eliminar archivo de copia de seguridad
|
||||
database.importBackupFile=Importar archivo de copia de seguridad
|
||||
database.createBackupFile=Create Backup File
|
||||
database.createBackupFile=Crear archivo de copia de seguridad
|
||||
database.downloadBackupFile=Descargar archivo de copia de seguridad
|
||||
database.info_1=Al importar datos, es fundamental garantizar la estructura correcta. Si no está seguro de lo que está haciendo, busque consejo y apoyo de un profesional. Un error en la estructura puede causar un mal funcionamiento de la aplicación, incluyendo la imposibilidad total de ejecutar la aplicación.
|
||||
database.info_2=El nombre del archivo no importa al cargarlo. Posteriormente se le cambiará el nombre para que siga el formato backup_user_yyyyMMddHHmm.sql, lo que garantiza una convención de nomenclatura coherente.
|
||||
@@ -860,7 +860,8 @@ sign.last=Última página
|
||||
sign.next=Siguiente página
|
||||
sign.previous=Página anterior
|
||||
sign.maintainRatio=Activar/desactivar la relación de aspecto
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparar
|
||||
@@ -952,7 +953,7 @@ merge.title=Unir
|
||||
merge.header=Unir múltiples PDFs (2+)
|
||||
merge.sortByName=Ordenar por nombre
|
||||
merge.sortByDate=Ordenar por fecha
|
||||
merge.removeCertSign=Eliminar la firma digital en el archivo unido?
|
||||
merge.removeCertSign=¿Eliminar la firma digital en el archivo unido?
|
||||
merge.submit=Unir
|
||||
|
||||
|
||||
@@ -1274,27 +1275,27 @@ licenses.license=Licencia
|
||||
survey.nav=Encuesta
|
||||
survey.title=Encuesta Stirling-PDF
|
||||
survey.description=Stirling-PDF no tiene seguimiento, por lo que queremos escuchar a nuestros usuarios para mejorar Stirling-PDF.
|
||||
survey.changes=Stirling-PDF ha cambiado desde la última encuesta! Para obtener más información, revise nuestro artículo de blog aquí:
|
||||
survey.changes=¡Stirling-PDF ha cambiado desde la última encuesta! Para obtener más información, revise nuestro artículo de blog aquí:
|
||||
survey.changes2=Con estos cambios estamos obteniendo apoyo y financiamiento empresarial
|
||||
survey.please=¡Considere realizar nuestra encuesta!
|
||||
survey.disabled=(La ventana emergente de la encuesta se desactivará en las siguientes actualizaciones, pero estará disponible al pie de la página.)
|
||||
survey.button=Realizar encuesta
|
||||
survey.dontShowAgain=No volver a mostrar
|
||||
survey.meeting.1=If you're using Stirling PDF at work, we'd love to speak to you. We're offering technical support sessions in exchange for a 15 minute user discovery session.
|
||||
survey.meeting.2=This is a chance to:
|
||||
survey.meeting.3=Get help with deployment, integrations, or troubleshooting
|
||||
survey.meeting.4=Provide direct feedback on performance, edge cases, and feature gaps
|
||||
survey.meeting.5=Help us refine Stirling PDF for real-world enterprise use
|
||||
survey.meeting.6=If you're interested, you can book time with our team directly. (English speaking only)
|
||||
survey.meeting.7=Looking forward to digging into your use cases and making Stirling PDF even better!
|
||||
survey.meeting.notInterested=Not a business and/or interested in a meeting?
|
||||
survey.meeting.button=Book meeting
|
||||
survey.meeting.1=Si estás utilizando Stirling PDF en el trabajo, nos encantaría hablar contigo. Ofrecemos sesiones de soporte técnico a cambio de una sesión de descubrimiento de usuario de 15 minutos.
|
||||
survey.meeting.2=Esta es una oportunidad para:
|
||||
survey.meeting.3=Obtén ayuda con la implementación, integraciones o solución de problemas
|
||||
survey.meeting.4=Brinda comentarios directos sobre el rendimiento, casos extremos y carencias de funciones
|
||||
survey.meeting.5=Ayudanos a mejorar Stirling PDF para su uso en entornos empresariales reales
|
||||
survey.meeting.6=Si estás interesado, puedes agendar una reunión con nuestro equipo directamente. (Solo en inglés)
|
||||
survey.meeting.7=¡Esperamos conocer tus casos de uso y mejorar aún más Stirling PDF!
|
||||
survey.meeting.notInterested=¿No eres una empresa o no estás interesado en una reunión?
|
||||
survey.meeting.button=Reservar reunión
|
||||
|
||||
#error
|
||||
error.sorry=¡Perdón por el fallo!
|
||||
error.needHelp=Necesita ayuda / Encontró un fallo?
|
||||
error.needHelp=¿Necesita ayuda / Encontró un fallo?
|
||||
error.contactTip=Si sigue experimentando errores, no dude en contactarnos para solicitar soporte. Puede enviarnos un ticket en la página de GitHub o contactarnos mediante Discord:
|
||||
error.404.head=404 - Página no encontrada | Ups, tropezamos con el código!
|
||||
error.404.head=404 - Página no encontrada | Ups, ¡algo salió mal!
|
||||
error.404.1=Parece que no podemos encontrar la página que está buscando.
|
||||
error.404.2=Algo salió mal
|
||||
error.github=Envíe un ticket en GitHub
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Arrastrar & Soltar
|
||||
fileChooser.dragAndDropPDF=Arrastrar & Soltar archivo PDF
|
||||
fileChooser.dragAndDropImage=Arrastrar & Soltar archivo de Imagen
|
||||
fileChooser.hoveredDragAndDrop=Arrastrar & Soltar archivos(s) aquí
|
||||
fileChooser.extractPDF=Extrayendo...
|
||||
|
||||
#release notes
|
||||
releases.footer=Versiones
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Konpondu
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=صفحه آخر
|
||||
sign.next=صفحه بعدی
|
||||
sign.previous=صفحه قبلی
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=تعمیر
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=بکشید و رها کنید
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=فایل(های) خود را اینجا بکشید و رها کنید
|
||||
fileChooser.extractPDF=در حال استخراج...
|
||||
|
||||
#release notes
|
||||
releases.footer=نسخهها
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Dernière page
|
||||
sign.next=Page suivante
|
||||
sign.previous=Page précédente
|
||||
sign.maintainRatio=Conserver les proportions
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Réparer
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Glisser & Déposer
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Glisser & Déposer le(s) fichier(s) ici
|
||||
fileChooser.extractPDF=Extraction en cours...
|
||||
|
||||
#release notes
|
||||
releases.footer=Versions
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=An leathanach deiridh
|
||||
sign.next=An chéad leathanach eile
|
||||
sign.previous=Leathanach roimhe seo
|
||||
sign.maintainRatio=Scoránaigh, coinnigh an cóimheas gné
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Deisiúchán
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Tarraing & Scaoil
|
||||
fileChooser.dragAndDropPDF=Tarraing & Scaoil comhad PDF
|
||||
fileChooser.dragAndDropImage=Tarraing & Scaoil comhad Íomhá
|
||||
fileChooser.hoveredDragAndDrop=Tarraing agus scaoil comhad(í) anseo
|
||||
fileChooser.extractPDF=Ag Aistriú...
|
||||
|
||||
#release notes
|
||||
releases.footer=Eisiúintí
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=अंतिम पृष्ठ
|
||||
sign.next=अगला पृष्ठ
|
||||
sign.previous=पिछला पृष्ठ
|
||||
sign.maintainRatio=आनुपातिक अनुपात बनाए रखें टॉगल करें
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=मरम्मत
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=खींचें और छोड़ें
|
||||
fileChooser.dragAndDropPDF=PDF फ़ाइल खींचें और छोड़ें
|
||||
fileChooser.dragAndDropImage=छवि फ़ाइल खींचें और छोड़ें
|
||||
fileChooser.hoveredDragAndDrop=फ़ाइल(ें) यहाँ खींचें और छोड़ें
|
||||
fileChooser.extractPDF=निकालना...
|
||||
|
||||
#release notes
|
||||
releases.footer=रिलीज़
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Popravi
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Utolsó oldal
|
||||
sign.next=Következő oldal
|
||||
sign.previous=Előző oldal
|
||||
sign.maintainRatio=Képarány fenntartása váltása
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Javítás
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Húzza ide
|
||||
fileChooser.dragAndDropPDF=Húzza ide a PDF fájlt
|
||||
fileChooser.dragAndDropImage=Húzza ide a képfájlt
|
||||
fileChooser.hoveredDragAndDrop=Húzza ide a fájl(oka)t
|
||||
fileChooser.extractPDF=Kinyerés...
|
||||
|
||||
#release notes
|
||||
releases.footer=Kiadási jegyzék
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Perbaiki
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Ultima pagina
|
||||
sign.next=Prossima pagina
|
||||
sign.previous=Pagina precedente
|
||||
sign.maintainRatio=Attiva il mantenimento delle proporzioni
|
||||
|
||||
sign.undo=Annulla
|
||||
sign.redo=Rifare
|
||||
|
||||
#repair
|
||||
repair.title=Ripara
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Trascina & Rilascia
|
||||
fileChooser.dragAndDropPDF=Trascina & rilascia il file PDF
|
||||
fileChooser.dragAndDropImage=Trascina & rilascia il file immagine
|
||||
fileChooser.hoveredDragAndDrop=Trascina & rilascia i file qui
|
||||
fileChooser.extractPDF=Estraendo...
|
||||
|
||||
#release notes
|
||||
releases.footer=Rilasci
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=最後のページ
|
||||
sign.next=次のページ
|
||||
sign.previous=前のページ
|
||||
sign.maintainRatio=アスペクト比を維持を切替え
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=修復
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=ドラッグ&ドロップ
|
||||
fileChooser.dragAndDropPDF=PDFファイルをドラッグ&ドロップ
|
||||
fileChooser.dragAndDropImage=画像ファイルをドラッグ&ドロップ
|
||||
fileChooser.hoveredDragAndDrop=ファイルをここにドラッグ&ドロップ
|
||||
fileChooser.extractPDF=抽出中...
|
||||
|
||||
#release notes
|
||||
releases.footer=リリース
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=마지막 페이지
|
||||
sign.next=다음 페이지
|
||||
sign.previous=이전 페이지
|
||||
sign.maintainRatio=종횡비 유지 토글
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=복구
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=드래그 앤 드롭
|
||||
fileChooser.dragAndDropPDF=PDF 파일을 드래그 앤 드롭
|
||||
fileChooser.dragAndDropImage=이미지 파일을 드래그 앤 드롭
|
||||
fileChooser.hoveredDragAndDrop=여기에 파일을 드래그 앤 드롭하세요
|
||||
fileChooser.extractPDF=추출 중...
|
||||
|
||||
#release notes
|
||||
releases.footer=릴리스
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Repareren
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparer
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Napraw
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Última página
|
||||
sign.next=Próxima página
|
||||
sign.previous=Página anterior
|
||||
sign.maintainRatio=Habilitar manter proporção
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparar
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Arraste & Solte
|
||||
fileChooser.dragAndDropPDF=Arraste & Solte PDF(s)
|
||||
fileChooser.dragAndDropImage=Arraste & Solte Imagem(ns)
|
||||
fileChooser.hoveredDragAndDrop=Arraste & Solte arquivo(s) aqui
|
||||
fileChooser.extractPDF=Extraindo...
|
||||
|
||||
#release notes
|
||||
releases.footer=Versões
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Última página
|
||||
sign.next=Próxima página
|
||||
sign.previous=Página anterior
|
||||
sign.maintainRatio=Alternar manter proporção
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Reparar
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Arrastar e Largar
|
||||
fileChooser.dragAndDropPDF=Arrastar e Largar ficheiro PDF
|
||||
fileChooser.dragAndDropImage=Arrastar e Largar ficheiro de Imagem
|
||||
fileChooser.hoveredDragAndDrop=Arrastar e Largar ficheiro(s) aqui
|
||||
fileChooser.extractPDF=Extraindo...
|
||||
|
||||
#release notes
|
||||
releases.footer=Lançamentos
|
||||
|
||||
@@ -860,7 +860,8 @@ sign.last=Last page
|
||||
sign.next=Next page
|
||||
sign.previous=Previous page
|
||||
sign.maintainRatio=Toggle maintain aspect ratio
|
||||
|
||||
sign.undo=Undo
|
||||
sign.redo=Redo
|
||||
|
||||
#repair
|
||||
repair.title=Repară
|
||||
@@ -1329,6 +1330,7 @@ fileChooser.dragAndDrop=Drag & Drop
|
||||
fileChooser.dragAndDropPDF=Drag & Drop PDF file
|
||||
fileChooser.dragAndDropImage=Drag & Drop Image file
|
||||
fileChooser.hoveredDragAndDrop=Drag & Drop file(s) here
|
||||
fileChooser.extractPDF=Extracting...
|
||||
|
||||
#release notes
|
||||
releases.footer=Releases
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user