Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0a1adef8f | ||
|
|
4d1af9ad3f | ||
|
|
a5e21bc35c | ||
|
|
e8d8aa8f46 | ||
|
|
9d21bf002e | ||
|
|
cf560b7488 | ||
|
|
19d9f0fdc2 | ||
|
|
b49e681f16 | ||
|
|
9970d5a7f2 | ||
|
|
7aae124236 | ||
|
|
2c1d93887a | ||
|
|
bd383fb1e7 | ||
|
|
458cb7fab4 | ||
|
|
a97f5e5257 | ||
|
|
8247156f96 | ||
|
|
a58c69016b | ||
|
|
c74f71af3a | ||
|
|
5d40fcf49f | ||
|
|
b7d4995042 | ||
|
|
c13b32fab3 | ||
|
|
90fea2ba9d | ||
|
|
338afbc8f3 | ||
|
|
f753cbb477 | ||
|
|
ded2edcfc5 | ||
|
|
2239e9cc2d | ||
|
|
0da1ae06d9 | ||
|
|
aad1b06324 | ||
|
|
246d7a7b16 | ||
|
|
eef02108c9 | ||
|
|
5d8827e4aa | ||
|
|
3bc8ae1cf2 | ||
|
|
7220db0ac2 | ||
|
|
4272edc89d | ||
|
|
84c0962b4c | ||
|
|
2d8113b3f6 | ||
|
|
3ed62c8dbf | ||
|
|
5fadb92f51 | ||
|
|
559ba3ccab | ||
|
|
addaf797cb | ||
|
|
08e58349dc | ||
|
|
a1b69b4b8b | ||
|
|
a7f17947df | ||
|
|
b4e33002b6 | ||
|
|
9c1358157b | ||
|
|
e2ba4cf693 | ||
|
|
f645eaff18 | ||
|
|
6db66f1f1a | ||
|
|
abbfde0756 | ||
|
|
de05d38a47 | ||
|
|
9b27499763 | ||
|
|
e915e1aa7d | ||
|
|
a6bee1436f | ||
|
|
5a5bab8f63 | ||
|
|
d4c702f96c | ||
|
|
d4e95a6ed7 | ||
|
|
bbcb23ca11 | ||
|
|
ec0ae36a82 | ||
|
|
b5da272dbd | ||
|
|
732b60b246 | ||
|
|
3e5c7abfab | ||
|
|
d79cd76b56 | ||
|
|
efaec14e08 | ||
|
|
29e8270eea | ||
|
|
a00245c920 | ||
|
|
0d9321e6a1 | ||
|
|
c7c5613c13 | ||
|
|
af19a5af23 | ||
|
|
930c68c8c5 | ||
|
|
716fb3bbde | ||
|
|
4d9cf45009 | ||
|
|
5780b3a119 | ||
|
|
ece4641432 |
@@ -0,0 +1,81 @@
|
||||
name: Push Docker Image - V2 Demo (Unified)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- demo
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
java-version: "21"
|
||||
distribution: "temurin"
|
||||
|
||||
- uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
|
||||
with:
|
||||
gradle-version: 8.14
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
|
||||
- name: Get version number
|
||||
id: versionNumber
|
||||
run: echo "versionNumber=$(./gradlew printVersion --quiet | tail -1)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_API }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Generate tags
|
||||
id: meta
|
||||
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
|
||||
with:
|
||||
images: |
|
||||
${{ secrets.DOCKER_HUB_ORG_USERNAME }}/stirling-pdf
|
||||
tags: |
|
||||
type=raw,value=v2-demo
|
||||
|
||||
- name: Build and push Unified Dockerfile (v2-demo)
|
||||
id: build-push-demo
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
file: ./docker/Dockerfile.unified
|
||||
push: true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }}
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
provenance: true
|
||||
sbom: true
|
||||
@@ -14,7 +14,7 @@ on:
|
||||
- macos
|
||||
- linux
|
||||
pull_request:
|
||||
branches: [main, V2, V2-tauri-windows]
|
||||
branches: [main, V2]
|
||||
paths:
|
||||
- 'frontend/src-tauri/**'
|
||||
- 'frontend/src/desktop/**'
|
||||
@@ -61,9 +61,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.determine-matrix.outputs.matrix) }}
|
||||
runs-on: ${{ matrix.platform }}
|
||||
env:
|
||||
SM_API_KEY: ${{ secrets.SM_API_KEY }}
|
||||
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||
@@ -92,6 +89,8 @@ jobs:
|
||||
toolchain: stable
|
||||
targets: ${{ (matrix.platform == 'macos-15' || matrix.platform == 'macos-15-intel') && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
|
||||
with:
|
||||
@@ -175,84 +174,6 @@ jobs:
|
||||
working-directory: ./frontend
|
||||
run: npm install
|
||||
|
||||
# DigiCert KeyLocker Setup (Cloud HSM)
|
||||
- name: Setup DigiCert KeyLocker
|
||||
id: digicert-setup
|
||||
if: ${{ matrix.platform == 'windows-latest' && env.SM_API_KEY != '' && github.ref == 'refs/heads/main' }}
|
||||
uses: digicert/ssm-code-signing@v1.1.0
|
||||
env:
|
||||
SM_API_KEY: ${{ secrets.SM_API_KEY }}
|
||||
SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
|
||||
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
|
||||
SM_KEYPAIR_ALIAS: ${{ secrets.SM_KEYPAIR_ALIAS }}
|
||||
SM_HOST: ${{ secrets.SM_HOST }}
|
||||
|
||||
- name: Setup DigiCert KeyLocker Certificate
|
||||
if: ${{ matrix.platform == 'windows-latest' && env.SM_API_KEY != '' && github.ref == 'refs/heads/main' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "Setting up DigiCert KeyLocker environment..."
|
||||
|
||||
# Decode client certificate
|
||||
$certBytes = [Convert]::FromBase64String("${{ secrets.SM_CLIENT_CERT_FILE_B64 }}")
|
||||
$certPath = "D:\Certificate_pkcs12.p12"
|
||||
[IO.File]::WriteAllBytes($certPath, $certBytes)
|
||||
|
||||
# Set environment variables
|
||||
echo "SM_CLIENT_CERT_FILE=D:\Certificate_pkcs12.p12" >> $env:GITHUB_ENV
|
||||
echo "SM_HOST=${{ secrets.SM_HOST }}" >> $env:GITHUB_ENV
|
||||
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> $env:GITHUB_ENV
|
||||
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> $env:GITHUB_ENV
|
||||
echo "SM_KEYPAIR_ALIAS=${{ secrets.SM_KEYPAIR_ALIAS }}" >> $env:GITHUB_ENV
|
||||
|
||||
# Get PKCS11 config path from DigiCert action
|
||||
$pkcs11Config = $env:PKCS11_CONFIG
|
||||
if ($pkcs11Config) {
|
||||
Write-Host "Found PKCS11_CONFIG: $pkcs11Config"
|
||||
echo "PKCS11_CONFIG=$pkcs11Config" >> $env:GITHUB_ENV
|
||||
} else {
|
||||
Write-Host "PKCS11_CONFIG not set by DigiCert action, using default path"
|
||||
$defaultPath = "C:\Users\RUNNER~1\AppData\Local\Temp\smtools-windows-x64\pkcs11properties.cfg"
|
||||
if (Test-Path $defaultPath) {
|
||||
Write-Host "Found config at default path: $defaultPath"
|
||||
echo "PKCS11_CONFIG=$defaultPath" >> $env:GITHUB_ENV
|
||||
} else {
|
||||
Write-Host "Warning: Could not find PKCS11 config file"
|
||||
}
|
||||
}
|
||||
|
||||
# Traditional PFX Certificate Import (fallback if KeyLocker not configured)
|
||||
- name: Import Windows Code Signing Certificate
|
||||
if: ${{ matrix.platform == 'windows-latest' && env.SM_API_KEY == '' && github.ref == 'refs/heads/main' }}
|
||||
env:
|
||||
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
|
||||
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
||||
shell: powershell
|
||||
run: |
|
||||
if ($env:WINDOWS_CERTIFICATE) {
|
||||
Write-Host "Importing Windows Code Signing Certificate..."
|
||||
|
||||
# Decode base64 certificate and save to file
|
||||
$certBytes = [Convert]::FromBase64String($env:WINDOWS_CERTIFICATE)
|
||||
$certPath = Join-Path $env:RUNNER_TEMP "certificate.pfx"
|
||||
[IO.File]::WriteAllBytes($certPath, $certBytes)
|
||||
|
||||
# Import certificate to CurrentUser\My store
|
||||
$cert = Import-PfxCertificate -FilePath $certPath -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -AsPlainText -Force)
|
||||
|
||||
# Extract and set thumbprint as environment variable
|
||||
$thumbprint = $cert.Thumbprint
|
||||
Write-Host "Certificate imported with thumbprint: $thumbprint"
|
||||
echo "WINDOWS_CERTIFICATE_THUMBPRINT=$thumbprint" >> $env:GITHUB_ENV
|
||||
|
||||
# Clean up certificate file
|
||||
Remove-Item $certPath
|
||||
|
||||
Write-Host "Windows certificate import completed."
|
||||
} else {
|
||||
Write-Host "⚠️ WINDOWS_CERTIFICATE secret not set - building unsigned binary"
|
||||
}
|
||||
|
||||
- name: Import Apple Developer Certificate
|
||||
if: matrix.platform == 'macos-15' || matrix.platform == 'macos-15-intel'
|
||||
env:
|
||||
@@ -308,177 +229,13 @@ jobs:
|
||||
APPLE_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
APPIMAGETOOL_SIGN_PASSPHRASE: ${{ secrets.APPIMAGETOOL_SIGN_PASSPHRASE }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY: ${{ secrets.VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY }}
|
||||
VITE_SAAS_SERVER_URL: ${{ secrets.VITE_SAAS_SERVER_URL }}
|
||||
# Only enable Windows signing in Tauri when on main
|
||||
SIGN: ${{ github.ref == 'refs/heads/main' && (env.SM_API_KEY == '' && env.WINDOWS_CERTIFICATE != '') && '1' || '0' }}
|
||||
SIGN: 1
|
||||
CI: true
|
||||
with:
|
||||
projectPath: ./frontend
|
||||
tauriScript: npx tauri
|
||||
args: ${{ matrix.args }}
|
||||
|
||||
# Sign with DigiCert KeyLocker (post-build)
|
||||
- name: Sign Windows binaries with DigiCert KeyLocker
|
||||
if: ${{ matrix.platform == 'windows-latest' && env.SM_API_KEY != '' && github.ref == 'refs/heads/main' }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "=== DigiCert KeyLocker Signing ==="
|
||||
|
||||
# Test smctl connectivity first
|
||||
Write-Host "Testing smctl connection..."
|
||||
$healthCheck = & smctl healthcheck 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "[SUCCESS] Connected to DigiCert KeyLocker"
|
||||
} else {
|
||||
Write-Host "[ERROR] Failed to connect to DigiCert KeyLocker"
|
||||
Write-Host $healthCheck
|
||||
exit 1
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
# Sync certificates to Windows certificate store
|
||||
Write-Host "Syncing certificates to Windows certificate store..."
|
||||
$syncOutput = & smctl windows certsync 2>&1
|
||||
Write-Host "Cert sync result: $syncOutput"
|
||||
Write-Host ""
|
||||
|
||||
# List available certificates and check if they have certificates attached
|
||||
Write-Host "Checking for available certificates..."
|
||||
$certList = & smctl keypair ls 2>&1
|
||||
Write-Host "Keypair list output:"
|
||||
Write-Host $certList
|
||||
Write-Host ""
|
||||
|
||||
# Parse the output to check certificate status
|
||||
$lines = $certList -split "`n"
|
||||
$foundKeypair = $false
|
||||
$hasCertificate = $false
|
||||
|
||||
foreach ($line in $lines) {
|
||||
if ($line -match "${{ secrets.SM_KEYPAIR_ALIAS }}") {
|
||||
$foundKeypair = $true
|
||||
Write-Host "[SUCCESS] Found keypair in list"
|
||||
|
||||
# Check if this line has certificate info (not just empty spaces after alias)
|
||||
$parts = $line -split "\s+"
|
||||
if ($parts.Count -gt 2 -and $parts[1] -ne "" -and $parts[1] -ne "CERTIFICATE") {
|
||||
$hasCertificate = $true
|
||||
Write-Host "[SUCCESS] Certificate is associated with keypair"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $foundKeypair) {
|
||||
Write-Host "[ERROR] Keypair not found: ${{ secrets.SM_KEYPAIR_ALIAS }}"
|
||||
Write-Host "Available keypairs are listed above"
|
||||
Write-Host ""
|
||||
Write-Host "Please verify:"
|
||||
Write-Host " 1. Keypair alias is correct in GitHub secret"
|
||||
Write-Host " 2. API key has access to this keypair"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (-not $hasCertificate) {
|
||||
Write-Host "[ERROR] No certificate associated with keypair"
|
||||
Write-Host "This usually means:"
|
||||
Write-Host " 1. Certificate not yet synced to KeyLocker (run sync manually)"
|
||||
Write-Host " 2. Certificate is pending approval"
|
||||
Write-Host " 3. Certificate needs to be attached to the keypair"
|
||||
Write-Host ""
|
||||
Write-Host "Try running in DigiCert ONE portal:"
|
||||
Write-Host " smctl keypair sync"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "[SUCCESS] Certificate check passed"
|
||||
Write-Host ""
|
||||
|
||||
# Find only the files we need to sign (not build scripts)
|
||||
$filesToSign = @()
|
||||
|
||||
# Main application executable
|
||||
$mainExe = Get-ChildItem -Path "./frontend/src-tauri/target/x86_64-pc-windows-msvc/release" -Filter "stirling-pdf.exe" -File -ErrorAction SilentlyContinue
|
||||
if ($mainExe) { $filesToSign += $mainExe }
|
||||
|
||||
# MSI installer
|
||||
$msiFiles = Get-ChildItem -Path "./frontend/src-tauri/target" -Filter "*.msi" -Recurse -File
|
||||
$filesToSign += $msiFiles
|
||||
|
||||
if ($filesToSign.Count -eq 0) {
|
||||
Write-Host "[ERROR] No files found to sign"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Found $($filesToSign.Count) files to sign:"
|
||||
foreach ($f in $filesToSign) { Write-Host " - $($f.Name)" }
|
||||
Write-Host ""
|
||||
|
||||
$signedCount = 0
|
||||
foreach ($file in $filesToSign) {
|
||||
Write-Host "Signing: $($file.Name)"
|
||||
|
||||
# Get PKCS11 config file path (set by DigiCert action)
|
||||
$pkcs11Config = $env:PKCS11_CONFIG
|
||||
if (-not $pkcs11Config) {
|
||||
Write-Host "[ERROR] PKCS11_CONFIG environment variable not set"
|
||||
Write-Host "DigiCert KeyLocker action may not have run correctly"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Using PKCS11 config: $pkcs11Config"
|
||||
|
||||
# Try signing with certificate fingerprint first (if available)
|
||||
$fingerprint = "${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}"
|
||||
if ($fingerprint -and $fingerprint -ne "") {
|
||||
Write-Host "Attempting to sign with certificate fingerprint..."
|
||||
$output = & smctl sign --fingerprint "$fingerprint" --input "$($file.FullName)" --config-file "$pkcs11Config" --verbose 2>&1
|
||||
$exitCode = $LASTEXITCODE
|
||||
} else {
|
||||
Write-Host "No fingerprint provided, using keypair alias..."
|
||||
# Use smctl to sign with keypair alias
|
||||
$output = & smctl sign --keypair-alias "${{ secrets.SM_KEYPAIR_ALIAS }}" --input "$($file.FullName)" --config-file "$pkcs11Config" --verbose 2>&1
|
||||
$exitCode = $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Host "Exit code: $exitCode"
|
||||
Write-Host "Output: $output"
|
||||
|
||||
# Check if output contains "FAILED" even with exit code 0
|
||||
if ($output -match "FAILED" -or $output -match "error" -or $output -match "Error") {
|
||||
Write-Host ""
|
||||
Write-Host "[ERROR] Signing failed for $($file.Name)"
|
||||
Write-Host "[ERROR] smctl returned success but output indicates failure"
|
||||
Write-Host ""
|
||||
Write-Host "Possible issues:"
|
||||
Write-Host " 1. Certificate not fully synced to KeyLocker (wait a few minutes)"
|
||||
Write-Host " 2. Incorrect keypair alias"
|
||||
Write-Host " 3. API key lacks signing permissions"
|
||||
Write-Host ""
|
||||
Write-Host "Please verify in DigiCert ONE portal:"
|
||||
Write-Host " - Certificate status is 'Issued' (not Pending)"
|
||||
Write-Host " - Keypair status is 'Online'"
|
||||
Write-Host " - 'Can sign' is set to 'Yes'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($exitCode -ne 0) {
|
||||
Write-Host "[ERROR] Failed to sign $($file.Name)"
|
||||
Write-Host "Full error output:"
|
||||
Write-Host $output
|
||||
exit 1
|
||||
}
|
||||
|
||||
$signedCount++
|
||||
Write-Host "[SUCCESS] Signed: $($file.Name)"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "=== Summary ==="
|
||||
Write-Host "[SUCCESS] Signed $signedCount/$($filesToSign.Count) files successfully"
|
||||
|
||||
- name: Verify notarization (macOS only)
|
||||
if: matrix.platform == 'macos-15' || matrix.platform == 'macos-15-intel'
|
||||
run: |
|
||||
@@ -512,66 +269,6 @@ jobs:
|
||||
find . -name "*.AppImage" -exec cp {} "../../../dist/Stirling-PDF-${{ matrix.name }}.AppImage" \;
|
||||
fi
|
||||
|
||||
- name: Verify Windows Code Signature
|
||||
if: matrix.platform == 'windows-latest' && github.ref == 'refs/heads/main'
|
||||
shell: pwsh
|
||||
run: |
|
||||
Write-Host "Verifying Windows code signatures..."
|
||||
|
||||
$exePath = "./dist/Stirling-PDF-${{ matrix.name }}.exe"
|
||||
$msiPath = "./dist/Stirling-PDF-${{ matrix.name }}.msi"
|
||||
|
||||
$allSigned = $true
|
||||
$usingKeyLocker = "${{ env.SM_API_KEY }}" -ne ""
|
||||
$usingPfx = "${{ env.WINDOWS_CERTIFICATE }}" -ne ""
|
||||
|
||||
# Check EXE signature
|
||||
if (Test-Path $exePath) {
|
||||
$exeSig = Get-AuthenticodeSignature -FilePath $exePath
|
||||
Write-Host "EXE Signature Status: $($exeSig.Status)"
|
||||
Write-Host "EXE Signer: $($exeSig.SignerCertificate.Subject)"
|
||||
Write-Host "EXE Timestamp: $($exeSig.TimeStamperCertificate.NotAfter)"
|
||||
|
||||
if ($exeSig.Status -ne "Valid") {
|
||||
Write-Host "[WARNING] EXE is not properly signed (Status: $($exeSig.Status))"
|
||||
if ($usingKeyLocker -or $usingPfx) {
|
||||
Write-Host "[ERROR] Certificate was provided but signing failed"
|
||||
$allSigned = $false
|
||||
} else {
|
||||
Write-Host "[INFO] Building unsigned binary (no certificate provided)"
|
||||
}
|
||||
} else {
|
||||
Write-Host "[SUCCESS] EXE is properly signed"
|
||||
}
|
||||
}
|
||||
|
||||
# Check MSI signature
|
||||
if (Test-Path $msiPath) {
|
||||
$msiSig = Get-AuthenticodeSignature -FilePath $msiPath
|
||||
Write-Host "MSI Signature Status: $($msiSig.Status)"
|
||||
Write-Host "MSI Signer: $($msiSig.SignerCertificate.Subject)"
|
||||
Write-Host "MSI Timestamp: $($msiSig.TimeStamperCertificate.NotAfter)"
|
||||
|
||||
if ($msiSig.Status -ne "Valid") {
|
||||
Write-Host "[WARNING] MSI is not properly signed (Status: $($msiSig.Status))"
|
||||
if ($usingKeyLocker -or $usingPfx) {
|
||||
Write-Host "[ERROR] Certificate was provided but signing failed"
|
||||
$allSigned = $false
|
||||
} else {
|
||||
Write-Host "[INFO] Building unsigned binary (no certificate provided)"
|
||||
}
|
||||
} else {
|
||||
Write-Host "[SUCCESS] MSI is properly signed"
|
||||
}
|
||||
}
|
||||
|
||||
if (($usingKeyLocker -or $usingPfx) -and -not $allSigned) {
|
||||
Write-Host "[ERROR] Code signing verification failed"
|
||||
exit 1
|
||||
} else {
|
||||
Write-Host "[SUCCESS] Code signature verification completed"
|
||||
}
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
|
||||
@@ -33,7 +33,6 @@ SwaggerDoc.json
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
.gradle-home
|
||||
.lock
|
||||
|
||||
# External tool builders
|
||||
|
||||
@@ -115,46 +115,46 @@ Stirling-PDF currently supports 40 languages!
|
||||
|
||||
| Language | Progress |
|
||||
| -------------------------------------------- | -------------------------------------- |
|
||||
| Arabic (العربية) (ar_AR) |  |
|
||||
| Azerbaijani (Azərbaycan Dili) (az_AZ) |  |
|
||||
| Basque (Euskara) (eu_ES) |  |
|
||||
| Bulgarian (Български) (bg_BG) |  |
|
||||
| Catalan (Català) (ca_CA) |  |
|
||||
| Croatian (Hrvatski) (hr_HR) |  |
|
||||
| Czech (Česky) (cs_CZ) |  |
|
||||
| Danish (Dansk) (da_DK) |  |
|
||||
| Dutch (Nederlands) (nl_NL) |  |
|
||||
| Arabic (العربية) (ar_AR) |  |
|
||||
| Azerbaijani (Azərbaycan Dili) (az_AZ) |  |
|
||||
| Basque (Euskara) (eu_ES) |  |
|
||||
| Bulgarian (Български) (bg_BG) |  |
|
||||
| Catalan (Català) (ca_CA) |  |
|
||||
| Croatian (Hrvatski) (hr_HR) |  |
|
||||
| Czech (Česky) (cs_CZ) |  |
|
||||
| Danish (Dansk) (da_DK) |  |
|
||||
| Dutch (Nederlands) (nl_NL) |  |
|
||||
| English (English) (en_GB) |  |
|
||||
| English (US) (en_US) |  |
|
||||
| French (Français) (fr_FR) |  |
|
||||
| German (Deutsch) (de_DE) |  |
|
||||
| Greek (Ελληνικά) (el_GR) |  |
|
||||
| Hindi (हिंदी) (hi_IN) |  |
|
||||
| Hungarian (Magyar) (hu_HU) |  |
|
||||
| Indonesian (Bahasa Indonesia) (id_ID) |  |
|
||||
| Irish (Gaeilge) (ga_IE) |  |
|
||||
| Italian (Italiano) (it_IT) |  |
|
||||
| Japanese (日本語) (ja_JP) |  |
|
||||
| Korean (한국어) (ko_KR) |  |
|
||||
| Norwegian (Norsk) (no_NB) |  |
|
||||
| Persian (فارسی) (fa_IR) |  |
|
||||
| Polish (Polski) (pl_PL) |  |
|
||||
| Portuguese (Português) (pt_PT) |  |
|
||||
| Portuguese Brazilian (Português) (pt_BR) |  |
|
||||
| Romanian (Română) (ro_RO) |  |
|
||||
| Russian (Русский) (ru_RU) |  |
|
||||
| Serbian Latin alphabet (Srpski) (sr_LATN_RS) |  |
|
||||
| Simplified Chinese (简体中文) (zh_CN) |  |
|
||||
| Slovakian (Slovensky) (sk_SK) |  |
|
||||
| Slovenian (Slovenščina) (sl_SI) |  |
|
||||
| Spanish (Español) (es_ES) |  |
|
||||
| Swedish (Svenska) (sv_SE) |  |
|
||||
| Thai (ไทย) (th_TH) |  |
|
||||
| French (Français) (fr_FR) |  |
|
||||
| German (Deutsch) (de_DE) |  |
|
||||
| Greek (Ελληνικά) (el_GR) |  |
|
||||
| Hindi (हिंदी) (hi_IN) |  |
|
||||
| Hungarian (Magyar) (hu_HU) |  |
|
||||
| Indonesian (Bahasa Indonesia) (id_ID) |  |
|
||||
| Irish (Gaeilge) (ga_IE) |  |
|
||||
| Italian (Italiano) (it_IT) |  |
|
||||
| Japanese (日本語) (ja_JP) |  |
|
||||
| Korean (한국어) (ko_KR) |  |
|
||||
| Norwegian (Norsk) (no_NB) |  |
|
||||
| Persian (فارسی) (fa_IR) |  |
|
||||
| Polish (Polski) (pl_PL) |  |
|
||||
| Portuguese (Português) (pt_PT) |  |
|
||||
| Portuguese Brazilian (Português) (pt_BR) |  |
|
||||
| Romanian (Română) (ro_RO) |  |
|
||||
| Russian (Русский) (ru_RU) |  |
|
||||
| Serbian Latin alphabet (Srpski) (sr_LATN_RS) |  |
|
||||
| Simplified Chinese (简体中文) (zh_CN) |  |
|
||||
| Slovakian (Slovensky) (sk_SK) |  |
|
||||
| Slovenian (Slovenščina) (sl_SI) |  |
|
||||
| Spanish (Español) (es_ES) |  |
|
||||
| Swedish (Svenska) (sv_SE) |  |
|
||||
| Thai (ไทย) (th_TH) |  |
|
||||
| Tibetan (བོད་ཡིག་) (bo_CN) |  |
|
||||
| Traditional Chinese (繁體中文) (zh_TW) |  |
|
||||
| Turkish (Türkçe) (tr_TR) |  |
|
||||
| Ukrainian (Українська) (uk_UA) |  |
|
||||
| Vietnamese (Tiếng Việt) (vi_VN) |  |
|
||||
| Traditional Chinese (繁體中文) (zh_TW) |  |
|
||||
| Turkish (Türkçe) (tr_TR) |  |
|
||||
| Ukrainian (Українська) (uk_UA) |  |
|
||||
| Vietnamese (Tiếng Việt) (vi_VN) |  |
|
||||
| Malayalam (മലയാളം) (ml_IN) |  |
|
||||
|
||||
## Stirling PDF Enterprise
|
||||
|
||||
@@ -1,258 +0,0 @@
|
||||
# Windows Code Signing Setup Guide
|
||||
|
||||
This guide explains how to set up Windows code signing for Stirling-PDF desktop application builds.
|
||||
|
||||
## Overview
|
||||
|
||||
Windows code signing is essential for:
|
||||
- Preventing Windows SmartScreen warnings
|
||||
- Building trust with users
|
||||
- Enabling Microsoft Store distribution
|
||||
- Professional application distribution
|
||||
|
||||
## Certificate Types
|
||||
|
||||
### OV Certificate (Organization Validated)
|
||||
- More affordable option
|
||||
- Requires business verification
|
||||
- May trigger SmartScreen warnings initially until reputation builds
|
||||
- Suitable for most independent software vendors
|
||||
|
||||
### EV Certificate (Extended Validation)
|
||||
- Premium option with immediate SmartScreen reputation
|
||||
- Requires hardware security module (HSM) or cloud-based signing
|
||||
- Higher cost but provides immediate trust
|
||||
- Required since June 2023 for new certificates
|
||||
|
||||
## Obtaining a Certificate
|
||||
|
||||
### Certificate Authorities
|
||||
Popular certificate authorities for Windows code signing:
|
||||
- DigiCert
|
||||
- Sectigo (formerly Comodo)
|
||||
- GlobalSign
|
||||
- SSL.com
|
||||
|
||||
### Certificate Format
|
||||
You'll receive a certificate in one of these formats:
|
||||
- `.pfx` or `.p12` (preferred - contains both certificate and private key)
|
||||
- `.cer` + private key (needs conversion to .pfx)
|
||||
|
||||
### Converting to PFX (if needed)
|
||||
If you have separate certificate and private key files:
|
||||
|
||||
```bash
|
||||
openssl pkcs12 -export -out certificate.pfx -inkey private-key.key -in certificate.cer
|
||||
```
|
||||
|
||||
## Setting Up GitHub Secrets
|
||||
|
||||
### Required Secrets
|
||||
|
||||
Navigate to your GitHub repository → Settings → Secrets and variables → Actions
|
||||
|
||||
Add the following secrets:
|
||||
|
||||
#### 1. `WINDOWS_CERTIFICATE`
|
||||
- **Description**: Base64-encoded .pfx certificate file
|
||||
- **How to create**:
|
||||
|
||||
**On macOS/Linux:**
|
||||
```bash
|
||||
base64 -i certificate.pfx | pbcopy # Copies to clipboard
|
||||
```
|
||||
|
||||
**On Windows (PowerShell):**
|
||||
```powershell
|
||||
[Convert]::ToBase64String([IO.File]::ReadAllBytes("certificate.pfx")) | Set-Clipboard
|
||||
```
|
||||
|
||||
Paste the entire base64 string into the GitHub secret.
|
||||
|
||||
#### 2. `WINDOWS_CERTIFICATE_PASSWORD`
|
||||
- **Description**: Password for the .pfx certificate
|
||||
- **Value**: The password you set when creating/exporting the .pfx file
|
||||
|
||||
### Optional Secrets for Tauri Updater
|
||||
|
||||
If you're using Tauri's built-in updater feature:
|
||||
|
||||
#### `TAURI_SIGNING_PRIVATE_KEY`
|
||||
- Generated using Tauri CLI: `npm run tauri signer generate`
|
||||
- Used for update package verification
|
||||
|
||||
#### `TAURI_SIGNING_PRIVATE_KEY_PASSWORD`
|
||||
- Password for the Tauri signing key
|
||||
|
||||
## Configuration Files
|
||||
|
||||
### 1. Tauri Configuration (frontend/src-tauri/tauri.conf.json)
|
||||
|
||||
The Windows signing configuration is already set up:
|
||||
|
||||
```json
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": "http://timestamp.digicert.com"
|
||||
}
|
||||
```
|
||||
|
||||
**Configuration Options:**
|
||||
- `certificateThumbprint`: Automatically extracted from imported certificate (leave as `null`)
|
||||
- `digestAlgorithm`: Hashing algorithm - `sha256` is recommended
|
||||
- `timestampUrl`: Timestamp server to prove signing time (survives certificate expiration)
|
||||
|
||||
**Alternative Timestamp Servers:**
|
||||
- DigiCert: `http://timestamp.digicert.com`
|
||||
- Sectigo: `http://timestamp.sectigo.com`
|
||||
- GlobalSign: `http://timestamp.globalsign.com`
|
||||
|
||||
### 2. GitHub Workflow (.github/workflows/tauri-build.yml)
|
||||
|
||||
The workflow includes three Windows signing steps:
|
||||
|
||||
1. **Import Certificate**: Decodes and imports the .pfx certificate into Windows certificate store
|
||||
2. **Build Tauri App**: Builds and signs the application using the imported certificate
|
||||
3. **Verify Signature**: Validates that both .exe and .msi files are properly signed
|
||||
|
||||
## Testing the Setup
|
||||
|
||||
### 1. Local Testing (Windows Only)
|
||||
|
||||
Before pushing to GitHub, test locally:
|
||||
|
||||
```powershell
|
||||
# Set environment variables
|
||||
$env:WINDOWS_CERTIFICATE = [Convert]::ToBase64String([IO.File]::ReadAllBytes("certificate.pfx"))
|
||||
$env:WINDOWS_CERTIFICATE_PASSWORD = "your-certificate-password"
|
||||
|
||||
# Build the application
|
||||
cd frontend
|
||||
npm run tauri build
|
||||
|
||||
# Verify the signature
|
||||
Get-AuthenticodeSignature "./src-tauri/target/release/bundle/msi/Stirling-PDF_*.msi"
|
||||
```
|
||||
|
||||
### 2. GitHub Actions Testing
|
||||
|
||||
1. Push your changes to a branch
|
||||
2. Manually trigger the workflow:
|
||||
- Go to Actions → Build Tauri Applications
|
||||
- Click "Run workflow"
|
||||
- Select "windows" platform
|
||||
3. Check the build logs for:
|
||||
- ✅ Certificate import success
|
||||
- ✅ Build completion
|
||||
- ✅ Signature verification
|
||||
|
||||
### 3. Verifying Signed Binaries
|
||||
|
||||
After downloading the built artifacts:
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
Get-AuthenticodeSignature "Stirling-PDF-windows-x86_64.exe"
|
||||
Get-AuthenticodeSignature "Stirling-PDF-windows-x86_64.msi"
|
||||
```
|
||||
|
||||
Look for:
|
||||
- Status: `Valid`
|
||||
- Signer: Your organization name
|
||||
- Timestamp: Recent date/time
|
||||
|
||||
**Windows (GUI):**
|
||||
1. Right-click the .exe or .msi file
|
||||
2. Select "Properties"
|
||||
3. Go to "Digital Signatures" tab
|
||||
4. Verify signature details
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "HashMismatch" Status
|
||||
- Certificate doesn't match the binary
|
||||
- Possible file corruption during download
|
||||
- Re-download and verify
|
||||
|
||||
### "NotSigned" Status
|
||||
- Certificate wasn't imported correctly
|
||||
- Check GitHub secrets are set correctly
|
||||
- Verify base64 encoding is complete (no truncation)
|
||||
|
||||
### "UnknownError" Status
|
||||
- Timestamp server unreachable
|
||||
- Try alternative timestamp URL in tauri.conf.json
|
||||
- Check network connectivity in GitHub Actions
|
||||
|
||||
### SmartScreen Still Shows Warnings
|
||||
- Normal for OV certificates initially
|
||||
- Reputation builds over time with user downloads
|
||||
- Consider EV certificate for immediate reputation
|
||||
|
||||
### Certificate Not Found During Build
|
||||
- Verify `WINDOWS_CERTIFICATE` secret is set
|
||||
- Check base64 encoding is correct (no extra whitespace)
|
||||
- Ensure password is correct
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
1. **Never commit certificates to version control**
|
||||
- Keep .pfx files secure and backed up
|
||||
- Use GitHub secrets for CI/CD
|
||||
|
||||
2. **Rotate certificates before expiration**
|
||||
- Set calendar reminders
|
||||
- Update GitHub secrets with new certificate
|
||||
|
||||
3. **Use strong passwords**
|
||||
- Certificate password should be complex
|
||||
- Store securely (password manager)
|
||||
|
||||
4. **Monitor certificate usage**
|
||||
- Review GitHub Actions logs
|
||||
- Set up notifications for failed builds
|
||||
|
||||
5. **Limit access to secrets**
|
||||
- Only repository admins should access secrets
|
||||
- Audit secret access regularly
|
||||
|
||||
## Certificate Lifecycle
|
||||
|
||||
### Before Expiration
|
||||
1. Obtain new certificate from CA (typically annual renewal)
|
||||
2. Convert to .pfx format if needed
|
||||
3. Update `WINDOWS_CERTIFICATE` secret with new base64-encoded certificate
|
||||
4. Update `WINDOWS_CERTIFICATE_PASSWORD` if password changed
|
||||
5. Test build to verify new certificate works
|
||||
|
||||
### Expired Certificates
|
||||
- Signed binaries remain valid (timestamp proves signing time)
|
||||
- New builds will fail until certificate is renewed
|
||||
- Users can still install previously signed versions
|
||||
|
||||
## Cost Considerations
|
||||
|
||||
### Certificate Costs (Annual, as of 2024)
|
||||
- **OV Certificate**: $100-400/year
|
||||
- **EV Certificate**: $400-1000/year
|
||||
|
||||
### Choosing the Right Certificate
|
||||
- **Open source / early stage**: Start with OV
|
||||
- **Commercial / enterprise**: Consider EV for better trust
|
||||
- **Microsoft Store**: EV certificate required
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Tauri Windows Signing Documentation](https://v2.tauri.app/distribute/sign/windows/)
|
||||
- [Microsoft Code Signing Overview](https://docs.microsoft.com/windows/win32/seccrypto/cryptography-tools)
|
||||
- [DigiCert Code Signing Guide](https://www.digicert.com/signing/code-signing-certificates)
|
||||
- [Windows SmartScreen FAQ](https://support.microsoft.com/windows/smartscreen-faq)
|
||||
|
||||
## Support
|
||||
|
||||
If you encounter issues with Windows code signing:
|
||||
1. Check GitHub Actions logs for detailed error messages
|
||||
2. Verify all secrets are set correctly
|
||||
3. Test certificate locally first (Windows environment required)
|
||||
4. Open an issue in the repository with relevant logs (remove sensitive data)
|
||||
@@ -18,37 +18,11 @@ import stirling.software.common.model.ApplicationProperties;
|
||||
@Slf4j
|
||||
public class EndpointConfiguration {
|
||||
|
||||
public enum DisableReason {
|
||||
CONFIG,
|
||||
DEPENDENCY,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
public static class EndpointAvailability {
|
||||
private final boolean enabled;
|
||||
private final DisableReason reason;
|
||||
|
||||
public EndpointAvailability(boolean enabled, DisableReason reason) {
|
||||
this.enabled = enabled;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public DisableReason getReason() {
|
||||
return reason;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String REMOVE_BLANKS = "remove-blanks";
|
||||
private final ApplicationProperties applicationProperties;
|
||||
@Getter private Map<String, Boolean> endpointStatuses = new ConcurrentHashMap<>();
|
||||
private Map<String, Set<String>> endpointGroups = new ConcurrentHashMap<>();
|
||||
private Set<String> disabledGroups = new HashSet<>();
|
||||
private Map<String, DisableReason> endpointDisableReasons = new ConcurrentHashMap<>();
|
||||
private Map<String, DisableReason> groupDisableReasons = new ConcurrentHashMap<>();
|
||||
private Map<String, Set<String>> endpointAlternatives = new ConcurrentHashMap<>();
|
||||
private final boolean runningProOrHigher;
|
||||
|
||||
@@ -61,31 +35,16 @@ public class EndpointConfiguration {
|
||||
processEnvironmentConfigs();
|
||||
}
|
||||
|
||||
private String normalizeEndpoint(String endpoint) {
|
||||
if (endpoint == null) {
|
||||
return null;
|
||||
}
|
||||
return endpoint.startsWith("/") ? endpoint.substring(1) : endpoint;
|
||||
}
|
||||
|
||||
public void enableEndpoint(String endpoint) {
|
||||
String normalized = normalizeEndpoint(endpoint);
|
||||
endpointStatuses.put(normalized, true);
|
||||
endpointDisableReasons.remove(normalized);
|
||||
log.debug("Enabled endpoint: {}", normalized);
|
||||
endpointStatuses.put(endpoint, true);
|
||||
log.debug("Enabled endpoint: {}", endpoint);
|
||||
}
|
||||
|
||||
public void disableEndpoint(String endpoint) {
|
||||
disableEndpoint(endpoint, DisableReason.CONFIG);
|
||||
}
|
||||
|
||||
public void disableEndpoint(String endpoint, DisableReason reason) {
|
||||
String normalized = normalizeEndpoint(endpoint);
|
||||
if (!Boolean.FALSE.equals(endpointStatuses.get(normalized))) {
|
||||
log.debug("Disabling endpoint: {}", normalized);
|
||||
if (!Boolean.FALSE.equals(endpointStatuses.get(endpoint))) {
|
||||
log.debug("Disabling endpoint: {}", endpoint);
|
||||
}
|
||||
endpointStatuses.put(normalized, false);
|
||||
endpointDisableReasons.put(normalized, reason);
|
||||
endpointStatuses.put(endpoint, false);
|
||||
}
|
||||
|
||||
public boolean isEndpointEnabled(String endpoint) {
|
||||
@@ -191,10 +150,6 @@ public class EndpointConfiguration {
|
||||
}
|
||||
|
||||
public void disableGroup(String group) {
|
||||
disableGroup(group, DisableReason.CONFIG);
|
||||
}
|
||||
|
||||
public void disableGroup(String group, DisableReason reason) {
|
||||
if (disabledGroups.add(group)) {
|
||||
if (isToolGroup(group)) {
|
||||
log.debug(
|
||||
@@ -206,12 +161,11 @@ public class EndpointConfiguration {
|
||||
group);
|
||||
}
|
||||
}
|
||||
groupDisableReasons.put(group, reason);
|
||||
// Only cascade to endpoints for *functional* groups
|
||||
if (!isToolGroup(group)) {
|
||||
Set<String> endpoints = endpointGroups.get(group);
|
||||
if (endpoints != null) {
|
||||
endpoints.forEach(endpoint -> disableEndpoint(endpoint, reason));
|
||||
endpoints.forEach(this::disableEndpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,39 +174,12 @@ public class EndpointConfiguration {
|
||||
if (disabledGroups.remove(group)) {
|
||||
log.debug("Enabling group: {}", group);
|
||||
}
|
||||
groupDisableReasons.remove(group);
|
||||
Set<String> endpoints = endpointGroups.get(group);
|
||||
if (endpoints != null) {
|
||||
endpoints.forEach(this::enableEndpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public EndpointAvailability getEndpointAvailability(String endpoint) {
|
||||
boolean enabled = isEndpointEnabled(endpoint);
|
||||
DisableReason reason = enabled ? null : determineDisableReason(endpoint);
|
||||
return new EndpointAvailability(enabled, reason);
|
||||
}
|
||||
|
||||
private DisableReason determineDisableReason(String endpoint) {
|
||||
String normalized = normalizeEndpoint(endpoint);
|
||||
if (Boolean.FALSE.equals(endpointStatuses.get(normalized))) {
|
||||
return endpointDisableReasons.getOrDefault(normalized, DisableReason.CONFIG);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Set<String>> entry : endpointGroups.entrySet()) {
|
||||
String group = entry.getKey();
|
||||
Set<String> endpoints = entry.getValue();
|
||||
if (!disabledGroups.contains(group) || endpoints == null) {
|
||||
continue;
|
||||
}
|
||||
if (endpoints.contains(normalized)) {
|
||||
return groupDisableReasons.getOrDefault(group, DisableReason.CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
return DisableReason.UNKNOWN;
|
||||
}
|
||||
|
||||
public Set<String> getDisabledGroups() {
|
||||
return new HashSet<>(disabledGroups);
|
||||
}
|
||||
@@ -334,8 +261,6 @@ public class EndpointConfiguration {
|
||||
addEndpointToGroup("Convert", "pdf-to-csv");
|
||||
addEndpointToGroup("Convert", "pdf-to-markdown");
|
||||
addEndpointToGroup("Convert", "eml-to-pdf");
|
||||
addEndpointToGroup("Convert", "cbz-to-pdf");
|
||||
addEndpointToGroup("Convert", "pdf-to-cbz");
|
||||
addEndpointToGroup("Convert", "pdf-to-json");
|
||||
addEndpointToGroup("Convert", "json-to-pdf");
|
||||
|
||||
@@ -371,12 +296,6 @@ public class EndpointConfiguration {
|
||||
addEndpointToGroup("Other", "replace-and-invert-color-pdf");
|
||||
addEndpointToGroup("Other", "multi-tool");
|
||||
|
||||
// Adding form-related endpoints to "Other" group
|
||||
addEndpointToGroup("Other", "fields");
|
||||
addEndpointToGroup("Other", "modify-fields");
|
||||
addEndpointToGroup("Other", "delete-fields");
|
||||
addEndpointToGroup("Other", "fill");
|
||||
|
||||
// Adding endpoints to "Advance" group
|
||||
addEndpointToGroup("Advance", "adjust-contrast");
|
||||
addEndpointToGroup("Advance", "compress-pdf");
|
||||
@@ -471,8 +390,6 @@ public class EndpointConfiguration {
|
||||
addEndpointToGroup("Java", "pdf-to-markdown");
|
||||
addEndpointToGroup("Java", "add-attachments");
|
||||
addEndpointToGroup("Java", "compress-pdf");
|
||||
addEndpointToGroup("Java", "cbz-to-pdf");
|
||||
addEndpointToGroup("Java", "pdf-to-cbz");
|
||||
addEndpointToGroup("Java", "pdf-to-json");
|
||||
addEndpointToGroup("Java", "json-to-pdf");
|
||||
addEndpointToGroup("rar", "pdf-to-cbr");
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package stirling.software.common.annotations.api;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
/**
|
||||
* Combined annotation for Invite management controllers.
|
||||
* Includes @RestController, @RequestMapping("/api/v1/invite"), and OpenAPI @Tag.
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/invite")
|
||||
@Tag(
|
||||
name = "Invite",
|
||||
description =
|
||||
"""
|
||||
Invite-link generation and acceptance endpoints for onboarding new users.
|
||||
|
||||
Provides the ability to issue invitation tokens, send optional email invites,
|
||||
validate and accept invite links, and manage pending invitations for teams.
|
||||
|
||||
Typical use cases include:
|
||||
• Admin workflows for issuing time-limited invitations to external users
|
||||
• Self-service invite acceptance and team assignment
|
||||
• License limit enforcement when provisioning new accounts
|
||||
|
||||
Target users: administrators and automation scripts orchestrating user onboarding.
|
||||
""")
|
||||
public @interface InviteApi {}
|
||||
@@ -38,7 +38,6 @@ public class GeneralUtils {
|
||||
Set.of(
|
||||
"OCR images.json",
|
||||
"Prepare-pdfs-for-email.json",
|
||||
"Pre-publish-sanitization.json",
|
||||
"split-rotate-auto-rename.json");
|
||||
|
||||
private final String DEFAULT_WEBUI_CONFIGS_DIR = "defaultWebUIConfigs";
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.Properties;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.context.WebServerInitializedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@@ -200,14 +198,6 @@ public class SPDFApplication {
|
||||
// }
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public void onWebServerInitialized(WebServerInitializedEvent event) {
|
||||
int actualPort = event.getWebServer().getPort();
|
||||
serverPortStatic = String.valueOf(actualPort);
|
||||
// Log the actual runtime port for Tauri to parse
|
||||
log.info("Stirling-PDF running on port: {}", actualPort);
|
||||
}
|
||||
|
||||
private static void printStartupLogs() {
|
||||
log.info("Stirling-PDF Started.");
|
||||
String url = baseUrlStatic + ":" + getStaticPort() + contextPathStatic;
|
||||
|
||||
@@ -12,7 +12,6 @@ import jakarta.annotation.PostConstruct;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.config.EndpointConfiguration.DisableReason;
|
||||
import stirling.software.common.configuration.RuntimePathConfig;
|
||||
import stirling.software.common.util.RegexPatternUtils;
|
||||
|
||||
@@ -25,7 +24,6 @@ public class ExternalAppDepConfig {
|
||||
private final String weasyprintPath;
|
||||
private final String unoconvPath;
|
||||
private final Map<String, List<String>> commandToGroupMapping;
|
||||
private volatile boolean dependenciesChecked = false;
|
||||
|
||||
public ExternalAppDepConfig(
|
||||
EndpointConfiguration endpointConfiguration, RuntimePathConfig runtimePathConfig) {
|
||||
@@ -99,7 +97,7 @@ public class ExternalAppDepConfig {
|
||||
if (affectedGroups != null) {
|
||||
for (String group : affectedGroups) {
|
||||
List<String> affectedFeatures = getAffectedFeatures(group);
|
||||
endpointConfiguration.disableGroup(group, DisableReason.DEPENDENCY);
|
||||
endpointConfiguration.disableGroup(group);
|
||||
log.warn(
|
||||
"Missing dependency: {} - Disabling group: {} (Affected features: {})",
|
||||
command,
|
||||
@@ -112,10 +110,6 @@ public class ExternalAppDepConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDependenciesChecked() {
|
||||
return dependenciesChecked;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkDependencies() {
|
||||
// Check core dependencies
|
||||
@@ -133,8 +127,8 @@ public class ExternalAppDepConfig {
|
||||
if (!pythonAvailable) {
|
||||
List<String> pythonFeatures = getAffectedFeatures("Python");
|
||||
List<String> openCVFeatures = getAffectedFeatures("OpenCV");
|
||||
endpointConfiguration.disableGroup("Python", DisableReason.DEPENDENCY);
|
||||
endpointConfiguration.disableGroup("OpenCV", DisableReason.DEPENDENCY);
|
||||
endpointConfiguration.disableGroup("Python");
|
||||
endpointConfiguration.disableGroup("OpenCV");
|
||||
log.warn(
|
||||
"Missing dependency: Python - Disabling Python features: {} and OpenCV features: {}",
|
||||
String.join(", ", pythonFeatures),
|
||||
@@ -152,14 +146,14 @@ public class ExternalAppDepConfig {
|
||||
int exitCode = process.waitFor();
|
||||
if (exitCode != 0) {
|
||||
List<String> openCVFeatures = getAffectedFeatures("OpenCV");
|
||||
endpointConfiguration.disableGroup("OpenCV", DisableReason.DEPENDENCY);
|
||||
endpointConfiguration.disableGroup("OpenCV");
|
||||
log.warn(
|
||||
"OpenCV not available in Python - Disabling OpenCV features: {}",
|
||||
String.join(", ", openCVFeatures));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
List<String> openCVFeatures = getAffectedFeatures("OpenCV");
|
||||
endpointConfiguration.disableGroup("OpenCV", DisableReason.DEPENDENCY);
|
||||
endpointConfiguration.disableGroup("OpenCV");
|
||||
log.warn(
|
||||
"Error checking OpenCV: {} - Disabling OpenCV features: {}",
|
||||
e.getMessage(),
|
||||
@@ -167,7 +161,5 @@ public class ExternalAppDepConfig {
|
||||
}
|
||||
}
|
||||
endpointConfiguration.logDisabledEndpointsSummary();
|
||||
dependenciesChecked = true;
|
||||
log.info("Dependency checks completed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package stirling.software.SPDF.config;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.servlet.Filter;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.service.WeeklyActiveUsersService;
|
||||
|
||||
/**
|
||||
* Filter to track browser IDs for Weekly Active Users (WAU) counting. Only active when security is
|
||||
* disabled (no-login mode).
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = "security.enableLogin", havingValue = "false")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WAUTrackingFilter implements Filter {
|
||||
|
||||
private final WeeklyActiveUsersService wauService;
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
if (request instanceof HttpServletRequest httpRequest) {
|
||||
// Extract browser ID from header
|
||||
String browserId = httpRequest.getHeader("X-Browser-Id");
|
||||
|
||||
if (browserId != null && !browserId.trim().isEmpty()) {
|
||||
// Record browser access
|
||||
wauService.recordBrowserAccess(browserId);
|
||||
}
|
||||
}
|
||||
|
||||
// Continue the filter chain
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
@@ -46,24 +46,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
"tauri://localhost",
|
||||
"http://tauri.localhost",
|
||||
"https://tauri.localhost")
|
||||
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
|
||||
.allowedHeaders(
|
||||
"Authorization",
|
||||
"Content-Type",
|
||||
"X-Requested-With",
|
||||
"Accept",
|
||||
"Origin",
|
||||
"X-API-KEY",
|
||||
"X-CSRF-TOKEN",
|
||||
"X-XSRF-TOKEN",
|
||||
"X-Browser-Id")
|
||||
.exposedHeaders(
|
||||
"WWW-Authenticate",
|
||||
"X-Total-Count",
|
||||
"X-Page-Number",
|
||||
"X-Page-Size",
|
||||
"Content-Disposition",
|
||||
"Content-Type")
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")
|
||||
.allowedHeaders("*")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
} else if (hasConfiguredOrigins) {
|
||||
@@ -79,53 +63,13 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
.toArray(new String[0]);
|
||||
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns(allowedOrigins)
|
||||
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
|
||||
.allowedHeaders(
|
||||
"Authorization",
|
||||
"Content-Type",
|
||||
"X-Requested-With",
|
||||
"Accept",
|
||||
"Origin",
|
||||
"X-API-KEY",
|
||||
"X-CSRF-TOKEN",
|
||||
"X-XSRF-TOKEN",
|
||||
"X-Browser-Id")
|
||||
.exposedHeaders(
|
||||
"WWW-Authenticate",
|
||||
"X-Total-Count",
|
||||
"X-Page-Number",
|
||||
"X-Page-Size",
|
||||
"Content-Disposition",
|
||||
"Content-Type")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
} else {
|
||||
// Default to allowing all origins when nothing is configured
|
||||
logger.info(
|
||||
"No CORS allowed origins configured in settings.yml (system.corsAllowedOrigins); allowing all origins.");
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns("*")
|
||||
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS")
|
||||
.allowedHeaders(
|
||||
"Authorization",
|
||||
"Content-Type",
|
||||
"X-Requested-With",
|
||||
"Accept",
|
||||
"Origin",
|
||||
"X-API-KEY",
|
||||
"X-CSRF-TOKEN",
|
||||
"X-XSRF-TOKEN",
|
||||
"X-Browser-Id")
|
||||
.exposedHeaders(
|
||||
"WWW-Authenticate",
|
||||
"X-Total-Count",
|
||||
"X-Page-Number",
|
||||
"X-Page-Size",
|
||||
"Content-Disposition",
|
||||
"Content-Type")
|
||||
.allowedOrigins(allowedOrigins)
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")
|
||||
.allowedHeaders("*")
|
||||
.allowCredentials(true)
|
||||
.maxAge(3600);
|
||||
}
|
||||
// If no origins are configured and not in Tauri mode, CORS is not enabled (secure by
|
||||
// default)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.config.swagger.JsonDataResponse;
|
||||
import stirling.software.SPDF.config.swagger.StandardPdfResponse;
|
||||
import stirling.software.SPDF.model.api.EditTableOfContentsRequest;
|
||||
import stirling.software.common.annotations.AutoJobPostMapping;
|
||||
@@ -48,12 +49,13 @@ public class EditTableOfContentsController {
|
||||
@AutoJobPostMapping(
|
||||
value = "/extract-bookmarks",
|
||||
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@JsonDataResponse
|
||||
@Operation(
|
||||
summary = "Extract PDF Bookmarks",
|
||||
description = "Extracts bookmarks/table of contents from a PDF document as JSON.")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<Map<String, Object>>> extractBookmarks(
|
||||
@RequestParam("file") MultipartFile file) throws Exception {
|
||||
public List<Map<String, Object>> extractBookmarks(@RequestParam("file") MultipartFile file)
|
||||
throws Exception {
|
||||
PDDocument document = null;
|
||||
try {
|
||||
document = pdfDocumentFactory.load(file);
|
||||
@@ -61,10 +63,10 @@ public class EditTableOfContentsController {
|
||||
|
||||
if (outline == null) {
|
||||
log.info("No outline/bookmarks found in PDF");
|
||||
return ResponseEntity.ok(new ArrayList<>());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(extractBookmarkItems(document, outline));
|
||||
return extractBookmarkItems(document, outline);
|
||||
} finally {
|
||||
if (document != null) {
|
||||
document.close();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stirling.software.SPDF.controller.api.misc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -11,13 +10,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.config.EndpointConfiguration;
|
||||
import stirling.software.SPDF.config.EndpointConfiguration.EndpointAvailability;
|
||||
import stirling.software.SPDF.config.InitialSetup;
|
||||
import stirling.software.common.annotations.api.ConfigApi;
|
||||
import stirling.software.common.configuration.AppConfig;
|
||||
@@ -35,7 +30,6 @@ public class ConfigController {
|
||||
private final EndpointConfiguration endpointConfiguration;
|
||||
private final ServerCertificateServiceInterface serverCertificateService;
|
||||
private final UserServiceInterface userService;
|
||||
private final stirling.software.SPDF.config.ExternalAppDepConfig externalAppDepConfig;
|
||||
|
||||
public ConfigController(
|
||||
ApplicationProperties applicationProperties,
|
||||
@@ -44,14 +38,12 @@ public class ConfigController {
|
||||
@org.springframework.beans.factory.annotation.Autowired(required = false)
|
||||
ServerCertificateServiceInterface serverCertificateService,
|
||||
@org.springframework.beans.factory.annotation.Autowired(required = false)
|
||||
UserServiceInterface userService,
|
||||
stirling.software.SPDF.config.ExternalAppDepConfig externalAppDepConfig) {
|
||||
UserServiceInterface userService) {
|
||||
this.applicationProperties = applicationProperties;
|
||||
this.applicationContext = applicationContext;
|
||||
this.endpointConfiguration = endpointConfiguration;
|
||||
this.serverCertificateService = serverCertificateService;
|
||||
this.userService = userService;
|
||||
this.externalAppDepConfig = externalAppDepConfig;
|
||||
}
|
||||
|
||||
@GetMapping("/app-config")
|
||||
@@ -59,9 +51,6 @@ public class ConfigController {
|
||||
Map<String, Object> configData = new HashMap<>();
|
||||
|
||||
try {
|
||||
// Add dependency check status
|
||||
configData.put("dependenciesReady", externalAppDepConfig.isDependenciesChecked());
|
||||
|
||||
// Get AppConfig bean
|
||||
AppConfig appConfig = applicationContext.getBean(AppConfig.class);
|
||||
|
||||
@@ -165,25 +154,6 @@ public class ConfigController {
|
||||
// EE features not available, continue without them
|
||||
}
|
||||
|
||||
// Add version and machine info for update checking
|
||||
try {
|
||||
if (applicationContext.containsBean("appVersion")) {
|
||||
configData.put(
|
||||
"appVersion", applicationContext.getBean("appVersion", String.class));
|
||||
}
|
||||
if (applicationContext.containsBean("machineType")) {
|
||||
configData.put(
|
||||
"machineType", applicationContext.getBean("machineType", String.class));
|
||||
}
|
||||
if (applicationContext.containsBean("activeSecurity")) {
|
||||
configData.put(
|
||||
"activeSecurity",
|
||||
applicationContext.getBean("activeSecurity", Boolean.class));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Version/machine info not available
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(configData);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -211,19 +181,4 @@ public class ConfigController {
|
||||
}
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
@GetMapping("/endpoints-availability")
|
||||
public ResponseEntity<Map<String, EndpointAvailability>> getEndpointAvailability(
|
||||
@RequestParam(name = "endpoints")
|
||||
@Size(min = 1, max = 100, message = "Must provide between 1 and 100 endpoints")
|
||||
List<@NotBlank String> endpoints) {
|
||||
Map<String, EndpointAvailability> result = new HashMap<>();
|
||||
for (String endpoint : endpoints) {
|
||||
String trimmedEndpoint = endpoint.trim();
|
||||
result.put(
|
||||
trimmedEndpoint,
|
||||
endpointConfiguration.getEndpointAvailability(trimmedEndpoint));
|
||||
}
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,9 +196,9 @@ public class StampController {
|
||||
resourceDir =
|
||||
switch (alphabet) {
|
||||
case "arabic" -> "static/fonts/NotoSansArabic-Regular.ttf";
|
||||
case "japanese" -> "static/fonts/NotoSansJP-Regular.ttf";
|
||||
case "korean" -> "static/fonts/NotoSansKR-Regular.ttf";
|
||||
case "chinese" -> "static/fonts/NotoSansSC-Regular.ttf";
|
||||
case "japanese" -> "static/fonts/Meiryo.ttf";
|
||||
case "korean" -> "static/fonts/malgun.ttf";
|
||||
case "chinese" -> "static/fonts/SimSun.ttf";
|
||||
case "thai" -> "static/fonts/NotoSansThai-Regular.ttf";
|
||||
case "roman" -> "static/fonts/NotoSans-Regular.ttf";
|
||||
default -> "static/fonts/NotoSans-Regular.ttf";
|
||||
|
||||
@@ -171,9 +171,9 @@ public class WatermarkController {
|
||||
resourceDir =
|
||||
switch (alphabet) {
|
||||
case "arabic" -> "static/fonts/NotoSansArabic-Regular.ttf";
|
||||
case "japanese" -> "static/fonts/NotoSansJP-Regular.ttf";
|
||||
case "korean" -> "static/fonts/NotoSansKR-Regular.ttf";
|
||||
case "chinese" -> "static/fonts/NotoSansSC-Regular.ttf";
|
||||
case "japanese" -> "static/fonts/Meiryo.ttf";
|
||||
case "korean" -> "static/fonts/malgun.ttf";
|
||||
case "chinese" -> "static/fonts/SimSun.ttf";
|
||||
case "thai" -> "static/fonts/NotoSansThai-Regular.ttf";
|
||||
default -> "static/fonts/NotoSans-Regular.ttf";
|
||||
};
|
||||
|
||||
@@ -23,7 +23,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.SPDF.config.EndpointInspector;
|
||||
import stirling.software.SPDF.config.StartupApplicationListener;
|
||||
import stirling.software.SPDF.service.WeeklyActiveUsersService;
|
||||
import stirling.software.common.annotations.api.InfoApi;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
|
||||
@@ -35,7 +34,6 @@ public class MetricsController {
|
||||
private final ApplicationProperties applicationProperties;
|
||||
private final MeterRegistry meterRegistry;
|
||||
private final EndpointInspector endpointInspector;
|
||||
private final Optional<WeeklyActiveUsersService> wauService;
|
||||
private boolean metricsEnabled;
|
||||
|
||||
@PostConstruct
|
||||
@@ -354,36 +352,6 @@ public class MetricsController {
|
||||
return ResponseEntity.ok(formatDuration(uptime));
|
||||
}
|
||||
|
||||
@GetMapping("/wau")
|
||||
@Operation(
|
||||
summary = "Weekly Active Users statistics",
|
||||
description =
|
||||
"Returns WAU (Weekly Active Users) count and total unique browsers. "
|
||||
+ "Only available when security is disabled (no-login mode). "
|
||||
+ "Tracks unique browsers via client-generated UUID in localStorage.")
|
||||
public ResponseEntity<?> getWeeklyActiveUsers() {
|
||||
if (!metricsEnabled) {
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body("This endpoint is disabled.");
|
||||
}
|
||||
|
||||
// Check if WAU service is available (only when security.enableLogin=false)
|
||||
if (wauService.isEmpty()) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(
|
||||
"WAU tracking is only available when security is disabled (no-login mode)");
|
||||
}
|
||||
|
||||
WeeklyActiveUsersService service = wauService.get();
|
||||
|
||||
Map<String, Object> wauStats = new HashMap<>();
|
||||
wauStats.put("weeklyActiveUsers", service.getWeeklyActiveUsers());
|
||||
wauStats.put("totalUniqueBrowsers", service.getTotalUniqueBrowsers());
|
||||
wauStats.put("daysOnline", service.getDaysOnline());
|
||||
wauStats.put("trackingSince", service.getStartTime().toString());
|
||||
|
||||
return ResponseEntity.ok(wauStats);
|
||||
}
|
||||
|
||||
private String formatDuration(Duration duration) {
|
||||
long days = duration.toDays();
|
||||
long hours = duration.toHoursPart();
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
package stirling.software.SPDF.service;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Service for tracking Weekly Active Users (WAU) in no-login mode. Uses in-memory storage with
|
||||
* automatic cleanup of old entries.
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WeeklyActiveUsersService {
|
||||
|
||||
// Map of browser ID -> last seen timestamp
|
||||
private final Map<String, Instant> activeBrowsers = new ConcurrentHashMap<>();
|
||||
|
||||
// Track total unique browsers seen (overall)
|
||||
private long totalUniqueBrowsers = 0;
|
||||
|
||||
// Application start time
|
||||
private final Instant startTime = Instant.now();
|
||||
|
||||
/**
|
||||
* Records a browser access with the current timestamp
|
||||
*
|
||||
* @param browserId Unique browser identifier from X-Browser-Id header
|
||||
*/
|
||||
public void recordBrowserAccess(String browserId) {
|
||||
if (browserId == null || browserId.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isNewBrowser = !activeBrowsers.containsKey(browserId);
|
||||
activeBrowsers.put(browserId, Instant.now());
|
||||
|
||||
if (isNewBrowser) {
|
||||
totalUniqueBrowsers++;
|
||||
log.debug("New browser recorded: {} (Total: {})", browserId, totalUniqueBrowsers);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the count of unique browsers seen in the last 7 days
|
||||
*
|
||||
* @return Weekly Active Users count
|
||||
*/
|
||||
public long getWeeklyActiveUsers() {
|
||||
cleanupOldEntries();
|
||||
return activeBrowsers.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total count of unique browsers ever seen
|
||||
*
|
||||
* @return Total unique browsers count
|
||||
*/
|
||||
public long getTotalUniqueBrowsers() {
|
||||
return totalUniqueBrowsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of days the service has been running
|
||||
*
|
||||
* @return Days online
|
||||
*/
|
||||
public long getDaysOnline() {
|
||||
return ChronoUnit.DAYS.between(startTime, Instant.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the timestamp when tracking started
|
||||
*
|
||||
* @return Start time
|
||||
*/
|
||||
public Instant getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
/** Removes entries older than 7 days */
|
||||
private void cleanupOldEntries() {
|
||||
Instant sevenDaysAgo = Instant.now().minus(7, ChronoUnit.DAYS);
|
||||
activeBrowsers.entrySet().removeIf(entry -> entry.getValue().isBefore(sevenDaysAgo));
|
||||
}
|
||||
|
||||
/** Manual cleanup trigger (can be called by scheduled task if needed) */
|
||||
public void performCleanup() {
|
||||
int sizeBefore = activeBrowsers.size();
|
||||
cleanupOldEntries();
|
||||
int sizeAfter = activeBrowsers.size();
|
||||
|
||||
if (sizeBefore != sizeAfter) {
|
||||
log.debug("Cleaned up {} old browser entries", sizeBefore - sizeAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"name": "Pre-publish-sanitization",
|
||||
"pipeline": [
|
||||
{
|
||||
"operation": "/api/v1/security/sanitize-pdf",
|
||||
"parameters": {
|
||||
"removeJavaScript": true,
|
||||
"removeEmbeddedFiles": true,
|
||||
"removeXMPMetadata": true,
|
||||
"removeMetadata": true,
|
||||
"removeLinks": true,
|
||||
"removeFonts": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"operation": "/api/v1/misc/flatten",
|
||||
"parameters": {
|
||||
"flattenOnlyForms": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"operation": "/api/v1/general/remove-annotations",
|
||||
"parameters": {}
|
||||
},
|
||||
{
|
||||
"operation": "/api/v1/misc/update-metadata",
|
||||
"parameters": {
|
||||
"deleteAll": true,
|
||||
"author": "",
|
||||
"creationDate": "",
|
||||
"creator": "",
|
||||
"keywords": "",
|
||||
"modificationDate": "",
|
||||
"producer": "",
|
||||
"subject": "",
|
||||
"title": "",
|
||||
"trapped": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"operation": "/api/v1/misc/compress-pdf",
|
||||
"parameters": {
|
||||
"optimizeLevel": 3,
|
||||
"expectedOutputSize": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"_examples": {
|
||||
"outputDir": "{outputFolder}/{folderName}",
|
||||
"outputFileName": "{filename}-{pipelineName}-{date}-{time}"
|
||||
},
|
||||
"outputDir": "{outputFolder}",
|
||||
"outputFileName": "pre_publish_{filename}.PDF"
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
@@ -87,13 +86,9 @@ class EditTableOfContentsControllerTest {
|
||||
when(mockOutlineItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// When
|
||||
ResponseEntity<List<Map<String, Object>>> response =
|
||||
editTableOfContentsController.extractBookmarks(mockFile);
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(response);
|
||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||
List<Map<String, Object>> result = response.getBody();
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
@@ -113,13 +108,9 @@ class EditTableOfContentsControllerTest {
|
||||
when(mockCatalog.getDocumentOutline()).thenReturn(null);
|
||||
|
||||
// When
|
||||
ResponseEntity<List<Map<String, Object>>> response =
|
||||
editTableOfContentsController.extractBookmarks(mockFile);
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(response);
|
||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||
List<Map<String, Object>> result = response.getBody();
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isEmpty());
|
||||
verify(mockDocument).close();
|
||||
@@ -151,13 +142,9 @@ class EditTableOfContentsControllerTest {
|
||||
when(childItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// When
|
||||
ResponseEntity<List<Map<String, Object>>> response =
|
||||
editTableOfContentsController.extractBookmarks(mockFile);
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(response);
|
||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||
List<Map<String, Object>> result = response.getBody();
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
@@ -191,13 +178,9 @@ class EditTableOfContentsControllerTest {
|
||||
when(mockOutlineItem.getNextSibling()).thenReturn(null);
|
||||
|
||||
// When
|
||||
ResponseEntity<List<Map<String, Object>>> response =
|
||||
editTableOfContentsController.extractBookmarks(mockFile);
|
||||
List<Map<String, Object>> result = editTableOfContentsController.extractBookmarks(mockFile);
|
||||
|
||||
// Then
|
||||
assertNotNull(response);
|
||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||
List<Map<String, Object>> result = response.getBody();
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
|
||||
@@ -31,12 +31,10 @@ import stirling.software.common.model.api.PDFFile;
|
||||
import stirling.software.common.service.JobOwnershipService;
|
||||
import stirling.software.common.util.ExceptionUtils;
|
||||
import stirling.software.common.util.WebResponseUtils;
|
||||
import stirling.software.proprietary.security.config.PremiumEndpoint;
|
||||
|
||||
@Slf4j
|
||||
@ConvertApi
|
||||
@RequiredArgsConstructor
|
||||
@PremiumEndpoint
|
||||
public class ConvertPdfJsonController {
|
||||
|
||||
private final PdfJsonConversionService pdfJsonConversionService;
|
||||
@@ -44,11 +42,12 @@ public class ConvertPdfJsonController {
|
||||
@Autowired(required = false)
|
||||
private JobOwnershipService jobOwnershipService;
|
||||
|
||||
@AutoJobPostMapping(consumes = "multipart/form-data", value = "/pdf/text-editor")
|
||||
@AutoJobPostMapping(consumes = "multipart/form-data", value = "/pdf/json")
|
||||
@Operation(
|
||||
summary = "Convert PDF to Text Editor Format",
|
||||
summary = "Convert PDF to JSON",
|
||||
description =
|
||||
"Extracts PDF text, fonts, and metadata into an editable JSON structure for the text editor tool. Input:PDF Output:JSON Type:SISO")
|
||||
"Extracts PDF text, fonts, and metadata into an editable JSON structure that can be"
|
||||
+ " transformed back into a PDF. Input:PDF Output:JSON Type:SISO")
|
||||
public ResponseEntity<byte[]> convertPdfToJson(
|
||||
@ModelAttribute PDFFile request,
|
||||
@RequestParam(value = "lightweight", defaultValue = "false") boolean lightweight)
|
||||
@@ -68,12 +67,13 @@ public class ConvertPdfJsonController {
|
||||
return WebResponseUtils.bytesToWebResponse(jsonBytes, docName, MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@AutoJobPostMapping(consumes = "multipart/form-data", value = "/text-editor/pdf")
|
||||
@AutoJobPostMapping(consumes = "multipart/form-data", value = "/json/pdf")
|
||||
@StandardPdfResponse
|
||||
@Operation(
|
||||
summary = "Convert Text Editor Format to PDF",
|
||||
summary = "Convert JSON to PDF",
|
||||
description =
|
||||
"Rebuilds a PDF from the editable JSON structure generated by the text editor tool. Input:JSON Output:PDF Type:SISO")
|
||||
"Rebuilds a PDF from the editable JSON structure generated by the PDF to JSON"
|
||||
+ " endpoint. Input:JSON Output:PDF Type:SISO")
|
||||
public ResponseEntity<byte[]> convertJsonToPdf(@ModelAttribute GeneralFile request)
|
||||
throws Exception {
|
||||
MultipartFile jsonFile = request.getFileInput();
|
||||
@@ -91,11 +91,11 @@ public class ConvertPdfJsonController {
|
||||
return WebResponseUtils.bytesToWebResponse(pdfBytes, docName);
|
||||
}
|
||||
|
||||
@PostMapping(consumes = "multipart/form-data", value = "/pdf/text-editor/metadata")
|
||||
@PostMapping(consumes = "multipart/form-data", value = "/pdf/json/metadata")
|
||||
@Operation(
|
||||
summary = "Extract PDF metadata for text editor lazy loading",
|
||||
summary = "Extract PDF metadata for lazy loading",
|
||||
description =
|
||||
"Extracts document metadata, fonts, and page dimensions for the text editor tool. Caches the document for"
|
||||
"Extracts document metadata, fonts, and page dimensions. Caches the document for"
|
||||
+ " subsequent page requests. Returns a server-generated jobId scoped to the"
|
||||
+ " authenticated user. Input:PDF Output:JSON Type:SISO")
|
||||
public ResponseEntity<byte[]> extractPdfMetadata(@ModelAttribute PDFFile request)
|
||||
@@ -129,15 +129,13 @@ public class ConvertPdfJsonController {
|
||||
.body(jsonBytes);
|
||||
}
|
||||
|
||||
@PostMapping(
|
||||
value = "/pdf/text-editor/partial/{jobId}",
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = "/pdf/json/partial/{jobId}", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@StandardPdfResponse
|
||||
@Operation(
|
||||
summary = "Apply incremental edits from text editor to a cached PDF",
|
||||
summary = "Apply incremental edits to a cached PDF",
|
||||
description =
|
||||
"Applies edits for the specified pages of a cached PDF and returns an updated PDF."
|
||||
+ " Requires the PDF to have been previously cached via the text editor metadata endpoint."
|
||||
+ " Requires the PDF to have been previously cached via the PDF to JSON endpoint."
|
||||
+ " The jobId must be obtained from the metadata extraction endpoint.")
|
||||
public ResponseEntity<byte[]> exportPartialPdf(
|
||||
@PathVariable String jobId,
|
||||
@@ -164,12 +162,12 @@ public class ConvertPdfJsonController {
|
||||
return WebResponseUtils.bytesToWebResponse(pdfBytes, docName);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/pdf/text-editor/page/{jobId}/{pageNumber}")
|
||||
@GetMapping(value = "/pdf/json/page/{jobId}/{pageNumber}")
|
||||
@Operation(
|
||||
summary = "Extract single page from cached PDF for text editor",
|
||||
summary = "Extract single page from cached PDF",
|
||||
description =
|
||||
"Retrieves a single page's content from a previously cached PDF document for the text editor tool."
|
||||
+ " Requires prior call to /pdf/text-editor/metadata. The jobId must belong to the"
|
||||
"Retrieves a single page's content from a previously cached PDF document."
|
||||
+ " Requires prior call to /pdf/json/metadata. The jobId must belong to the"
|
||||
+ " authenticated user. Output:JSON")
|
||||
public ResponseEntity<byte[]> extractSinglePage(
|
||||
@PathVariable String jobId, @PathVariable int pageNumber) throws Exception {
|
||||
@@ -182,11 +180,11 @@ public class ConvertPdfJsonController {
|
||||
return WebResponseUtils.bytesToWebResponse(jsonBytes, docName, MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/pdf/text-editor/clear-cache/{jobId}")
|
||||
@PostMapping(value = "/pdf/json/clear-cache/{jobId}")
|
||||
@Operation(
|
||||
summary = "Clear cached PDF document for text editor",
|
||||
summary = "Clear cached PDF document",
|
||||
description =
|
||||
"Manually clears a cached PDF document used by the text editor to free up server resources."
|
||||
"Manually clears a cached PDF document to free up server resources."
|
||||
+ " Called automatically after 30 minutes. The jobId must belong to the"
|
||||
+ " authenticated user.")
|
||||
public ResponseEntity<Void> clearCache(@PathVariable String jobId) {
|
||||
|
||||
@@ -342,7 +342,7 @@ public class PdfJsonConversionService {
|
||||
document, page, pageNumber, fonts, fontCache, jobId);
|
||||
pageFontResources.put(pageNumber, resourceMap);
|
||||
log.debug(
|
||||
"PDF->JSON: collected {} font resources on page {}",
|
||||
"PDF→JSON: collected {} font resources on page {}",
|
||||
resourceMap.size(),
|
||||
pageNumber);
|
||||
|
||||
@@ -454,50 +454,11 @@ public class PdfJsonConversionService {
|
||||
progress.accept(
|
||||
PdfJsonConversionProgress.of(95, "serializing", "Generating JSON output"));
|
||||
|
||||
// Collect font issues for summary
|
||||
java.util.List<String> fontsWithMissingProgram =
|
||||
serializedFonts.stream()
|
||||
.filter(
|
||||
f ->
|
||||
Boolean.TRUE.equals(f.getEmbedded())
|
||||
&& (f.getProgram() == null
|
||||
|| f.getProgram().isEmpty()))
|
||||
.map(
|
||||
f -> {
|
||||
String name =
|
||||
f.getBaseName() != null
|
||||
? f.getBaseName()
|
||||
: "Unknown";
|
||||
String subtype =
|
||||
f.getSubtype() != null
|
||||
? f.getSubtype()
|
||||
: "Unknown";
|
||||
// Clean up subset prefix (e.g., "ABCDEF+TimesNewRoman"
|
||||
// -> "TimesNewRoman")
|
||||
String cleanName = name.replaceAll("^[A-Z]{6}\\+", "");
|
||||
return String.format("%s (%s)", cleanName, subtype);
|
||||
})
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
long type3Fonts =
|
||||
serializedFonts.stream()
|
||||
.filter(f -> "Type3".equals(f.getSubtype()))
|
||||
.count();
|
||||
|
||||
if (!fontsWithMissingProgram.isEmpty()) {
|
||||
log.warn(
|
||||
"PDF->JSON conversion complete: {} fonts ({} Type3), {} pages. Missing font programs for {} embedded font(s): {}",
|
||||
serializedFonts.size(),
|
||||
type3Fonts,
|
||||
pdfJson.getPages().size(),
|
||||
fontsWithMissingProgram.size(),
|
||||
String.join(", ", fontsWithMissingProgram));
|
||||
} else {
|
||||
log.info(
|
||||
"PDF->JSON conversion complete: {} fonts ({} Type3), {} pages",
|
||||
serializedFonts.size(),
|
||||
type3Fonts,
|
||||
pdfJson.getPages().size());
|
||||
}
|
||||
log.debug(
|
||||
"PDF→JSON conversion complete (fonts: {}, pages: {}, lazyImages: {})",
|
||||
serializedFonts.size(),
|
||||
pdfJson.getPages().size(),
|
||||
useLazyImages);
|
||||
|
||||
byte[] result = objectMapper.writeValueAsBytes(pdfJson);
|
||||
progress.accept(PdfJsonConversionProgress.complete());
|
||||
@@ -529,7 +490,7 @@ public class PdfJsonConversionService {
|
||||
pdfJson.setFonts(fontModels);
|
||||
}
|
||||
|
||||
// Generate synthetic jobId for this JSON->PDF conversion to prevent cache collisions
|
||||
// Generate synthetic jobId for this JSON→PDF conversion to prevent cache collisions
|
||||
// Each conversion gets its own namespace for Type3 font caching
|
||||
String syntheticJobId = "json2pdf:" + java.util.UUID.randomUUID().toString();
|
||||
|
||||
@@ -548,8 +509,6 @@ public class PdfJsonConversionService {
|
||||
}
|
||||
|
||||
int pageIndex = 0;
|
||||
Set<String> allFallbackFontIds = new java.util.HashSet<>();
|
||||
int pagesWithFallbacks = 0;
|
||||
for (PdfJsonPage pageModel : pages) {
|
||||
int pageNumberValue =
|
||||
pageModel.getPageNumber() != null
|
||||
@@ -604,9 +563,7 @@ public class PdfJsonConversionService {
|
||||
|
||||
if (!preflightResult.fallbackFontIds().isEmpty()) {
|
||||
ensureFallbackResources(page, preflightResult.fallbackFontIds(), fontMap);
|
||||
allFallbackFontIds.addAll(preflightResult.fallbackFontIds());
|
||||
pagesWithFallbacks++;
|
||||
log.debug(
|
||||
log.info(
|
||||
"Page {} registered fallback fonts: {}",
|
||||
pageNumberValue,
|
||||
preflightResult.fallbackFontIds());
|
||||
@@ -698,18 +655,6 @@ public class PdfJsonConversionService {
|
||||
pdfJson.getFormFields() != null ? pdfJson.getFormFields() : new ArrayList<>();
|
||||
restoreFormFields(document, formFields);
|
||||
|
||||
// Log conversion summary
|
||||
if (!allFallbackFontIds.isEmpty()) {
|
||||
log.info(
|
||||
"JSON->PDF conversion complete: {} pages, {} fallback font(s) used across {} page(s): {}",
|
||||
pages.size(),
|
||||
allFallbackFontIds.size(),
|
||||
pagesWithFallbacks,
|
||||
allFallbackFontIds);
|
||||
} else {
|
||||
log.info("JSON->PDF conversion complete: {} pages", pages.size());
|
||||
}
|
||||
|
||||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
||||
document.save(baos);
|
||||
byte[] result = baos.toByteArray();
|
||||
@@ -846,7 +791,7 @@ public class PdfJsonConversionService {
|
||||
if (font.getId() == null) {
|
||||
return null;
|
||||
}
|
||||
// JSON->PDF conversion: no jobId context, pass null
|
||||
// JSON→PDF conversion: no jobId context, pass null
|
||||
return buildFontKey(null, font.getPageNumber(), font.getId());
|
||||
}
|
||||
|
||||
@@ -859,7 +804,7 @@ public class PdfJsonConversionService {
|
||||
if (font == null || font.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
// JSON->PDF conversion: no jobId context, pass null
|
||||
// JSON→PDF conversion: no jobId context, pass null
|
||||
lookup.put(buildFontKey(null, font.getPageNumber(), font.getId()), font);
|
||||
}
|
||||
return lookup;
|
||||
@@ -870,7 +815,7 @@ public class PdfJsonConversionService {
|
||||
if (lookup == null || fontId == null) {
|
||||
return null;
|
||||
}
|
||||
// JSON->PDF conversion: no jobId context, pass null
|
||||
// JSON→PDF conversion: no jobId context, pass null
|
||||
PdfJsonFont model = lookup.get(buildFontKey(null, pageNumber, fontId));
|
||||
if (model != null) {
|
||||
return model;
|
||||
@@ -1316,8 +1261,6 @@ public class PdfJsonConversionService {
|
||||
|
||||
Set<String> fallbackIds = new LinkedHashSet<>();
|
||||
boolean fallbackNeeded = false;
|
||||
Set<String> warnedFonts =
|
||||
new HashSet<>(); // Track fonts we've already warned about on this page
|
||||
|
||||
Map<String, PdfJsonFont> fontLookup = buildFontModelLookup(fontModels);
|
||||
Map<String, Set<Integer>> type3GlyphCache = new HashMap<>();
|
||||
@@ -1383,22 +1326,12 @@ public class PdfJsonConversionService {
|
||||
}
|
||||
|
||||
if (!fallbackFontService.canEncodeFully(font, text)) {
|
||||
String fontName =
|
||||
fontModel != null && fontModel.getBaseName() != null
|
||||
? fontModel
|
||||
.getBaseName()
|
||||
.replaceAll("^[A-Z]{6}\\+", "") // Remove subset prefix
|
||||
: (font != null ? font.getName() : "unknown");
|
||||
String fontKey = fontName + ":" + element.getFontId() + ":" + pageNumber;
|
||||
if (!warnedFonts.contains(fontKey)) {
|
||||
log.warn(
|
||||
"[FALLBACK-NEEDED] Font '{}' (resource {}, subtype {}) cannot encode text on page {}. Using fallback font.",
|
||||
fontName,
|
||||
element.getFontId(),
|
||||
fontModel != null ? fontModel.getSubtype() : "unknown",
|
||||
pageNumber);
|
||||
warnedFonts.add(fontKey);
|
||||
}
|
||||
log.info(
|
||||
"[FONT-DEBUG] Font {} (resource {}) cannot encode text '{}' on page {}",
|
||||
fontModel != null ? fontModel.getId() : "unknown",
|
||||
element.getFontId(),
|
||||
text,
|
||||
pageNumber);
|
||||
fallbackNeeded = true;
|
||||
element.setFallbackUsed(Boolean.TRUE);
|
||||
for (int offset = 0; offset < text.length(); ) {
|
||||
@@ -1680,17 +1613,17 @@ public class PdfJsonConversionService {
|
||||
|
||||
PDStream fontFile2 = descriptor.getFontFile2();
|
||||
if (fontFile2 != null) {
|
||||
log.debug("[FONT-DEBUG] Font {}: Found FontFile2 (TrueType)", font.getName());
|
||||
log.info("[FONT-DEBUG] Font {}: Found FontFile2 (TrueType)", font.getName());
|
||||
return readFontProgram(fontFile2, null, true, toUnicode);
|
||||
}
|
||||
|
||||
PDStream fontFile = descriptor.getFontFile();
|
||||
if (fontFile != null) {
|
||||
log.debug("[FONT-DEBUG] Font {}: Found FontFile (Type1)", font.getName());
|
||||
log.info("[FONT-DEBUG] Font {}: Found FontFile (Type1)", font.getName());
|
||||
return readFontProgram(fontFile, "type1", false, toUnicode);
|
||||
}
|
||||
|
||||
log.debug("[FONT-DEBUG] Font {}: No font program found", font.getName());
|
||||
log.warn("[FONT-DEBUG] Font {}: No font program found", font.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1705,7 +1638,7 @@ public class PdfJsonConversionService {
|
||||
if (detectTrueType) {
|
||||
format = fontService.detectTrueTypeFormat(data);
|
||||
}
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Font program: size={} bytes, formatHint={}, detectedFormat={}",
|
||||
data.length,
|
||||
formatHint,
|
||||
@@ -1716,7 +1649,7 @@ public class PdfJsonConversionService {
|
||||
String pdfBase64 = null;
|
||||
String pdfFormat = null;
|
||||
if (format != null && isCffFormat(format)) {
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Font is CFF format, attempting conversion. CFF conversion enabled: {}, method: {}",
|
||||
fontService.isCffConversionEnabled(),
|
||||
fontService.getCffConverterMethod());
|
||||
@@ -1726,7 +1659,7 @@ public class PdfJsonConversionService {
|
||||
String detectedFormat = fontService.detectFontFlavor(converted);
|
||||
webBase64 = Base64.getEncoder().encodeToString(converted);
|
||||
webFormat = detectedFormat;
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Primary CFF conversion succeeded: {} bytes -> {}",
|
||||
data.length,
|
||||
detectedFormat);
|
||||
@@ -1735,11 +1668,11 @@ public class PdfJsonConversionService {
|
||||
pdfFormat = detectedFormat;
|
||||
}
|
||||
} else {
|
||||
log.debug("[FONT-DEBUG] Primary CFF conversion returned null/empty");
|
||||
log.warn("[FONT-DEBUG] Primary CFF conversion returned null/empty");
|
||||
}
|
||||
|
||||
if (pdfBase64 == null && fontService.isCffConversionEnabled()) {
|
||||
log.debug("[FONT-DEBUG] Attempting fallback FontForge conversion");
|
||||
log.info("[FONT-DEBUG] Attempting fallback FontForge conversion");
|
||||
byte[] ttfConverted = fontService.convertCffUsingFontForge(data);
|
||||
if (ttfConverted != null && ttfConverted.length > 0) {
|
||||
String detectedFormat = fontService.detectFontFlavor(ttfConverted);
|
||||
@@ -1750,24 +1683,24 @@ public class PdfJsonConversionService {
|
||||
webBase64 = pdfBase64;
|
||||
webFormat = detectedFormat;
|
||||
}
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] FontForge conversion succeeded: {} bytes -> {}",
|
||||
data.length,
|
||||
detectedFormat);
|
||||
}
|
||||
} else {
|
||||
log.debug("[FONT-DEBUG] FontForge conversion also returned null/empty");
|
||||
log.warn("[FONT-DEBUG] FontForge conversion also returned null/empty");
|
||||
}
|
||||
}
|
||||
|
||||
if (webBase64 == null && pdfBase64 == null) {
|
||||
log.warn(
|
||||
log.error(
|
||||
"[FONT-DEBUG] ALL CFF conversions failed - font will not be usable in browser!");
|
||||
}
|
||||
} else if (format != null) {
|
||||
log.debug("[FONT-DEBUG] Font is non-CFF format ({}), using as-is", format);
|
||||
log.info("[FONT-DEBUG] Font is non-CFF format ({}), using as-is", format);
|
||||
// For non-CFF formats (TrueType, etc.), preserve original font stream as pdfProgram
|
||||
// This allows PDFBox to reconstruct the font during JSON->PDF
|
||||
// This allows PDFBox to reconstruct the font during JSON→PDF
|
||||
String base64 = Base64.getEncoder().encodeToString(data);
|
||||
pdfBase64 = base64;
|
||||
pdfFormat = format;
|
||||
@@ -2887,7 +2820,12 @@ public class PdfJsonConversionService {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fallback applied - tracked at page level, not logged per character
|
||||
if (targetFont != baseFont) {
|
||||
log.info(
|
||||
"Using fallback font '{}' for code point U+{}",
|
||||
targetFont.getName(),
|
||||
Integer.toHexString(codePoint));
|
||||
}
|
||||
}
|
||||
|
||||
boolean useRawType3Glyph =
|
||||
@@ -3467,7 +3405,7 @@ public class PdfJsonConversionService {
|
||||
byte[] encoded = font.encode(text);
|
||||
return sanitizeEncoded(encoded);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Font {} cannot encode text '{}': {}",
|
||||
font.getName(),
|
||||
text,
|
||||
@@ -3706,7 +3644,7 @@ public class PdfJsonConversionService {
|
||||
}
|
||||
PDFont loadedFont = createFontFromModel(document, fontModel, jobId);
|
||||
if (loadedFont != null && fontModel.getId() != null) {
|
||||
// Use null jobId for map keys - JSON->PDF doesn't need job-scoped lookups
|
||||
// Use null jobId for map keys - JSON→PDF doesn't need job-scoped lookups
|
||||
// The jobId is only used internally for Type3 cache isolation
|
||||
fontMap.put(
|
||||
buildFontKey(null, fontModel.getPageNumber(), fontModel.getId()),
|
||||
@@ -3721,7 +3659,7 @@ public class PdfJsonConversionService {
|
||||
PdfJsonFont fallbackModel = fallbackFontService.buildFallbackFontModel();
|
||||
if (fonts != null) {
|
||||
fonts.add(fallbackModel);
|
||||
log.debug("Added fallback font definition to JSON font list");
|
||||
log.info("Added fallback font definition to JSON font list");
|
||||
}
|
||||
PDFont fallbackFont = createFontFromModel(document, fallbackModel, jobId);
|
||||
fontMap.put(buildFontKey(null, -1, FALLBACK_FONT_ID), fallbackFont);
|
||||
@@ -4181,7 +4119,7 @@ public class PdfJsonConversionService {
|
||||
}
|
||||
|
||||
applyAdditionalFontMetadata(document, font, fontModel);
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-RESTORE] Successfully restored embedded font {} (subtype={}) from original dictionary",
|
||||
fontModel.getId(),
|
||||
font.getSubType());
|
||||
|
||||
@@ -44,15 +44,12 @@ public class PdfJsonFallbackFontService {
|
||||
Map.entry("arial", "fallback-liberation-sans"),
|
||||
Map.entry("helvetica", "fallback-liberation-sans"),
|
||||
Map.entry("arimo", "fallback-liberation-sans"),
|
||||
Map.entry("liberationsans", "fallback-liberation-sans"),
|
||||
Map.entry("times", "fallback-liberation-serif"),
|
||||
Map.entry("timesnewroman", "fallback-liberation-serif"),
|
||||
Map.entry("tinos", "fallback-liberation-serif"),
|
||||
Map.entry("liberationserif", "fallback-liberation-serif"),
|
||||
Map.entry("courier", "fallback-liberation-mono"),
|
||||
Map.entry("couriernew", "fallback-liberation-mono"),
|
||||
Map.entry("cousine", "fallback-liberation-mono"),
|
||||
Map.entry("liberationmono", "fallback-liberation-mono"),
|
||||
// DejaVu fonts - widely used open source fonts
|
||||
Map.entry("dejavu", "fallback-dejavu-sans"),
|
||||
Map.entry("dejavusans", "fallback-dejavu-sans"),
|
||||
@@ -80,9 +77,7 @@ public class PdfJsonFallbackFontService {
|
||||
Map.entry(
|
||||
FALLBACK_FONT_KR_ID,
|
||||
new FallbackFontSpec(
|
||||
"classpath:/static/fonts/NotoSansKR-Regular.ttf",
|
||||
"NotoSansKR-Regular",
|
||||
"ttf")),
|
||||
"classpath:/static/fonts/malgun.ttf", "MalgunGothic", "ttf")),
|
||||
Map.entry(
|
||||
FALLBACK_FONT_AR_ID,
|
||||
new FallbackFontSpec(
|
||||
@@ -332,8 +327,7 @@ public class PdfJsonFallbackFontService {
|
||||
font.encode(text);
|
||||
return true;
|
||||
} catch (IOException | IllegalArgumentException | UnsupportedOperationException ex) {
|
||||
// Only log at debug level to reduce verbosity - summary is logged elsewhere
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Font {} cannot encode text '{}' ({}): {}",
|
||||
font != null ? font.getName() : "null",
|
||||
text,
|
||||
|
||||
@@ -93,35 +93,34 @@ public class PdfJsonFontService {
|
||||
|
||||
if ("python".equalsIgnoreCase(cffConverterMethod)) {
|
||||
if (!pythonCffConverterAvailable) {
|
||||
log.debug("[FONT-DEBUG] Python CFF converter not available, skipping conversion");
|
||||
log.warn("[FONT-DEBUG] Python CFF converter not available, skipping conversion");
|
||||
return null;
|
||||
}
|
||||
byte[] result = convertCffUsingPython(fontBytes, toUnicode);
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Python conversion result: {}",
|
||||
result == null ? "null" : result.length + " bytes");
|
||||
return result;
|
||||
} else if ("fontforge".equalsIgnoreCase(cffConverterMethod)) {
|
||||
if (!fontForgeCffConverterAvailable) {
|
||||
log.debug(
|
||||
"[FONT-DEBUG] FontForge CFF converter not available, skipping conversion");
|
||||
log.warn("[FONT-DEBUG] FontForge CFF converter not available, skipping conversion");
|
||||
return null;
|
||||
}
|
||||
byte[] result = convertCffUsingFontForge(fontBytes);
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] FontForge conversion result: {}",
|
||||
result == null ? "null" : result.length + " bytes");
|
||||
return result;
|
||||
} else {
|
||||
log.debug(
|
||||
log.warn(
|
||||
"[FONT-DEBUG] Unknown CFF converter method: {}, falling back to Python",
|
||||
cffConverterMethod);
|
||||
if (!pythonCffConverterAvailable) {
|
||||
log.debug("[FONT-DEBUG] Python CFF converter not available, skipping conversion");
|
||||
log.warn("[FONT-DEBUG] Python CFF converter not available, skipping conversion");
|
||||
return null;
|
||||
}
|
||||
byte[] result = convertCffUsingPython(fontBytes, toUnicode);
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Python conversion result: {}",
|
||||
result == null ? "null" : result.length + " bytes");
|
||||
return result;
|
||||
@@ -183,18 +182,18 @@ public class PdfJsonFontService {
|
||||
|
||||
private byte[] convertCffUsingPython(byte[] fontBytes, String toUnicode) {
|
||||
if (!pythonCffConverterAvailable) {
|
||||
log.debug("[FONT-DEBUG] Python CFF converter not available");
|
||||
log.warn("[FONT-DEBUG] Python CFF converter not available");
|
||||
return null;
|
||||
}
|
||||
if (pythonCommand == null
|
||||
|| pythonCommand.isBlank()
|
||||
|| pythonScript == null
|
||||
|| pythonScript.isBlank()) {
|
||||
log.debug("[FONT-DEBUG] Python converter not configured");
|
||||
log.warn("[FONT-DEBUG] Python converter not configured");
|
||||
return null;
|
||||
}
|
||||
|
||||
log.debug(
|
||||
log.info(
|
||||
"[FONT-DEBUG] Running Python CFF converter: command={}, script={}",
|
||||
pythonCommand,
|
||||
pythonScript);
|
||||
@@ -209,7 +208,7 @@ public class PdfJsonFontService {
|
||||
byte[] toUnicodeBytes = Base64.getDecoder().decode(toUnicode);
|
||||
Files.write(toUnicodeFile.getPath(), toUnicodeBytes);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
log.debug(
|
||||
log.warn(
|
||||
"[FONT-DEBUG] Failed to decode ToUnicode data for CFF conversion: {}",
|
||||
ex.getMessage());
|
||||
return null;
|
||||
@@ -221,7 +220,7 @@ public class PdfJsonFontService {
|
||||
inputFile.getAbsolutePath(),
|
||||
outputFile.getAbsolutePath(),
|
||||
toUnicodeFile != null ? toUnicodeFile.getAbsolutePath() : null);
|
||||
log.debug("[FONT-DEBUG] Executing: {}", String.join(" ", command));
|
||||
log.info("[FONT-DEBUG] Executing: {}", String.join(" ", command));
|
||||
|
||||
ProcessExecutorResult result =
|
||||
ProcessExecutor.getInstance(ProcessExecutor.Processes.CFF_CONVERTER)
|
||||
|
||||
@@ -108,7 +108,7 @@ public class Type3FontConversionService {
|
||||
if (result.getStrategyLabel() == null) {
|
||||
result.setStrategyLabel(strategy.getLabel());
|
||||
}
|
||||
log.debug(
|
||||
log.info(
|
||||
"[TYPE3] Strategy {} finished with status {} (message: {}) for font {}",
|
||||
strategy.getId(),
|
||||
result.getStatus(),
|
||||
|
||||
@@ -120,37 +120,6 @@ public class ProprietaryUIDataController {
|
||||
// Add enableLogin flag so frontend doesn't need to call /app-config
|
||||
data.setEnableLogin(securityProps.getEnableLogin());
|
||||
|
||||
// Check if this is first-time setup with default credentials
|
||||
// The isFirstLogin flag captures: default username/password usage and unchanged state
|
||||
boolean isFirstTimeSetup = false;
|
||||
boolean showDefaultCredentials = false;
|
||||
|
||||
List<User> allUsers = userRepository.findAll();
|
||||
List<User> realUsers =
|
||||
allUsers.stream()
|
||||
.filter(
|
||||
user ->
|
||||
!Role.INTERNAL_API_USER
|
||||
.getRoleId()
|
||||
.equals(user.getUsername()))
|
||||
.toList();
|
||||
long userCount = realUsers.size();
|
||||
|
||||
if (userCount == 0) {
|
||||
isFirstTimeSetup = true;
|
||||
showDefaultCredentials = true;
|
||||
} else if (userCount == 1) {
|
||||
Optional<User> adminUser = userRepository.findByUsernameIgnoreCase("admin");
|
||||
|
||||
if (adminUser.isPresent() && Boolean.TRUE.equals(adminUser.get().getIsFirstLogin())) {
|
||||
isFirstTimeSetup = true;
|
||||
showDefaultCredentials = true;
|
||||
}
|
||||
}
|
||||
|
||||
data.setFirstTimeSetup(isFirstTimeSetup);
|
||||
data.setShowDefaultCredentials(showDefaultCredentials);
|
||||
|
||||
OAUTH2 oauth = securityProps.getOauth2();
|
||||
|
||||
if (oauth != null && oauth.getEnabled()) {
|
||||
@@ -487,8 +456,6 @@ public class ProprietaryUIDataController {
|
||||
private Map<String, String> providerList;
|
||||
private String loginMethod;
|
||||
private boolean altLogin;
|
||||
private boolean firstTimeSetup;
|
||||
private boolean showDefaultCredentials;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -113,12 +113,7 @@ public class LicenseKeyChecker {
|
||||
|
||||
public void updateLicenseKey(String newKey) throws IOException {
|
||||
applicationProperties.getPremium().setKey(newKey);
|
||||
GeneralUtils.saveKeyToSettings("premium.key", newKey);
|
||||
evaluateLicense();
|
||||
synchronizeLicenseSettings();
|
||||
}
|
||||
|
||||
public void resyncLicense() {
|
||||
GeneralUtils.saveKeyToSettings("EnterpriseEdition.key", newKey);
|
||||
evaluateLicense();
|
||||
synchronizeLicenseSettings();
|
||||
}
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
package stirling.software.proprietary.security.controller.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.util.GeneralUtils;
|
||||
import stirling.software.proprietary.security.configuration.ee.KeygenLicenseVerifier;
|
||||
import stirling.software.proprietary.security.configuration.ee.KeygenLicenseVerifier.License;
|
||||
import stirling.software.proprietary.security.configuration.ee.LicenseKeyChecker;
|
||||
|
||||
/**
|
||||
* Admin controller for license management. Provides installation ID for Stripe checkout metadata
|
||||
* and endpoints for managing license keys.
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/api/v1/admin")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@Tag(name = "Admin License Management", description = "Admin-only License Management APIs")
|
||||
public class AdminLicenseController {
|
||||
|
||||
@Autowired(required = false)
|
||||
private LicenseKeyChecker licenseKeyChecker;
|
||||
|
||||
@Autowired(required = false)
|
||||
private KeygenLicenseVerifier keygenLicenseVerifier;
|
||||
|
||||
@Autowired private ApplicationProperties applicationProperties;
|
||||
|
||||
/**
|
||||
* Get the installation ID (machine fingerprint) for this self-hosted instance. This ID is used
|
||||
* as metadata in Stripe checkout to link licenses to specific installations.
|
||||
*
|
||||
* @return Map containing the installation ID
|
||||
*/
|
||||
@GetMapping("/installation-id")
|
||||
@Operation(
|
||||
summary = "Get installation ID",
|
||||
description =
|
||||
"Returns the unique installation ID (MAC-based fingerprint) for this"
|
||||
+ " self-hosted instance")
|
||||
public ResponseEntity<Map<String, String>> getInstallationId() {
|
||||
try {
|
||||
String installationId = GeneralUtils.generateMachineFingerprint();
|
||||
log.info("Admin requested installation ID: {}", installationId);
|
||||
return ResponseEntity.ok(Map.of("installationId", installationId));
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to generate installation ID", e);
|
||||
return ResponseEntity.internalServerError()
|
||||
.body(Map.of("error", "Failed to generate installation ID"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save and activate a license key. This endpoint accepts a license key from the frontend (e.g.,
|
||||
* after Stripe checkout) and activates it on the backend.
|
||||
*
|
||||
* @param request Map containing the license key
|
||||
* @return Response with success status, license type, and whether restart is required
|
||||
*/
|
||||
@PostMapping("/license-key")
|
||||
@Operation(
|
||||
summary = "Save and activate license key",
|
||||
description =
|
||||
"Accepts a license key and activates it on the backend. Returns the activated"
|
||||
+ " license type.")
|
||||
public ResponseEntity<Map<String, Object>> saveLicenseKey(
|
||||
@RequestBody Map<String, String> request) {
|
||||
String licenseKey = request.get("licenseKey");
|
||||
|
||||
// Reject null but allow empty string to clear license
|
||||
if (licenseKey == null) {
|
||||
return ResponseEntity.badRequest()
|
||||
.body(Map.of("success", false, "error", "License key is required"));
|
||||
}
|
||||
|
||||
try {
|
||||
if (licenseKeyChecker == null) {
|
||||
return ResponseEntity.internalServerError()
|
||||
.body(Map.of("success", false, "error", "License checker not available"));
|
||||
}
|
||||
// assume premium enabled when setting license key
|
||||
applicationProperties.getPremium().setEnabled(true);
|
||||
|
||||
// Use existing LicenseKeyChecker to update and validate license
|
||||
// Empty string will be evaluated as NORMAL license (free tier)
|
||||
licenseKeyChecker.updateLicenseKey(licenseKey.trim());
|
||||
|
||||
// Get current license status
|
||||
License license = licenseKeyChecker.getPremiumLicenseEnabledResult();
|
||||
|
||||
// Auto-enable premium features if license is valid
|
||||
if (license != License.NORMAL) {
|
||||
GeneralUtils.saveKeyToSettings("premium.enabled", true);
|
||||
// Enable premium features
|
||||
|
||||
// Save maxUsers from license metadata
|
||||
Integer maxUsers = applicationProperties.getPremium().getMaxUsers();
|
||||
if (maxUsers != null) {
|
||||
GeneralUtils.saveKeyToSettings("premium.maxUsers", maxUsers);
|
||||
}
|
||||
} else {
|
||||
GeneralUtils.saveKeyToSettings("premium.enabled", false);
|
||||
log.info("License key is not valid for premium features: type={}", license.name());
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("success", true);
|
||||
response.put("licenseType", license.name());
|
||||
response.put("enabled", applicationProperties.getPremium().isEnabled());
|
||||
response.put("maxUsers", applicationProperties.getPremium().getMaxUsers());
|
||||
response.put("requiresRestart", false); // Dynamic evaluation works
|
||||
response.put("message", "License key saved and activated");
|
||||
|
||||
log.info("License key saved and activated: type={}", license.name());
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to save license key", e);
|
||||
return ResponseEntity.badRequest()
|
||||
.body(
|
||||
Map.of(
|
||||
"success",
|
||||
false,
|
||||
"error",
|
||||
"Failed to activate license: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resync the current license with Keygen. This endpoint re-validates the existing license key
|
||||
* and updates the max users setting. Used after subscription upgrades to sync the new license
|
||||
* limits.
|
||||
*
|
||||
* @return Response with updated license information
|
||||
*/
|
||||
@PostMapping("/license/resync")
|
||||
@Operation(
|
||||
summary = "Resync license with Keygen",
|
||||
description =
|
||||
"Re-validates the existing license key with Keygen and updates local settings."
|
||||
+ " Used after subscription upgrades.")
|
||||
public ResponseEntity<Map<String, Object>> resyncLicense() {
|
||||
try {
|
||||
if (licenseKeyChecker == null) {
|
||||
return ResponseEntity.internalServerError()
|
||||
.body(Map.of("success", false, "error", "License checker not available"));
|
||||
}
|
||||
|
||||
String currentKey = applicationProperties.getPremium().getKey();
|
||||
if (currentKey == null || currentKey.trim().isEmpty()) {
|
||||
return ResponseEntity.badRequest()
|
||||
.body(Map.of("success", false, "error", "No license key configured"));
|
||||
}
|
||||
|
||||
log.info("Resyncing license with Keygen");
|
||||
|
||||
// Re-validate license and sync settings
|
||||
licenseKeyChecker.resyncLicense();
|
||||
|
||||
// Get updated license status
|
||||
License license = licenseKeyChecker.getPremiumLicenseEnabledResult();
|
||||
ApplicationProperties.Premium premium = applicationProperties.getPremium();
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("success", true);
|
||||
response.put("licenseType", license.name());
|
||||
response.put("enabled", premium.isEnabled());
|
||||
response.put("maxUsers", premium.getMaxUsers());
|
||||
response.put("message", "License resynced successfully");
|
||||
|
||||
log.info(
|
||||
"License resynced: type={}, maxUsers={}",
|
||||
license.name(),
|
||||
premium.getMaxUsers());
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to resync license", e);
|
||||
return ResponseEntity.internalServerError()
|
||||
.body(
|
||||
Map.of(
|
||||
"success",
|
||||
false,
|
||||
"error",
|
||||
"Failed to resync license: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about the current license key status, including license type, enabled status,
|
||||
* and max users.
|
||||
*
|
||||
* @return Map containing license information
|
||||
*/
|
||||
@GetMapping("/license-info")
|
||||
@Operation(
|
||||
summary = "Get license information",
|
||||
description =
|
||||
"Returns information about the current license including type, enabled status,"
|
||||
+ " and max users")
|
||||
public ResponseEntity<Map<String, Object>> getLicenseInfo() {
|
||||
try {
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
if (licenseKeyChecker != null) {
|
||||
License license = licenseKeyChecker.getPremiumLicenseEnabledResult();
|
||||
response.put("licenseType", license.name());
|
||||
} else {
|
||||
response.put("licenseType", License.NORMAL.name());
|
||||
}
|
||||
|
||||
ApplicationProperties.Premium premium = applicationProperties.getPremium();
|
||||
response.put("enabled", premium.isEnabled());
|
||||
response.put("maxUsers", premium.getMaxUsers());
|
||||
response.put("hasKey", premium.getKey() != null && !premium.getKey().trim().isEmpty());
|
||||
|
||||
// Include license key for upgrades (admin-only endpoint)
|
||||
if (premium.getKey() != null && !premium.getKey().trim().isEmpty()) {
|
||||
response.put("licenseKey", premium.getKey());
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to get license info", e);
|
||||
return ResponseEntity.internalServerError()
|
||||
.body(Map.of("error", "Failed to retrieve license information"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,16 +299,6 @@ public class AdminSettingsController {
|
||||
+ String.join(", ", VALID_SECTION_NAMES));
|
||||
}
|
||||
|
||||
// Auto-enable premium features if license key is provided
|
||||
if ("premium".equalsIgnoreCase(sectionName) && sectionData.containsKey("key")) {
|
||||
Object keyValue = sectionData.get("key");
|
||||
if (keyValue != null && !keyValue.toString().trim().isEmpty()) {
|
||||
// Automatically set enabled to true when a key is provided
|
||||
sectionData.put("enabled", true);
|
||||
log.info("Auto-enabling premium features because license key was provided");
|
||||
}
|
||||
}
|
||||
|
||||
int updatedCount = 0;
|
||||
for (Map.Entry<String, Object> entry : sectionData.entrySet()) {
|
||||
String propertyKey = entry.getKey();
|
||||
|
||||
@@ -15,7 +15,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.annotations.api.InviteApi;
|
||||
import stirling.software.common.annotations.api.UserApi;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.enumeration.Role;
|
||||
import stirling.software.proprietary.model.Team;
|
||||
@@ -26,9 +26,11 @@ import stirling.software.proprietary.security.service.EmailService;
|
||||
import stirling.software.proprietary.security.service.TeamService;
|
||||
import stirling.software.proprietary.security.service.UserService;
|
||||
|
||||
@InviteApi
|
||||
@UserApi
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/invite")
|
||||
public class InviteLinkController {
|
||||
|
||||
private final InviteTokenRepository inviteTokenRepository;
|
||||
|
||||
@@ -39,7 +39,7 @@ import stirling.software.proprietary.security.saml2.CustomSaml2AuthenticatedPrin
|
||||
public class JwtService implements JwtServiceInterface {
|
||||
|
||||
private static final String ISSUER = "https://stirling.com";
|
||||
private static final long EXPIRATION = 43200000;
|
||||
private static final long EXPIRATION = 3600000;
|
||||
|
||||
private final KeyPersistenceServiceInterface keyPersistenceService;
|
||||
private final boolean v2Enabled;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print('Usage: compare_json.py <file1> <file2>')
|
||||
sys.exit(1)
|
||||
|
||||
path1, path2 = map(Path, sys.argv[1:])
|
||||
|
||||
def load(path):
|
||||
with path.open('r', encoding='utf-8') as fh:
|
||||
return json.load(fh)
|
||||
|
||||
doc1 = load(path1)
|
||||
doc2 = load(path2)
|
||||
|
||||
if doc1 == doc2:
|
||||
print('Documents identical')
|
||||
sys.exit(0)
|
||||
|
||||
pages1 = doc1.get('pages', [])
|
||||
pages2 = doc2.get('pages', [])
|
||||
|
||||
for page_index, (p1, p2) in enumerate(zip(pages1, pages2), start=1):
|
||||
elems1 = p1.get('textElements') or []
|
||||
elems2 = p2.get('textElements') or []
|
||||
if len(elems1) != len(elems2):
|
||||
print(f'Page {page_index}: element count {len(elems1)} vs {len(elems2)}')
|
||||
diff_found = False
|
||||
for elem_index, (e1, e2) in enumerate(zip(elems1, elems2)):
|
||||
if e1 == e2:
|
||||
continue
|
||||
diff_found = True
|
||||
print(f'Page {page_index} element {elem_index} differs')
|
||||
common_keys = sorted(set(e1) | set(e2))
|
||||
for key in common_keys:
|
||||
if e1.get(key) != e2.get(key):
|
||||
print(f' {key}: {e1.get(key)!r} -> {e2.get(key)!r}')
|
||||
break
|
||||
if diff_found:
|
||||
break
|
||||
|
||||
@@ -29,6 +29,12 @@ services:
|
||||
METRICS_ENABLED: "true"
|
||||
SYSTEM_GOOGLEVISIBILITY: "true"
|
||||
SHOW_SURVEY: "true"
|
||||
STIRLING_PDF_JSON_FONT_NORMALIZATION_ENABLED: "false"
|
||||
STIRLING_PDF_JSON_CFF_CONVERTER_ENABLED: "true"
|
||||
STIRLING_PDF_JSON_CFF_CONVERTER_METHOD: python
|
||||
STIRLING_PDF_JSON_CFF_CONVERTER_PYTHON_COMMAND: /opt/venv/bin/python3
|
||||
STIRLING_PDF_JSON_CFF_CONVERTER_PYTHON_SCRIPT: /scripts/convert_cff_to_ttf.py
|
||||
LOGGING_LEVEL_stirling.software.SPDF.service.PdfJsonConversionService: TRACE
|
||||
networks:
|
||||
- stirling-network
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# PDF Text Editor Backlog
|
||||
|
||||
- **Type3 Font Support (Text Additions)**
|
||||
- Parse Type3 charprocs to extract glyph outlines, build a synthetic TrueType/OpenType font (FontTools, Ghostscript `ps2ttf`, etc.), and store it in `webProgram` / `pdfProgram` for client use.
|
||||
- Preserve the original Type3 resources for round-trip fidelity; use the synthesized font only for edited elements while reusing the original stream elsewhere.
|
||||
- Extend conversion logic so fallback kicks in only when conversion fails, and track which elements rely on the synthetic font to avoid mixing source glyphs (`PdfJsonConversionService.java:998-1090`, `1840-2012`).
|
||||
- Update the viewer/renderer to surface conversion errors and block editing when no faithful font can be produced.
|
||||
|
||||
- **Lazy Fetch Endpoints**
|
||||
- Provide separate endpoints to fetch:
|
||||
1. Raw COS dictionaries/font programs when the user opens advanced panels.
|
||||
2. Page-level raster/vector previews to avoid sending large `imageData` upfront.
|
||||
- Reuse the existing job cache (`documentCache`) to serve these on demand and clean up after timeouts (`PdfJsonConversionService.java:3608-3687`).
|
||||
|
||||
- **Editor UX Safeguards**
|
||||
- Mark groups using fallback glyphs so the UI can warn about possible appearance shifts. Font family matching is now implemented (Liberation fonts), but weight matching is still TODO, so bold/italic text using fallbacks may appear lighter than original.
|
||||
- Surface when Type3 conversion was downgraded (e.g., rasterized glyphs) and limit editing to operations that keep the PDF stable.
|
||||
- Reference: `frontend/src/proprietary/components/tools/pdfTextEditor/PdfTextEditorView.tsx:1260-1287`
|
||||
|
||||
- **Canonical Font Sharing**
|
||||
- Emit fonts once per unique embedded program. Add a `canonicalFonts` array containing the full payload (program, ToUnicode, metadata) and a compact `fontAliases` mapping `{pageNumber, fontId, canonicalUid}` so text elements can still reference per-page IDs.
|
||||
- Note: COS dictionaries are currently preserved for TrueType/Type0 fonts (needed for ToUnicode CMap). The canonical approach should maintain this preservation while deduplicating font programs.
|
||||
- Update `buildFontMap` to resolve aliases when recreating PDFBox fonts, and adjust the front end to load programs via the canonical UID.
|
||||
- Optional: expose a lazy endpoint for the original COS dictionary if the canonical record strips it, so export still reconstructs untouched fonts.
|
||||
|
||||
- **Font Weight Matching for Fallback Fonts** ✓ COMPLETED (January 2025)
|
||||
- Font family matching is now implemented:
|
||||
- Liberation fonts (metric-compatible with Microsoft core): Arial/Helvetica→LiberationSans, Times→LiberationSerif, Courier→LiberationMono
|
||||
- DejaVu fonts (widely used open source): DejaVu→DejaVuSans, DejaVuSerif, DejaVuMono
|
||||
- Noto fonts (Google universal font): Noto→NotoSans
|
||||
- Font weight/style matching is now implemented for multiple font families:
|
||||
- Liberation Sans/Serif/Mono: Regular, Bold, Italic, BoldItalic (full support)
|
||||
- Noto Sans: Regular, Bold, Italic, BoldItalic (full support)
|
||||
- DejaVu Sans/Serif/Mono: Regular, Bold, Italic/Oblique, BoldItalic/BoldOblique (full support)
|
||||
- All font variants registered in `BUILT_IN_FALLBACK_FONTS` map (`PdfJsonFallbackFontService.java:63-267`)
|
||||
- Weight/style detection implemented in `resolveFallbackFontId()`:
|
||||
- `detectBold()`: Detects "bold", "heavy", "black", or numeric weights 600-900 (e.g., "700wght")
|
||||
- `detectItalic()`: Detects "italic" or "oblique"
|
||||
- `applyWeightStyle()`: Applies appropriate suffix (handles both "italic" and "oblique" naming)
|
||||
- All fonts consolidated from Type3 library into main fonts directory for unified fallback support
|
||||
- Benefits: Comprehensive visual consistency when editing text in bold/italic fonts across many font families
|
||||
|
||||
- **Font Text Color Support**
|
||||
- Add support for reading and preserving text color information from PDF content streams
|
||||
- Enable color editing in the editor UI
|
||||
- Ensure proper round-trip conversion maintains color fidelity
|
||||
|
||||
- **Space Character Handling**
|
||||
- Improve handling of space characters as proper text elements
|
||||
- Ensure spaces are correctly preserved during text extraction and reconstruction
|
||||
- Fix any issues with space positioning and width calculations
|
||||
|
||||
- **Textbox Selection Enhancement**
|
||||
- Improve textbox selection behavior in the editor
|
||||
- Enhance user experience for selecting and manipulating text boxes
|
||||
- Address any selection precision or interaction issues
|
||||
@@ -0,0 +1,443 @@
|
||||
# PDF JSON Type3 Font System
|
||||
|
||||
## Overview
|
||||
|
||||
The PDF Text editor needs to handle **Type3 fonts** - custom vector fonts embedded in PDFs that don't follow standard font formats. These are common in PDFs generated by Matplotlib, LaTeX, scientific papers, and presentation tools.
|
||||
|
||||
When converting a PDF to JSON for editing, Type3 fonts present two challenges:
|
||||
1. **No Unicode mapping** - Character codes don't map to standard Unicode characters
|
||||
2. **Custom glyphs** - Each font contains vector drawing instructions unique to that PDF
|
||||
|
||||
This document explains how the system handles Type3 fonts during the full PDF → JSON → PDF workflow.
|
||||
|
||||
---
|
||||
|
||||
## Architecture Flow
|
||||
|
||||
### PDF → JSON Conversion Flow
|
||||
|
||||
```
|
||||
┌─────────────┐
|
||||
│ Input PDF │
|
||||
└──────┬──────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────┐
|
||||
│ PDFBox Parsing │
|
||||
│ - Extract text positions │
|
||||
│ - Identify fonts │
|
||||
└──────┬──────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────┐
|
||||
│ Font Detection │
|
||||
│ Is this a Type3 font? │
|
||||
└──────┬──────────────────────────┘
|
||||
│
|
||||
├─── YES (Type3) ───────────────────────┐
|
||||
│ │
|
||||
▼ ▼
|
||||
┌──────────────────────────┐ ┌──────────────────────────────┐
|
||||
│ Type3FontConversion │ │ Extract Type3 Metadata │
|
||||
│ Service │ │ - Glyph outlines (paths) │
|
||||
│ │ │ - Character codes │
|
||||
│ 1. Calculate signature │ │ - Font matrix │
|
||||
│ 2. Match against │ │ - Bounding boxes │
|
||||
│ library │ └──────────────────────────────┘
|
||||
└──────┬───────────────────┘
|
||||
│
|
||||
▼
|
||||
┌──────────────────────────────────────┐
|
||||
│ Library Match? │
|
||||
└──────┬───────────────────────────────┘
|
||||
│
|
||||
├─── FOUND ─────────────────────┐
|
||||
│ │
|
||||
│ ▼
|
||||
│ ┌─────────────────────────────┐
|
||||
│ │ Load Pre-built Font │
|
||||
│ │ - TTF/OTF from library │
|
||||
│ │ - Full Unicode mappings │
|
||||
│ │ - Web + PDF payloads │
|
||||
│ └──────────┬──────────────────┘
|
||||
│ │
|
||||
├─── NOT FOUND ──────────────────┘
|
||||
│
|
||||
▼
|
||||
┌──────────────────────────────────────┐
|
||||
│ Store Type3 Metadata in JSON │
|
||||
│ - type3Glyphs: [{charCode, unicode, │
|
||||
│ glyphName, outline}] │
|
||||
│ - Original char codes preserved │
|
||||
│ - Font marked as Type3 │
|
||||
└──────┬───────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ PdfJsonDocument Output │
|
||||
│ { │
|
||||
│ fonts: [{ │
|
||||
│ id: "F1", │
|
||||
│ baseName: "ABCD+DejaVuSans", │
|
||||
│ subtype: "Type3", │
|
||||
│ type3Glyphs: [...], │
|
||||
│ conversionCandidates: [{ │
|
||||
│ strategyId: "type3-library", │
|
||||
│ status: "SUCCESS", │
|
||||
│ pdfProgram: "base64...", │
|
||||
│ glyphCoverage: [65,66,67...] │
|
||||
│ }] │
|
||||
│ }], │
|
||||
│ textElements: [{ │
|
||||
│ text: "Hello", │
|
||||
│ fontId: "F1", │
|
||||
│ charCodes: [72,101,108,108,111]│
|
||||
│ }] │
|
||||
│ } │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### JSON → PDF Conversion Flow
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ Input JSON (edited by user) │
|
||||
└──────┬──────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Load Fonts from JSON │
|
||||
│ - Check for conversionCandidates │
|
||||
│ - Check for type3Glyphs │
|
||||
└──────┬──────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Has conversionCandidates? │
|
||||
└──────┬──────────────────────────────┘
|
||||
│
|
||||
├─── YES (Library Match) ───────┐
|
||||
│ │
|
||||
│ ▼
|
||||
│ ┌─────────────────────────────┐
|
||||
│ │ Load from Candidate │
|
||||
│ │ 1. Decode base64 pdfProgram│
|
||||
│ │ 2. Create PDType0Font │
|
||||
│ │ 3. Embed in new PDF │
|
||||
│ └──────────┬──────────────────┘
|
||||
│ │
|
||||
├─── NO (Use Type3 Metadata) ───┘
|
||||
│
|
||||
▼
|
||||
┌──────────────────────────────────────┐
|
||||
│ Text Rendering Strategy │
|
||||
│ - Normalized Type3 fonts: │
|
||||
│ Use original text (font has │
|
||||
│ Unicode mappings) │
|
||||
│ │
|
||||
│ - Actual Type3 fonts: │
|
||||
│ Use charCodes array │
|
||||
│ │
|
||||
│ - Other fonts: │
|
||||
│ Standard encoding │
|
||||
└──────┬───────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Generate PDF Content Streams │
|
||||
│ - Set font: /F1 12 Tf │
|
||||
│ - Position text: x y Td │
|
||||
│ - Show text: (encoded) Tj │
|
||||
└──────┬──────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Output PDF │
|
||||
│ - Fonts embedded correctly │
|
||||
│ - Text renders with proper glyphs │
|
||||
│ - Preserves visual appearance │
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Components
|
||||
|
||||
### 1. Type3 Font Signature Matching
|
||||
|
||||
**Location:** `Type3FontSignatureCalculator.java`
|
||||
|
||||
**Purpose:** Creates a unique fingerprint of a Type3 font based on its glyph shapes.
|
||||
|
||||
**How it works:**
|
||||
```java
|
||||
// 1. Extract glyph outlines from Type3 font
|
||||
List<Type3GlyphOutline> glyphs = extractor.extractGlyphs(document, font, fontId, pageNumber);
|
||||
|
||||
// 2. Normalize and hash the shapes
|
||||
String signature = calculator.calculateSignature(glyphs);
|
||||
// Result: "sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e..."
|
||||
|
||||
// 3. Look up in library
|
||||
Optional<Match> match = library.findBySignature(signature);
|
||||
```
|
||||
|
||||
**Signature includes:**
|
||||
- Glyph outline paths (curves, lines)
|
||||
- Glyph bounding boxes
|
||||
- Advance widths
|
||||
- Character code mappings
|
||||
|
||||
### 2. Type3 Font Library
|
||||
|
||||
**Location:** `app/core/src/main/resources/type3/library/`
|
||||
|
||||
**Structure:**
|
||||
```
|
||||
type3/library/
|
||||
├── index.json # Font metadata and signatures
|
||||
├── catalogue.json # Quick lookup of common fonts
|
||||
└── fonts/
|
||||
├── dejavu/
|
||||
│ ├── DejaVuSans.ttf
|
||||
│ ├── DejaVuSans-Bold.ttf
|
||||
│ └── DejaVuSans-Oblique.ttf
|
||||
├── cm/ # Computer Modern (LaTeX)
|
||||
│ ├── cmr10.ttf
|
||||
│ ├── cmmi10.ttf
|
||||
│ └── cmsy10.ttf
|
||||
├── stix/ # Scientific symbols
|
||||
│ └── STIXSizeThreeSym-Regular.otf
|
||||
└── scp/ # Monospace
|
||||
└── SauceCodeProNerdFont-Regular.ttf
|
||||
```
|
||||
|
||||
**index.json format:**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "dejavu-sans-bold",
|
||||
"label": "DejaVu Sans Bold",
|
||||
"aliases": [
|
||||
"DejaVuSans-Bold",
|
||||
"EVICAO+DejaVuSans-Bold",
|
||||
"dejavusans-bold"
|
||||
],
|
||||
"signatures": [
|
||||
"sha256:a1b2c3d4...",
|
||||
"sha256:e5f6g7h8..."
|
||||
],
|
||||
"pdfProgram": {
|
||||
"resource": "type3/library/fonts/dejavu/DejaVuSans-Bold.ttf",
|
||||
"format": "ttf"
|
||||
},
|
||||
"glyphCoverage": [32, 33, 65, 66, 67, ...],
|
||||
"source": "DejaVu Fonts 2.37"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### 3. Normalized vs Actual Type3 Fonts
|
||||
|
||||
The system handles two types of Type3 fonts differently:
|
||||
|
||||
**Normalized Type3 Fonts:**
|
||||
- Original PDF has Type3 font
|
||||
- Matched against library
|
||||
- Replaced with standard TTF/OTF
|
||||
- Font object is `PDType0Font` (not `PDType3Font`)
|
||||
- Has proper Unicode mappings
|
||||
|
||||
**Actual Type3 Fonts:**
|
||||
- Original PDF has Type3 font
|
||||
- No library match found
|
||||
- Keeps Type3 glyph data in JSON
|
||||
- Font object is `PDType3Font`
|
||||
- Uses character codes instead of Unicode
|
||||
|
||||
**Rendering logic (PdfJsonConversionService.java:2411-2463):**
|
||||
```java
|
||||
boolean isNormalizedType3 = !(run.font() instanceof PDType3Font)
|
||||
&& runFontModel != null
|
||||
&& runFontModel.getType3Glyphs() != null
|
||||
&& !runFontModel.getType3Glyphs().isEmpty();
|
||||
|
||||
if (isNormalizedType3) {
|
||||
// Font has Unicode mappings, use text directly
|
||||
contentStream.showText(run.text());
|
||||
} else {
|
||||
// Use raw byte encoding (for Type3 or other fonts)
|
||||
byte[] encoded = encodeTextWithFont(run.font(), fontModel, run.text(), charCodes);
|
||||
contentStream.showText(new String(encoded, StandardCharsets.ISO_8859_1));
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Character Code Preservation
|
||||
|
||||
**Why needed:** Type3 fonts often lack ToUnicode mappings. We preserve the original character codes so text can be reconstructed.
|
||||
|
||||
**Storage in JSON:**
|
||||
```json
|
||||
{
|
||||
"text": "Hello",
|
||||
"fontId": "F1",
|
||||
"charCodes": [72, 101, 108, 108, 111]
|
||||
}
|
||||
```
|
||||
|
||||
**Extraction (PDF → JSON):**
|
||||
```java
|
||||
// TextCollectingStripper.java:4431-4443
|
||||
if (pdfont instanceof PDType3Font) {
|
||||
int[] codes = position.getCharacterCodes();
|
||||
if (codes != null && codes.length > 0) {
|
||||
element.setCharCodes(Arrays.stream(codes)
|
||||
.boxed()
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Font Embedding Strategies
|
||||
|
||||
When converting JSON → PDF, fonts are embedded based on their type:
|
||||
|
||||
| Font Type | Strategy | Implementation |
|
||||
|-----------|----------|----------------|
|
||||
| **Normalized Type3** | Load TTF/OTF from library, embed as PDType0Font | `conversionCandidates[0].pdfProgram` |
|
||||
| **Standard fonts** | Use system fonts or embedded fonts from original | PDFBox standard loading |
|
||||
| **CFF/Type1C fonts** | Wrap as OpenType-CFF for browser compatibility | Optional Python converter |
|
||||
| **Actual Type3** | Keep original Type3 definition | Preserve from original PDF |
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
**settings.yml:**
|
||||
```yaml
|
||||
processing:
|
||||
pdf-json:
|
||||
fonts:
|
||||
type3:
|
||||
library:
|
||||
enabled: true
|
||||
index: classpath:/type3/library/index.json
|
||||
```
|
||||
|
||||
**Environment variables:**
|
||||
```bash
|
||||
# Disable Type3 library matching
|
||||
STIRLING_PDF_JSON_TYPE3_LIBRARY_ENABLED=false
|
||||
|
||||
# Use custom library
|
||||
STIRLING_PDF_JSON_TYPE3_LIBRARY_INDEX=file:/path/to/custom/index.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Debugging
|
||||
|
||||
### View Type3 Font Information
|
||||
|
||||
**Backend logs** show signature matching:
|
||||
```
|
||||
[TYPE3] Strategy type3-library finished with status SUCCESS
|
||||
(message: Matched DejaVu Sans Bold via alias:dejavusans-bold)
|
||||
for font 1:F2
|
||||
|
||||
[TYPE3-RUNTIME] Loading library font F2 WITHOUT subsetting
|
||||
(full glyph set) from candidate:type3-library:pdfProgram
|
||||
```
|
||||
|
||||
### Check JSON Output
|
||||
|
||||
Look for `type3Glyphs` in font definitions:
|
||||
```json
|
||||
{
|
||||
"id": "F1",
|
||||
"baseName": "BMQQDV+DejaVuSans",
|
||||
"subtype": "Type3",
|
||||
"type3Glyphs": [
|
||||
{
|
||||
"charCode": 65,
|
||||
"glyphName": "A",
|
||||
"unicode": 65,
|
||||
"advanceWidth": 684,
|
||||
"bbox": [0, 0, 684, 729],
|
||||
"outline": "M 72 0 L ..."
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Test Signature Calculation
|
||||
|
||||
Use the CLI tool to analyze any PDF:
|
||||
```bash
|
||||
./gradlew :proprietary:type3SignatureTool \
|
||||
--args="--pdf sample.pdf --output analysis.json --pretty"
|
||||
```
|
||||
|
||||
Output shows all Type3 fonts with their signatures and glyph coverage.
|
||||
|
||||
---
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
### Memory Management
|
||||
|
||||
- **Type3 glyph data** can be large (detailed vector paths)
|
||||
- **Font subsetting** not used for library fonts (full glyph set loaded)
|
||||
- **Caching:** Library fonts are loaded once and cached per conversion
|
||||
|
||||
### File Size Impact
|
||||
|
||||
- **JSON size:** Type3 glyph data adds ~5-50KB per font
|
||||
- **PDF size:** Embedding TTF/OTF fonts adds ~50-500KB per font
|
||||
- **Optimization:** Use library matching to avoid storing raw Type3 data
|
||||
|
||||
---
|
||||
|
||||
## Limitations
|
||||
|
||||
1. **Library coverage:** Only common Type3 fonts are in the library
|
||||
- Matplotlib (DejaVu Sans family)
|
||||
- LaTeX (Computer Modern)
|
||||
- STIX Math symbols
|
||||
|
||||
2. **Glyph accuracy:** Signature matching assumes exact glyph shapes
|
||||
- Slight variations may not match
|
||||
- Subset fonts may have different signatures
|
||||
|
||||
3. **Unicode mapping:** Unmatched Type3 fonts lose Unicode text
|
||||
- Character codes preserved but not searchable
|
||||
- Copy/paste may not work correctly
|
||||
|
||||
4. **No runtime synthesis:** Unlike earlier designs, no attempt to convert Type3 to TTF at runtime
|
||||
- All conversions must be pre-built in library
|
||||
- Unknown Type3 fonts keep their Type3 definition
|
||||
|
||||
---
|
||||
|
||||
## Related Files
|
||||
|
||||
### Backend (Java)
|
||||
- `PdfJsonConversionService.java` - Main conversion logic
|
||||
- `Type3FontConversionService.java` - Signature calculation and matching
|
||||
- `Type3FontLibrary.java` - Library loading and lookup
|
||||
- `Type3GlyphExtractor.java` - Extract glyph data from Type3 fonts
|
||||
- `Type3FontSignatureCalculator.java` - Create font fingerprints
|
||||
- `PdfJsonFontType3Glyph.java` - Model for Type3 glyph data
|
||||
|
||||
### Frontend (TypeScript)
|
||||
- `pdfTextEditorTypes.ts` - Type definitions for JSON structure
|
||||
- `pdfTextEditorUtils.ts` - Font handling utilities
|
||||
|
||||
### Resources
|
||||
- `type3/library/index.json` - Font library metadata
|
||||
- `type3/library/fonts/` - Actual font files (TTF/OTF)
|
||||
- `settings.yml.template` - Configuration options
|
||||
|
||||
### Documentation
|
||||
- `pdf_text_edit_flow.md` - Overall text editing architecture
|
||||
- `type3_fallback_plan.md` - Original design and planning
|
||||
@@ -0,0 +1,660 @@
|
||||
# Type3 Font Library Management Guide
|
||||
|
||||
## Overview
|
||||
|
||||
This guide explains how to add new fonts to the Type3 font library, including:
|
||||
1. Finding Type3 fonts in PDFs
|
||||
2. Extracting and analyzing Type3 fonts
|
||||
3. Adding pre-converted TTF/OTF fonts to the library
|
||||
4. Importing fonts with example PDFs
|
||||
|
||||
---
|
||||
|
||||
## Two Approaches to Adding Fonts
|
||||
|
||||
### Approach 1: Import Existing TTF/OTF Files
|
||||
|
||||
**When to use:** You already have a TTF/OTF file that matches a Type3 font you encounter.
|
||||
|
||||
**Example:** You find a PDF with a Type3 font that's actually DejaVu Sans, and you have the official DejaVu Sans TTF file.
|
||||
|
||||
### Approach 2: Extract from Type3 PDFs
|
||||
|
||||
**When to use:** The Type3 font is unique to a PDF (no standard equivalent exists).
|
||||
|
||||
**Example:** Custom corporate fonts, specialized scientific notation, or generated fonts.
|
||||
|
||||
---
|
||||
|
||||
## Approach 1: Import Existing TTF/OTF Files
|
||||
|
||||
This is the **recommended approach** when possible, as it gives you the full font with proper Unicode mappings.
|
||||
|
||||
### Step 1: Find the Type3 Font Signature
|
||||
|
||||
Use the signature tool to analyze a PDF containing the Type3 font:
|
||||
|
||||
```bash
|
||||
./gradlew :proprietary:type3SignatureTool \
|
||||
--args="--pdf examples/matplotlib_chart.pdf --output matplotlib_fonts.json --pretty"
|
||||
```
|
||||
|
||||
**Output (`matplotlib_fonts.json`):**
|
||||
```json
|
||||
{
|
||||
"fonts": [
|
||||
{
|
||||
"fontId": "F1",
|
||||
"pageNumber": 1,
|
||||
"baseName": "BMQQDV+DejaVuSans",
|
||||
"subtype": "Type3",
|
||||
"signature": "sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d",
|
||||
"glyphCount": 50,
|
||||
"glyphs": [
|
||||
{
|
||||
"charCode": 65,
|
||||
"glyphName": "A",
|
||||
"unicode": 65,
|
||||
"advanceWidth": 684,
|
||||
"bbox": [0, 0, 684, 729]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Key information:**
|
||||
- `signature`: Unique fingerprint of this font
|
||||
- `baseName`: Font name in the PDF (often subset like "BMQQDV+DejaVuSans")
|
||||
- `glyphs`: Character codes and Unicode mappings
|
||||
|
||||
### Step 2: Obtain the Matching TTF/OTF File
|
||||
|
||||
**Sources:**
|
||||
1. **System fonts:** Check if the font is already installed
|
||||
- Windows: `C:\Windows\Fonts\`
|
||||
- Linux: `/usr/share/fonts/`
|
||||
- macOS: `/Library/Fonts/`
|
||||
|
||||
2. **Official font websites:**
|
||||
- [DejaVu Fonts](https://dejavu-fonts.github.io/)
|
||||
- [Computer Modern Unicode](https://www.fontsquirrel.com/fonts/computer-modern)
|
||||
- [STIX Fonts](https://www.stixfonts.org/)
|
||||
- [Google Fonts](https://fonts.google.com/)
|
||||
|
||||
3. **Font foundries:** If it's a commercial font, you'll need a license
|
||||
|
||||
**Example - Getting DejaVu Sans:**
|
||||
```bash
|
||||
# Download from official source
|
||||
wget https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.tar.bz2
|
||||
|
||||
# Extract
|
||||
tar xjf dejavu-fonts-ttf-2.37.tar.bz2
|
||||
|
||||
# Copy the needed font
|
||||
cp dejavu-fonts-ttf-2.37/ttf/DejaVuSans.ttf app/core/src/main/resources/type3/library/fonts/dejavu/
|
||||
```
|
||||
|
||||
### Step 3: Add Entry to Library Index
|
||||
|
||||
Edit `app/core/src/main/resources/type3/library/index.json`:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "dejavu-sans-regular",
|
||||
"label": "DejaVu Sans",
|
||||
"aliases": [
|
||||
"DejaVuSans",
|
||||
"BMQQDV+DejaVuSans",
|
||||
"DejaVuSansDisplay",
|
||||
"dejavusans"
|
||||
],
|
||||
"signatures": [
|
||||
"sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d"
|
||||
],
|
||||
"pdfProgram": {
|
||||
"resource": "type3/library/fonts/dejavu/DejaVuSans.ttf",
|
||||
"format": "ttf"
|
||||
},
|
||||
"webProgram": {
|
||||
"resource": "type3/library/fonts/dejavu/DejaVuSans.ttf",
|
||||
"format": "ttf"
|
||||
},
|
||||
"glyphCoverage": [32, 33, 65, 66, 67, 68, 69, ...],
|
||||
"source": "DejaVu Fonts 2.37"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
**Field descriptions:**
|
||||
|
||||
| Field | Required | Description | Example |
|
||||
|-------|----------|-------------|---------|
|
||||
| `id` | ✅ | Unique identifier (lowercase, hyphenated) | `"dejavu-sans-bold"` |
|
||||
| `label` | ✅ | Human-readable name | `"DejaVu Sans Bold"` |
|
||||
| `aliases` | ✅ | Font name variations to match | `["DejaVuSans-Bold", "EVICAO+DejaVuSans-Bold"]` |
|
||||
| `signatures` | ✅ | SHA256 hashes from signature tool | `["sha256:a1b2c3..."]` |
|
||||
| `pdfProgram` | ✅ | Font file for PDF embedding | See below |
|
||||
| `webProgram` | ⚠️ | Font file for browser preview (can be same as pdfProgram) | See below |
|
||||
| `glyphCoverage` | ❌ | Unicode code points covered (optional) | `[65, 66, 67]` |
|
||||
| `source` | ❌ | Attribution/version info (optional) | `"DejaVu Fonts 2.37"` |
|
||||
|
||||
**Program format:**
|
||||
```json
|
||||
"pdfProgram": {
|
||||
"resource": "type3/library/fonts/dejavu/DejaVuSans.ttf",
|
||||
"format": "ttf"
|
||||
}
|
||||
```
|
||||
- `resource`: Path relative to classpath root (or absolute file:// path)
|
||||
- `format`: `"ttf"` or `"otf"`
|
||||
|
||||
### Step 4: Add to Catalogue (Optional)
|
||||
|
||||
Edit `app/core/src/main/resources/type3/catalogue.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"fonts": [
|
||||
{
|
||||
"name": "DejaVuSans",
|
||||
"source": "Matplotlib PDFs",
|
||||
"variants": ["Regular", "Bold", "Oblique"],
|
||||
"status": "complete"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Step 5: Test the Font
|
||||
|
||||
1. **Rebuild the application:**
|
||||
```bash
|
||||
./gradlew clean build
|
||||
```
|
||||
|
||||
2. **Convert a PDF with the Type3 font:**
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/v1/convert/pdf/to-json \
|
||||
-F file=@test.pdf \
|
||||
-o output.json
|
||||
```
|
||||
|
||||
3. **Check the JSON output:**
|
||||
```bash
|
||||
# Look for conversionCandidates
|
||||
cat output.json | jq '.fonts[] | select(.baseName | contains("DejaVu"))'
|
||||
```
|
||||
|
||||
4. **Expected output:**
|
||||
```json
|
||||
{
|
||||
"id": "F1",
|
||||
"baseName": "BMQQDV+DejaVuSans",
|
||||
"subtype": "Type3",
|
||||
"conversionCandidates": [
|
||||
{
|
||||
"strategyId": "type3-library",
|
||||
"status": "SUCCESS",
|
||||
"message": "Matched DejaVu Sans via alias:dejavusans",
|
||||
"pdfProgram": "T1RUTwAJAIAAAwAQQ0ZGIHHwJ9o...",
|
||||
"pdfProgramFormat": "ttf"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
5. **Test round-trip conversion:**
|
||||
```bash
|
||||
# Convert back to PDF
|
||||
curl -X POST http://localhost:8080/api/v1/convert/json/to-pdf \
|
||||
-F file=@output.json \
|
||||
-o roundtrip.pdf
|
||||
|
||||
# Verify text renders correctly
|
||||
pdftotext roundtrip.pdf - | head
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Approach 2: Extract from Type3 PDFs
|
||||
|
||||
When no standard TTF/OTF exists, you can convert the Type3 font itself.
|
||||
|
||||
⚠️ **Note:** This produces a synthetic font that may not be perfect. Use Approach 1 whenever possible.
|
||||
|
||||
### Step 1: Extract Type3 Metadata
|
||||
|
||||
Same as Approach 1 - use the signature tool:
|
||||
|
||||
```bash
|
||||
./gradlew :proprietary:type3SignatureTool \
|
||||
--args="--pdf custom_font.pdf --output custom_font_analysis.json --pretty"
|
||||
```
|
||||
|
||||
### Step 2: Convert Type3 to TTF Using Python Script
|
||||
|
||||
Use the included conversion script:
|
||||
|
||||
```bash
|
||||
# Install fontTools if not already installed
|
||||
pip install fonttools
|
||||
|
||||
# Convert the Type3 font
|
||||
python scripts/type3_to_cff.py \
|
||||
--input custom_font_analysis.json \
|
||||
--output-cff custom_font.otf \
|
||||
--output-ttf custom_font.ttf \
|
||||
--font-name "CustomFont" \
|
||||
--family-name "Custom Font Family"
|
||||
```
|
||||
|
||||
**Script options:**
|
||||
- `--input`: JSON file from signature tool
|
||||
- `--output-cff`: OpenType-CFF output (best for PDF)
|
||||
- `--output-ttf`: TrueType output (best for web)
|
||||
- `--font-name`: PostScript name (no spaces)
|
||||
- `--family-name`: Human-readable name
|
||||
|
||||
### Step 3: Copy Font to Library
|
||||
|
||||
```bash
|
||||
# Create directory for custom fonts
|
||||
mkdir -p app/core/src/main/resources/type3/library/fonts/custom/
|
||||
|
||||
# Copy the converted fonts
|
||||
cp custom_font.otf app/core/src/main/resources/type3/library/fonts/custom/
|
||||
cp custom_font.ttf app/core/src/main/resources/type3/library/fonts/custom/
|
||||
```
|
||||
|
||||
### Step 4: Add to Library Index
|
||||
|
||||
Same as Approach 1, but note the synthetic nature:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "custom-font-regular",
|
||||
"label": "Custom Font",
|
||||
"aliases": ["CustomFont", "ABCDEF+CustomFont"],
|
||||
"signatures": ["sha256:extracted-from-json"],
|
||||
"pdfProgram": {
|
||||
"resource": "type3/library/fonts/custom/custom_font.otf",
|
||||
"format": "otf"
|
||||
},
|
||||
"webProgram": {
|
||||
"resource": "type3/library/fonts/custom/custom_font.ttf",
|
||||
"format": "ttf"
|
||||
},
|
||||
"source": "Converted from custom_font.pdf",
|
||||
"glyphCoverage": [65, 66, 67, 68, 69]
|
||||
}
|
||||
```
|
||||
|
||||
### Step 5: Quality Check
|
||||
|
||||
Type3 → TTF conversion may have issues:
|
||||
|
||||
1. **Check glyph rendering:**
|
||||
- Open the TTF in a font viewer (FontForge, FontDrop)
|
||||
- Verify all glyphs look correct
|
||||
|
||||
2. **Check metrics:**
|
||||
- Compare advance widths to original
|
||||
- Verify bounding boxes
|
||||
|
||||
3. **Test in PDF:**
|
||||
- Create a test document using the font
|
||||
- Verify it renders the same as the original PDF
|
||||
|
||||
---
|
||||
|
||||
## Adding Fonts with Example PDFs
|
||||
|
||||
### Scenario: You Want to Support Matplotlib PDFs
|
||||
|
||||
Matplotlib uses DejaVu Sans fonts but embeds them as Type3 fonts with subset names.
|
||||
|
||||
### Step 1: Collect Example PDFs
|
||||
|
||||
```bash
|
||||
# Create a samples directory
|
||||
mkdir -p samples/matplotlib/
|
||||
|
||||
# Download or copy example PDFs
|
||||
cp ~/Downloads/matplotlib_chart.pdf samples/matplotlib/01_chart.pdf
|
||||
cp ~/Downloads/matplotlib_plot.pdf samples/matplotlib/02_plot.pdf
|
||||
```
|
||||
|
||||
### Step 2: Batch Analyze Fonts
|
||||
|
||||
```bash
|
||||
# Analyze all samples
|
||||
for pdf in samples/matplotlib/*.pdf; do
|
||||
basename=$(basename "$pdf" .pdf)
|
||||
./gradlew :proprietary:type3SignatureTool \
|
||||
--args="--pdf $pdf --output analysis_${basename}.json --pretty"
|
||||
done
|
||||
```
|
||||
|
||||
### Step 3: Identify Common Fonts
|
||||
|
||||
Use the summarize script to see what fonts appear:
|
||||
|
||||
```bash
|
||||
python scripts/summarize_type3_signatures.py \
|
||||
--signatures-dir . \
|
||||
--output summary.md
|
||||
```
|
||||
|
||||
**Output (`summary.md`):**
|
||||
```markdown
|
||||
# Type3 Font Signature Inventory
|
||||
|
||||
## Fonts by Signature
|
||||
|
||||
### sha256:2be58b6ef1e...
|
||||
- **Alias:** DejaVuSans, BMQQDV+DejaVuSans
|
||||
- **Seen in:** 01_chart.pdf, 02_plot.pdf
|
||||
- **Status:** ✅ In library (dejavu-sans-regular)
|
||||
|
||||
### sha256:a1b2c3d4e5f6...
|
||||
- **Alias:** DejaVuSans-Bold, EVICAO+DejaVuSans-Bold
|
||||
- **Seen in:** 01_chart.pdf
|
||||
- **Status:** ❌ Missing from library
|
||||
```
|
||||
|
||||
### Step 4: Add Missing Fonts
|
||||
|
||||
For each missing font:
|
||||
|
||||
1. **Download the standard version:**
|
||||
```bash
|
||||
# DejaVu Sans Bold
|
||||
wget https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.tar.bz2
|
||||
tar xjf dejavu-fonts-ttf-2.37.tar.bz2
|
||||
cp dejavu-fonts-ttf-2.37/ttf/DejaVuSans-Bold.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/dejavu/
|
||||
```
|
||||
|
||||
2. **Add to index.json:**
|
||||
```json
|
||||
{
|
||||
"id": "dejavu-sans-bold",
|
||||
"label": "DejaVu Sans Bold",
|
||||
"aliases": [
|
||||
"DejaVuSans-Bold",
|
||||
"EVICAO+DejaVuSans-Bold",
|
||||
"dejavusans-bold"
|
||||
],
|
||||
"signatures": [
|
||||
"sha256:a1b2c3d4e5f6..."
|
||||
],
|
||||
"pdfProgram": {
|
||||
"resource": "type3/library/fonts/dejavu/DejaVuSans-Bold.ttf",
|
||||
"format": "ttf"
|
||||
},
|
||||
"webProgram": {
|
||||
"resource": "type3/library/fonts/dejavu/DejaVuSans-Bold.ttf",
|
||||
"format": "ttf"
|
||||
},
|
||||
"source": "DejaVu Fonts 2.37"
|
||||
}
|
||||
```
|
||||
|
||||
### Step 5: Update Library Automatically
|
||||
|
||||
Use the update script to sync signatures:
|
||||
|
||||
```bash
|
||||
python scripts/update_type3_library.py \
|
||||
--signatures-dir . \
|
||||
--apply
|
||||
```
|
||||
|
||||
This script:
|
||||
- Reads all `analysis_*.json` files
|
||||
- Matches them to library entries by alias
|
||||
- Updates signatures and glyph coverage
|
||||
- Writes back to `index.json`
|
||||
|
||||
### Step 6: Verify Coverage
|
||||
|
||||
Test with all your example PDFs:
|
||||
|
||||
```bash
|
||||
for pdf in samples/matplotlib/*.pdf; do
|
||||
echo "Testing $pdf..."
|
||||
curl -X POST http://localhost:8080/api/v1/convert/pdf/to-json \
|
||||
-F file=@"$pdf" \
|
||||
-o test_output.json
|
||||
|
||||
# Check for successful matches
|
||||
matches=$(cat test_output.json | jq '[.fonts[].conversionCandidates[] | select(.status == "SUCCESS")] | length')
|
||||
total=$(cat test_output.json | jq '.fonts | length')
|
||||
echo " Matched $matches of $total fonts"
|
||||
done
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Fonts to Add
|
||||
|
||||
### Matplotlib (Python plotting library)
|
||||
|
||||
**Fonts used:** DejaVu Sans family
|
||||
|
||||
```bash
|
||||
# Download DejaVu fonts
|
||||
wget https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.tar.bz2
|
||||
tar xjf dejavu-fonts-ttf-2.37.tar.bz2
|
||||
|
||||
# Copy needed variants
|
||||
cp dejavu-fonts-ttf-2.37/ttf/DejaVuSans.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/dejavu/
|
||||
cp dejavu-fonts-ttf-2.37/ttf/DejaVuSans-Bold.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/dejavu/
|
||||
cp dejavu-fonts-ttf-2.37/ttf/DejaVuSans-Oblique.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/dejavu/
|
||||
cp dejavu-fonts-ttf-2.37/ttf/DejaVuSansMono.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/dejavu/
|
||||
```
|
||||
|
||||
### LaTeX Documents
|
||||
|
||||
**Fonts used:** Computer Modern family
|
||||
|
||||
```bash
|
||||
# Download Computer Modern Unicode
|
||||
wget https://downloads.sourceforge.net/project/cm-unicode/cm-unicode/0.7.0/cm-unicode-0.7.0-ttf.tar.xz
|
||||
tar xJf cm-unicode-0.7.0-ttf.tar.xz
|
||||
|
||||
# Copy common variants
|
||||
cp cm-unicode-0.7.0/cmunrm.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/cm/cmr10.ttf
|
||||
cp cm-unicode-0.7.0/cmunti.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/cm/cmmi10.ttf
|
||||
cp cm-unicode-0.7.0/cmunsy.ttf \
|
||||
app/core/src/main/resources/type3/library/fonts/cm/cmsy10.ttf
|
||||
```
|
||||
|
||||
### Scientific Documents
|
||||
|
||||
**Fonts used:** STIX fonts
|
||||
|
||||
```bash
|
||||
# Download STIX
|
||||
wget https://github.com/stipub/stixfonts/raw/master/fonts/static_otf/STIXTwoText-Regular.otf
|
||||
|
||||
# Copy to library
|
||||
cp STIXTwoText-Regular.otf \
|
||||
app/core/src/main/resources/type3/library/fonts/stix/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Signature Doesn't Match
|
||||
|
||||
**Problem:** You added a font but PDFs still don't match.
|
||||
|
||||
**Causes:**
|
||||
1. **Different font version:** The Type3 font in the PDF uses a different version
|
||||
2. **Subset differences:** Subset fonts may have different signatures
|
||||
3. **Alias mismatch:** Font name in PDF doesn't match any alias
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Check the PDF's font name:**
|
||||
```bash
|
||||
pdffonts sample.pdf
|
||||
```
|
||||
Output shows: `BMQQDV+DejaVuSans`
|
||||
|
||||
2. **Add the subset name as an alias:**
|
||||
```json
|
||||
"aliases": [
|
||||
"DejaVuSans",
|
||||
"BMQQDV+DejaVuSans", // Add this
|
||||
"dejavusans"
|
||||
]
|
||||
```
|
||||
|
||||
3. **Add multiple signatures:**
|
||||
```json
|
||||
"signatures": [
|
||||
"sha256:original-signature",
|
||||
"sha256:subset-signature" // Add from your PDF
|
||||
]
|
||||
```
|
||||
|
||||
### Font Renders Incorrectly
|
||||
|
||||
**Problem:** Text appears but glyphs look wrong.
|
||||
|
||||
**Causes:**
|
||||
1. **Wrong font file:** You matched a different font
|
||||
2. **Glyph coverage mismatch:** Font doesn't have all the glyphs
|
||||
3. **Encoding issues:** Character codes don't match
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Verify it's the right font:**
|
||||
- Open both the Type3 PDF and your TTF in a font viewer
|
||||
- Compare glyph shapes visually
|
||||
|
||||
2. **Check glyph coverage:**
|
||||
```bash
|
||||
# Extract glyphs from Type3
|
||||
./gradlew :proprietary:type3SignatureTool \
|
||||
--args="--pdf sample.pdf --output analysis.json"
|
||||
|
||||
# Compare to font file
|
||||
ttfdump -t cmap your_font.ttf | grep "glyphID"
|
||||
```
|
||||
|
||||
3. **Use a more complete font version:**
|
||||
- Get the full font (not a subset)
|
||||
- Ensure all Unicode ranges are covered
|
||||
|
||||
### Missing Glyphs
|
||||
|
||||
**Problem:** Some characters don't render.
|
||||
|
||||
**Cause:** The TTF/OTF file doesn't have all the glyphs that the Type3 font had.
|
||||
|
||||
**Solution:** You need a more complete font, or must use Approach 2 to convert the Type3 font itself.
|
||||
|
||||
---
|
||||
|
||||
## Library Maintenance Scripts
|
||||
|
||||
### `type3SignatureTool`
|
||||
|
||||
**Purpose:** Analyze Type3 fonts in a PDF
|
||||
|
||||
```bash
|
||||
./gradlew :proprietary:type3SignatureTool \
|
||||
--args="--pdf INPUT.pdf --output OUTPUT.json [--pretty]"
|
||||
```
|
||||
|
||||
### `summarize_type3_signatures.py`
|
||||
|
||||
**Purpose:** Create an inventory of fonts across multiple PDFs
|
||||
|
||||
```bash
|
||||
python scripts/summarize_type3_signatures.py \
|
||||
--signatures-dir path/to/jsons/ \
|
||||
--output inventory.md
|
||||
```
|
||||
|
||||
### `update_type3_library.py`
|
||||
|
||||
**Purpose:** Sync signature JSON files with library index
|
||||
|
||||
```bash
|
||||
# Dry run (show what would change)
|
||||
python scripts/update_type3_library.py \
|
||||
--signatures-dir analysis/
|
||||
|
||||
# Apply changes
|
||||
python scripts/update_type3_library.py \
|
||||
--signatures-dir analysis/ \
|
||||
--apply
|
||||
```
|
||||
|
||||
### `type3_to_cff.py`
|
||||
|
||||
**Purpose:** Convert Type3 glyph JSON to TTF/OTF
|
||||
|
||||
```bash
|
||||
python scripts/type3_to_cff.py \
|
||||
--input type3_data.json \
|
||||
--output-cff font.otf \
|
||||
--output-ttf font.ttf \
|
||||
--font-name MyFont \
|
||||
--family-name "My Font Family"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always prefer official fonts** (Approach 1) over synthesized ones (Approach 2)
|
||||
2. **Use multiple signatures** for fonts that appear in different PDFs with different subset names
|
||||
3. **Test with real PDFs** before considering a font "done"
|
||||
4. **Document the source** in the `source` field for attribution and versioning
|
||||
5. **Keep example PDFs** for each font in case you need to debug later
|
||||
6. **Version the library** - commit `index.json` changes with clear descriptions
|
||||
|
||||
---
|
||||
|
||||
## File Size Considerations
|
||||
|
||||
### Font File Sizes
|
||||
|
||||
Typical sizes:
|
||||
- **DejaVu Sans:** ~750KB per variant
|
||||
- **Computer Modern:** ~200-400KB per variant
|
||||
- **STIX Math:** ~500KB-1MB per variant
|
||||
|
||||
### Library Size Management
|
||||
|
||||
Current library: **~3MB** (10 fonts)
|
||||
|
||||
To keep the library manageable:
|
||||
1. **Only include common fonts** (used in >5% of PDFs you process)
|
||||
2. **Don't include every variant** (e.g., skip "Ultra Light" if rarely used)
|
||||
3. **Consider subsetting** for languages you don't support
|
||||
4. **Use OTF/CFF over TTF** when possible (better compression for PDF)
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [PDF JSON Type3 Font System](pdf_json_type3_fonts.md) - Technical architecture
|
||||
- [PDF Text Edit Flow](pdf_text_edit_flow.md) - Overall editing workflow
|
||||
- [Type3 Fallback Plan](type3_fallback_plan.md) - Original design document
|
||||
@@ -0,0 +1,50 @@
|
||||
# PDF Text Edit Flow
|
||||
|
||||
This high-level diagram shows every major component involved when a user edits text inside a PDF via the JSON editor. It highlights where fonts (especially Type3) are captured, matched against the library, and re-applied during export.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
%% Upload & Extraction
|
||||
A([Upload PDF]) --> B[PdfJsonConversionService]
|
||||
B --> B1[Optional Ghostscript preflight]
|
||||
B1 --> B2[Iterate pages & resources]
|
||||
B2 --> B3[Extract text runs + fonts]
|
||||
|
||||
%% Font handling (serial tree)
|
||||
B3 --> C{Font subtype?}
|
||||
C -->|Type 0 / TrueType / CID| C1[Copy embedded program bytes]
|
||||
C -->|Type3| C2[Type3FontConversionService]
|
||||
C1 --> C4[Attach font payload + metadata]
|
||||
C2 --> C21{Library match?}
|
||||
C21 --|Yes|--> C22[Inject canonical TTF/OTF from library]
|
||||
C21 --|No|--> C23[Mark unsupported<br/>& keep Type3 glyphs]
|
||||
C2 --> C25[Record glyph charCodes + unicode mapping]
|
||||
C22 --> C25
|
||||
C23 --> C25
|
||||
|
||||
%% JSON output
|
||||
C4 --> D[Build PdfJsonDocument (pages, fonts, elements)]
|
||||
C25 --> D
|
||||
D --> E([Send JSON to UI])
|
||||
|
||||
%% Edit round-trip
|
||||
E --> F[User edits text/elements]
|
||||
F --> G[Patched JSON POSTed back]
|
||||
G --> H{Regeneration pipeline}
|
||||
H --> H1[Resolve fonts + candidates]
|
||||
H1 --> H11[Prefer library/embedded payloads]
|
||||
H1 --> H12[Fallback font service for missing glyphs]
|
||||
H --> H2{Can rewrite token stream?}
|
||||
H2 -->|Yes| H21[Rewrite existing operators]
|
||||
H2 -->|No| H22[Full page regeneration]
|
||||
H22 --> H23[Embed canonical fonts + Type3 glyph codes]
|
||||
H21 --> I[Apply annotations/metadata]
|
||||
H23 --> I
|
||||
I --> J([Download edited PDF])
|
||||
```
|
||||
|
||||
**Key points**
|
||||
- Type3 conversion happens entirely inside `Type3FontConversionService`. Matching entries pull canonical fonts from the library; when a signature is missing we simply keep the original Type3 glyph codes until a library entry is added.
|
||||
- Raw Type3 char codes are preserved in `PdfJsonTextElement.charCodes` so edits can fall back to the original glyph sequence when users do not change the text.
|
||||
- When the frontend submits changes, the backend preflights each text run, picks the proper font candidate (library > embedded > fallback), and rewrites the PDF with either token replacements or full page regeneration.
|
||||
- Glyph coverage metadata from the Type3 library now informs which fonts can legitimately render new characters, so added text keeps using the original Type3 face whenever its coverage includes those code points.
|
||||
@@ -0,0 +1,191 @@
|
||||
# Type3 Signature Inventory
|
||||
|
||||
_Generated from `docs\type3\signatures`. Run `scripts/summarize_type3_signatures.py` after capturing new samples._
|
||||
|
||||
## Alias: `cmex10`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:bdff85a28d968fea7fbffcf4869b1a28bdd7eb8b73230a016b41bdcbe28de94b` | `01_Matplotlib.pdf` | 1 | 90 |
|
||||
|
||||
## Alias: `cmmi10`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:6c72170517812e39f970746f53a2ae08dafbbe7374c20bcb4d5a60adc49cb77b` | `01_Matplotlib.pdf` | 2 | 100, 120 |
|
||||
|
||||
## Alias: `cmr10`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:5b535a05c982fb8ff029dfbedd5e9d28c1c4379ebac259d207f65606a94e5b15` | `01_Matplotlib.pdf` | 3 | 48, 49, 53 |
|
||||
|
||||
## Alias: `cmsy10`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:1324cd8127143ef9023616b7911c570db3b1eb35758cdc9258ec16c0f4587775` | `01_Matplotlib.pdf` | 1 | 48 |
|
||||
| `sha256:2832e219b2db3bacf0d5a147d4b74ad5226fdf7562c395ef3fb12937633e037d` | `01_Matplotlib.pdf` | 1 | 8734 |
|
||||
|
||||
## Alias: `dejavusans`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d` | `01_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 52, 53, 55 |
|
||||
| `sha256:994c963d70041eee141fd275fa22c525a71283de2b4a952814d02e0bbfa8caea` | `01_Matplotlib.pdf` | 4 | 46, 48, 49, 53 |
|
||||
| `sha256:93573cb1ab32b9cb09378298fb120de079f6a309908d2ee86f91392a6aba5c31` | `01_Matplotlib.pdf` | 30 | 32, 45, 48, 49, 50, 51, 52, 53, 54, 55 |
|
||||
| `sha256:4febfad91e0141f9658506a0bf8fc2a449f0ea7d97b44e95fc9a970c77af4b0a` | `01_Matplotlib.pdf` | 7 | 48, 49, 50, 51, 52, 53, 54 |
|
||||
| `sha256:0386e5811612ba4b998d57cd3869d7fbc48092a79d436deda774af107a4af813` | `01_Matplotlib.pdf` | 9 | 46, 48, 49, 50, 51, 52, 53, 54, 55 |
|
||||
| `sha256:b95fa2a272cbc950b81320790d04fcf19ebb24050fa2139ba6a474172cac596b` | `01_Matplotlib.pdf` | 20 | 32, 40, 41, 48, 50, 52, 54, 56, 83, 85 |
|
||||
| `sha256:d034d16ac69e3e1c5008e77c4c24dc3179308a2742601e89d5c8ab327e4040dd` | `01_Matplotlib.pdf` | 15 | 43, 48, 49, 50, 51, 56, 61, 97, 98, 105 |
|
||||
| `sha256:85e16e36ed0290c149647be7e468a7c46e7b66fd290131213040f7bad905aa44` | `01_Matplotlib.pdf` | 25 | 32, 45, 46, 48, 49, 50, 52, 53, 54, 56 |
|
||||
| `sha256:85e16e36ed0290c149647be7e468a7c46e7b66fd290131213040f7bad905aa44` | `01_Matplotlib.pdf` | 25 | 32, 45, 46, 48, 49, 50, 52, 53, 54, 56 |
|
||||
| `sha256:3654d4d9bcbbf6ad51628082203094069a17aad3a5e6f5c7972833566e42ab6b` | `01_Matplotlib.pdf` | 29 | 32, 46, 48, 49, 50, 51, 52, 53, 54, 55 |
|
||||
| `sha256:d0c6cddc416d130701395246621a0f669fc292df4097a7a74395602faf4475df` | `01_Matplotlib.pdf` | 17 | 48, 49, 53, 97, 100, 101, 102, 103, 105, 108 |
|
||||
| `sha256:cadf43a2df81340368af44c76b499223931d78dcc76c70cf4b4a93d133e368af` | `01_Matplotlib.pdf` | 27 | 32, 46, 48, 49, 50, 52, 54, 56, 84, 97 |
|
||||
| `sha256:f1a874c4268b1bffffc99acabbe0a60aa662611b4bac0e688e4fc0ae3f2033bb` | `01_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 52, 54, 56 |
|
||||
| `sha256:e3d87c113463c8642a4f22943064fd75c133ad31fe5efebf6de6abf211b74b5a` | `01_Matplotlib.pdf` | 7 | 48, 49, 50, 51, 52, 54, 56 |
|
||||
| `sha256:d47afb7581e98f588f0e70953e8692249aaa2ec3df36fbd90985f27b1ce1cf50` | `01_Matplotlib.pdf` | 12 | 46, 48, 49, 50, 51, 52, 53, 54, 55, 97 |
|
||||
| `sha256:e47b8f112a875361a43bcb6d9c6467e0296412d29e417e58a0e60c90b664d281` | `01_Matplotlib.pdf` | 9 | 46, 48, 50, 97, 99, 105, 108, 115, 118 |
|
||||
| `sha256:9c67df2ac5c3dcf957dfb0cd048fa450322a72b5a2dfb05f816c536b3b090607` | `01_Matplotlib.pdf` | 19 | 32, 39, 46, 48, 49, 50, 53, 58, 97, 99 |
|
||||
| `sha256:3ee773a0af6fdedb9853dca9f4d8b80a421a0024bdf06bea41f15d58e3b90c87` | `01_Matplotlib.pdf` | 13 | 46, 48, 49, 50, 52, 54, 56, 97, 99, 105 |
|
||||
| `sha256:4fa06c90399d80b41cb718163a5d78af2b203df6b6579246fb0b24d349b7a591` | `01_Matplotlib.pdf` | 15 | 46, 48, 49, 50, 52, 53, 54, 56, 97, 98 |
|
||||
| `sha256:e47b8f112a875361a43bcb6d9c6467e0296412d29e417e58a0e60c90b664d281` | `01_Matplotlib.pdf` | 9 | 46, 48, 50, 97, 99, 105, 108, 115, 118 |
|
||||
| `sha256:ac6756c76d6e43b771cc1e643dfc7891dfaaac05aa5e302190d0a662838ab031` | `01_Matplotlib.pdf` | 13 | 46, 48, 49, 50, 51, 53, 55, 97, 99, 105 |
|
||||
| `sha256:bf7b95498f7d00d228c5c155db62b6c1aa7e0215cca1690c9fdb0adcfd496b10` | `01_Matplotlib.pdf` | 14 | 46, 48, 49, 50, 65, 66, 67, 68, 97, 99 |
|
||||
| `sha256:39b8e5ec8e20a788cd45166baf0ab796397f152c9cd8dec1f882c635380cad92` | `01_Matplotlib.pdf` | 13 | 46, 48, 49, 50, 52, 53, 54, 97, 99, 105 |
|
||||
| `sha256:27b98489865df8df55f19e4505c093501f236465885ca3bf5b66b6f047a85bb2` | `01_Matplotlib.pdf` | 19 | 46, 48, 49, 50, 51, 52, 68, 70, 72, 76 |
|
||||
| `sha256:497ddd27e1f56ef6504c61613e3a159bab13314a4970a3be13b3a556648964da` | `01_Matplotlib.pdf` | 12 | 46, 48, 49, 50, 51, 97, 98, 99, 105, 108 |
|
||||
| `sha256:3b41f9e5f3a7ffa6f4cdffa2a46f02781ec1b2b0c99994707cfb139aa15a11e2` | `01_Matplotlib.pdf` | 5 | 32, 48, 49, 50, 53 |
|
||||
| `sha256:93723fe436a1aa654db56caf133f56280444b9dc0682af50b83787c3e49ee3ec` | `01_Matplotlib.pdf` | 16 | 32, 48, 49, 50, 52, 53, 54, 56, 58, 97 |
|
||||
| `sha256:a648cb0524465bcb3bf4a2f65e0761cfc5167b1871a7db9488bee11b56062727` | `01_Matplotlib.pdf` | 14 | 32, 46, 48, 49, 50, 52, 53, 54, 56, 58 |
|
||||
| `sha256:2f18ed7f982aeb954aaae388ba0c75e3c676717ca324156b42bb17f3f20ef403` | `01_Matplotlib.pdf` | 18 | 46, 48, 49, 50, 52, 54, 97, 99, 101, 102 |
|
||||
| `sha256:18ce863feb57f42f2b92ac85a8c55ef3eeaa15488c5d6cd8c724b085994c64fa` | `01_Matplotlib.pdf` | 12 | 46, 48, 49, 50, 51, 52, 97, 99, 105, 108 |
|
||||
| `sha256:a3eb7054e426aad7d1fac1f39ad6d3f886e34c04f780def5cf22b53cb3a45b46` | `01_Matplotlib.pdf` | 15 | 46, 48, 49, 50, 52, 53, 54, 55, 56, 97 |
|
||||
| `sha256:edd22119635bfb0f2bff750137c6c6400a7fae4ff80cc252d2e6f2ca88f599a7` | `01_Matplotlib.pdf` | 15 | 46, 48, 49, 50, 51, 52, 53, 54, 56, 97 |
|
||||
| `sha256:aae1797f3e3ff55d71b02590333aff86663d6bb4a5768bed7550e5987f40afe8` | `01_Matplotlib.pdf` | 14 | 46, 48, 49, 50, 52, 53, 54, 56, 97, 99 |
|
||||
| `sha256:0165552fad28860f2ea6079be7a87ea0833acde99309b3ef619c8f81707c46a3` | `01_Matplotlib.pdf` | 14 | 46, 48, 49, 50, 51, 52, 54, 97, 99, 105 |
|
||||
| `sha256:792a1c5aaa1743ab203a363a8f6cd07c3b043e33c72e97c4ea21f5862158e6c1` | `01_Matplotlib.pdf` | 17 | 43, 46, 48, 49, 50, 51, 52, 53, 54, 56 |
|
||||
| `sha256:f4bfd64f36bf33dea79800561a67f78d5ccdb436363574abf0892f58b376a2e6` | `01_Matplotlib.pdf` | 25 | 32, 46, 48, 49, 50, 51, 52, 53, 54, 85 |
|
||||
| `sha256:119da04d962622c8aa46d77f6bdfccb5d4a4ef7173775275b046efd59098e5d9` | `01_Matplotlib.pdf` | 17 | 46, 48, 49, 50, 53, 55, 97, 101, 103, 105 |
|
||||
| `sha256:003af1c45e3a5ab09544e226eba25e3a70abfe6e36dd48584474cc7a497685f6` | `01_Matplotlib.pdf` | 28 | 32, 40, 41, 46, 48, 49, 50, 52, 54, 56 |
|
||||
| `sha256:88b3471db1978cc83233f249453806a8369c766b089b424c86c2584196ed5dbf` | `01_Matplotlib.pdf` | 14 | 46, 48, 49, 50, 52, 54, 56, 100, 101, 102 |
|
||||
| `sha256:a15cc90b7fc110cef4f07fe8a692d572e1289a9ee29c95732294662fded4e042` | `01_Matplotlib.pdf` | 16 | 32, 46, 48, 49, 50, 51, 53, 79, 83, 97 |
|
||||
| `sha256:fb54c23aa081562ac114676ffe43032c9c0fb63af3e5b7b3441b88872d1f2e7a` | `01_Matplotlib.pdf` | 16 | 46, 48, 49, 50, 52, 53, 54, 56, 66, 72 |
|
||||
| `sha256:4b553d51d58f5891af071359fb016caf1c6137778da129a6b208dcc8cb0c4635` | `01_Matplotlib.pdf` | 9 | 46, 48, 49, 50, 51, 52, 53, 54, 56 |
|
||||
| `sha256:93573cb1ab32b9cb09378298fb120de079f6a309908d2ee86f91392a6aba5c31` | `01_Matplotlib.pdf` | 30 | 32, 45, 48, 49, 50, 51, 52, 53, 54, 55 |
|
||||
| `sha256:4febfad91e0141f9658506a0bf8fc2a449f0ea7d97b44e95fc9a970c77af4b0a` | `01_Matplotlib.pdf` | 7 | 48, 49, 50, 51, 52, 53, 54 |
|
||||
| `sha256:0386e5811612ba4b998d57cd3869d7fbc48092a79d436deda774af107a4af813` | `01_Matplotlib.pdf` | 9 | 46, 48, 49, 50, 51, 52, 53, 54, 55 |
|
||||
| `sha256:b95fa2a272cbc950b81320790d04fcf19ebb24050fa2139ba6a474172cac596b` | `01_Matplotlib.pdf` | 20 | 32, 40, 41, 48, 50, 52, 54, 56, 83, 85 |
|
||||
| `sha256:b318f65b9dc209eb6f004e3a6c20a772ebbca3d752adc10c66a6a8a479da2838` | `01_Matplotlib.pdf` | 20 | 32, 40, 41, 46, 48, 49, 50, 52, 53, 54 |
|
||||
| `sha256:64f725573c1f5d90196e94ed338a7af06baf274420414befeb9693c80acd0f77` | `01_Matplotlib.pdf` | 23 | 32, 46, 48, 49, 50, 51, 52, 53, 55, 57 |
|
||||
| `sha256:9a701e082ba5a779e2b20b8de0c7844b3f7838ba8cd4bd7ef366893761fb994d` | `01_Matplotlib.pdf` | 10 | 46, 48, 49, 50, 51, 52, 53, 54, 55, 56 |
|
||||
| `sha256:2f6f8d63ff6235f3b7cd6f5eba8076854892037afa2ea6962953b3e7cda3736e` | `01_Matplotlib.pdf` | 31 | 32, 40, 41, 44, 61, 65, 66, 67, 68, 70 |
|
||||
| `sha256:f17b5eb0ee996d1388c548f79fa50fa2d8c6076959eff189bb745d156d54547f` | `01_Matplotlib.pdf` | 26 | 32, 39, 65, 66, 67, 68, 73, 97, 98, 100 |
|
||||
| `sha256:f22c75548364bb25fc3efbe11f05c56e29f07c15c3046ddbc85a64e5cc5a97bd` | `01_Matplotlib.pdf` | 21 | 32, 48, 49, 50, 72, 80, 91, 93, 99, 100 |
|
||||
| `sha256:54a6c2e4bc290b48e21eece7f81cb6633c4b53a91f198fdaabfc73743b0e4499` | `01_Matplotlib.pdf` | 15 | 48, 49, 50, 51, 52, 53, 54, 97, 100, 101 |
|
||||
| `sha256:059af9dbaaab27c1d660ef00de6d4fd6e1687cfe2abca0a4c07265c2b2b450c6` | `01_Matplotlib.pdf` | 22 | 32, 46, 48, 49, 50, 51, 53, 55, 68, 77 |
|
||||
| `sha256:6651550d7b913850087244b7a70961989c2efc6d8c8d060d8663ff087b7723f6` | `01_Matplotlib.pdf` | 20 | 32, 46, 48, 49, 50, 52, 54, 56, 97, 100 |
|
||||
| `sha256:4d4ee6f04f57a40a589741df4747990ed485c192b0fc179a415aba822f352a8d` | `01_Matplotlib.pdf` | 26 | 32, 45, 48, 49, 50, 51, 52, 53, 56, 65 |
|
||||
| `sha256:4febfad91e0141f9658506a0bf8fc2a449f0ea7d97b44e95fc9a970c77af4b0a` | `01_Matplotlib.pdf` | 7 | 48, 49, 50, 51, 52, 53, 54 |
|
||||
| `sha256:e808a8ecba94bf0190ab7218bb0702698125ee2e456e82e00da709e8188e2bf8` | `01_Matplotlib.pdf` | 28 | 32, 46, 48, 49, 50, 53, 54, 70, 83, 84 |
|
||||
| `sha256:b5064b202eb1dae41545eddf674ee23bd82176e76aac8eb749540c2689f2e3ec` | `01_Matplotlib.pdf` | 33 | 32, 33, 37, 48, 49, 50, 52, 53, 54, 68 |
|
||||
| `sha256:f8f14410ec170248916e19f9d09120cfd786c47906b7c3735781d24e944b094e` | `01_Matplotlib.pdf` | 11 | 32, 83, 84, 101, 109, 110, 111, 115, 116, 119 |
|
||||
| `sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d` | `01_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 52, 53, 55 |
|
||||
| `sha256:994c963d70041eee141fd275fa22c525a71283de2b4a952814d02e0bbfa8caea` | `01_Matplotlib.pdf` | 4 | 46, 48, 49, 53 |
|
||||
| `sha256:c43134bebeaf8328ac299ba978d7e663e2dc4fe99463b9d7f72f72f77936204e` | `01_Matplotlib.pdf` | 9 | 48, 49, 50, 51, 52, 53, 54, 55, 56 |
|
||||
| `sha256:4f763d5e2cd0bdcd4650936ac505bd0e011899712ffe80ffa4b4d43f42941327` | `01_Matplotlib.pdf` | 10 | 46, 48, 49, 50, 52, 54, 56, 98, 103, 114 |
|
||||
| `sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d` | `01_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 52, 53, 55 |
|
||||
| `sha256:cb72de0c6105b9802d360c47a292a1f7bc344939a6801b879ea09dae4e45e863` | `01_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 51, 52, 53 |
|
||||
| `sha256:2add5b5ad6e536f3614b75e246b49a006edbbecdd309d24bd42c874a3ae3c8ed` | `01_Matplotlib.pdf` | 21 | 45, 48, 49, 50, 51, 52, 97, 99, 100, 101 |
|
||||
| `sha256:85e16e36ed0290c149647be7e468a7c46e7b66fd290131213040f7bad905aa44` | `02_Matplotlib.pdf` | 25 | 32, 45, 46, 48, 49, 50, 52, 53, 54, 56 |
|
||||
| `sha256:85e16e36ed0290c149647be7e468a7c46e7b66fd290131213040f7bad905aa44` | `02_Matplotlib.pdf` | 25 | 32, 45, 46, 48, 49, 50, 52, 53, 54, 56 |
|
||||
| `sha256:059af9dbaaab27c1d660ef00de6d4fd6e1687cfe2abca0a4c07265c2b2b450c6` | `02_Matplotlib.pdf` | 22 | 32, 46, 48, 49, 50, 51, 53, 55, 68, 77 |
|
||||
| `sha256:9a701e082ba5a779e2b20b8de0c7844b3f7838ba8cd4bd7ef366893761fb994d` | `02_Matplotlib.pdf` | 10 | 46, 48, 49, 50, 51, 52, 53, 54, 55, 56 |
|
||||
| `sha256:2f6f8d63ff6235f3b7cd6f5eba8076854892037afa2ea6962953b3e7cda3736e` | `02_Matplotlib.pdf` | 31 | 32, 40, 41, 44, 61, 65, 66, 67, 68, 70 |
|
||||
| `sha256:f17b5eb0ee996d1388c548f79fa50fa2d8c6076959eff189bb745d156d54547f` | `02_Matplotlib.pdf` | 26 | 32, 39, 65, 66, 67, 68, 73, 97, 98, 100 |
|
||||
| `sha256:6651550d7b913850087244b7a70961989c2efc6d8c8d060d8663ff087b7723f6` | `02_Matplotlib.pdf` | 20 | 32, 46, 48, 49, 50, 52, 54, 56, 97, 100 |
|
||||
| `sha256:4febfad91e0141f9658506a0bf8fc2a449f0ea7d97b44e95fc9a970c77af4b0a` | `02_Matplotlib.pdf` | 7 | 48, 49, 50, 51, 52, 53, 54 |
|
||||
| `sha256:e808a8ecba94bf0190ab7218bb0702698125ee2e456e82e00da709e8188e2bf8` | `02_Matplotlib.pdf` | 28 | 32, 46, 48, 49, 50, 53, 54, 70, 83, 84 |
|
||||
| `sha256:b5064b202eb1dae41545eddf674ee23bd82176e76aac8eb749540c2689f2e3ec` | `02_Matplotlib.pdf` | 33 | 32, 33, 37, 48, 49, 50, 52, 53, 54, 68 |
|
||||
| `sha256:f8f14410ec170248916e19f9d09120cfd786c47906b7c3735781d24e944b094e` | `02_Matplotlib.pdf` | 11 | 32, 83, 84, 101, 109, 110, 111, 115, 116, 119 |
|
||||
| `sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d` | `02_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 52, 53, 55 |
|
||||
| `sha256:994c963d70041eee141fd275fa22c525a71283de2b4a952814d02e0bbfa8caea` | `02_Matplotlib.pdf` | 4 | 46, 48, 49, 53 |
|
||||
| `sha256:c43134bebeaf8328ac299ba978d7e663e2dc4fe99463b9d7f72f72f77936204e` | `02_Matplotlib.pdf` | 9 | 48, 49, 50, 51, 52, 53, 54, 55, 56 |
|
||||
| `sha256:4f763d5e2cd0bdcd4650936ac505bd0e011899712ffe80ffa4b4d43f42941327` | `02_Matplotlib.pdf` | 10 | 46, 48, 49, 50, 52, 54, 56, 98, 103, 114 |
|
||||
| `sha256:2be58b6ef1e29a83b8634d70b9e32c37a15dea2e608894439ef7224c35b77f5d` | `02_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 52, 53, 55 |
|
||||
| `sha256:cb72de0c6105b9802d360c47a292a1f7bc344939a6801b879ea09dae4e45e863` | `02_Matplotlib.pdf` | 7 | 46, 48, 49, 50, 51, 52, 53 |
|
||||
| `sha256:31d0e67bc63a816302c9ff6ad9c19e17603aef1a4c3677b81b1d9084caa86e03` | `03_handout-beginner.pdf` | 6 | 46, 48, 49, 50, 51, 53 |
|
||||
| `sha256:4b509d2ae2cfab89783a73df2c66f0fd50949f97696079cb58f1e58b81daaa07` | `03_handout-beginner.pdf` | 4 | 84, 101, 105, 109 |
|
||||
| `sha256:831f7012db360331ffb5a5de6a6d6e03ffaad29f48d81cabe9fc613b25aad818` | `04_handout-intermediate.pdf` | 43 | 32, 40, 41, 46, 48, 49, 50, 51, 52, 53 |
|
||||
| `sha256:bf790625423c5ebdf94760eb796c847af885b930d3a30861509b07f1c77c3f60` | `04_handout-intermediate.pdf` | 9 | 46, 48, 49, 50, 51, 52, 53, 54, 56 |
|
||||
| `sha256:f7c3be2199c397a4c702dd434ac63fc9e046d749eff8cede4513fbc2774751b4` | `04_handout-intermediate.pdf` | 5 | 48, 49, 50, 51, 53 |
|
||||
| `sha256:8f7bf7a6382e8a762c5a84f19f84f0675f61eb1b34bd42562c0b3ac6712e29ef` | `04_handout-intermediate.pdf` | 2 | 48, 49 |
|
||||
| `sha256:dfaf8075e13be0e51f72485f9d825cea9ad077eb2dd9d63b9922add67d7d2761` | `04_handout-intermediate.pdf` | 12 | 32, 48, 49, 50, 51, 53, 80, 100, 101, 105 |
|
||||
| `sha256:853422e67ac88fe7ae28d5c459dc9f5a84f24e7840eeb2d82a00719032119326` | `04_handout-intermediate.pdf` | 10 | 32, 67, 83, 97, 100, 101, 105, 110, 111, 115 |
|
||||
| `sha256:b42182c55ec4bd53ab0698bee5f92945921dbccb534fdb5c6b41f1782e1fe88e` | `04_handout-intermediate.pdf` | 7 | 32, 48, 49, 50, 51, 53, 65 |
|
||||
| `sha256:75466035ac34f2523215e599452e32d796d7d02bc7122ed3d02fe91ebe064c25` | `04_handout-intermediate.pdf` | 6 | 48, 49, 50, 52, 54, 56 |
|
||||
| `sha256:75466035ac34f2523215e599452e32d796d7d02bc7122ed3d02fe91ebe064c25` | `04_handout-intermediate.pdf` | 6 | 48, 49, 50, 52, 54, 56 |
|
||||
|
||||
## Alias: `dejavusans-bold`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:dc03917f2edd92a7a68a46ad36f65a908e4feb85e61cb37e9026205f3986574a` | `01_Matplotlib.pdf` | 7 | 65, 87, 100, 101, 103, 105, 116 |
|
||||
| `sha256:dc03917f2edd92a7a68a46ad36f65a908e4feb85e61cb37e9026205f3986574a` | `02_Matplotlib.pdf` | 7 | 65, 87, 100, 101, 103, 105, 116 |
|
||||
| `sha256:c845063bef18f173afbfcb90fbf6773f43648c5f0666ecfa0132afe4e164068d` | `03_handout-beginner.pdf` | 9 | 32, 65, 83, 97, 101, 105, 110, 118, 119 |
|
||||
|
||||
## Alias: `dejavusans-oblique`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:81cd2d4d9353ee02c7ed80c2892658072b2a8bbd9ed1832b474129dfbe35d5d8` | `01_Matplotlib.pdf` | 13 | 70, 71, 85, 87, 100, 101, 103, 109, 112, 114 |
|
||||
| `sha256:08864aa8e8d17cead6059d5b4f1b1eea2053fa0ea3ca64e885d6eaacb78bccaf` | `01_Matplotlib.pdf` | 2 | 100, 120 |
|
||||
|
||||
## Alias: `dejavusansdisplay`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:ae77c4eb2c49f72c616272f3d7ac624ddb0b4db1c77acbe6b9d13531f68e1d5d` | `01_Matplotlib.pdf` | 0 | |
|
||||
| `sha256:ae77c4eb2c49f72c616272f3d7ac624ddb0b4db1c77acbe6b9d13531f68e1d5d` | `01_Matplotlib.pdf` | 0 | |
|
||||
|
||||
## Alias: `dejavusansmono`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:88758adf0b41a81204ed3ad63463f5d15c7c2f80e8942cee501d06fa7274dc4e` | `01_Matplotlib.pdf` | 8 | 97, 98, 105, 108, 109, 111, 112, 116 |
|
||||
| `sha256:74e60bcb2d7975b0c7b372aca9fc25f55c9018005425a741830e7c4370b8d593` | `01_Matplotlib.pdf` | 24 | 35, 39, 48, 49, 50, 51, 52, 53, 54, 55 |
|
||||
|
||||
## Alias: `f36`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:72c7041f938222b87ce2d9295547f8c19edf250af538160b69be35a968d76ea7` | `08_matplotlib.pdf` | 1 | 136 |
|
||||
|
||||
## Alias: `f59`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:d5942c0913ef64ae862556a746b28dac1a621caa5e05973e16881c8e8e15e329` | `08_matplotlib.pdf` | 1 | 42 |
|
||||
|
||||
## Alias: `sourcecodepro-regular`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:96ba693001b2ab224ad5b5a7464cecd4d33e68f30fb23f78a8473dbb031ce246` | `04_handout-intermediate.pdf` | 11 | 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 |
|
||||
| `sha256:72fca14e9e44fc41b0cdb1c6a088f0b07f882f9f04c51a0145f43cf8b285c5b6` | `04_handout-intermediate.pdf` | 11 | 46, 48, 49, 50, 51, 52, 53, 54, 55, 56 |
|
||||
|
||||
## Alias: `stixsizethreesym-regular`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:33d0ab9d9d72c1aed1edfc9b815dd6a2d618cbbe9084309c7f2de0f3df3073d7` | `01_Matplotlib.pdf` | 2 | 91, 93 |
|
||||
|
||||
## Alias: `unknown`
|
||||
|
||||
| Signature | Samples | Glyph Count | Coverage (first 10) |
|
||||
| --- | --- | --- | --- |
|
||||
| `sha256:23e4b174e951cd6135e229fb397db4ff518021cf14d5f817031b9f754841e511` | `07_matplotlib.pdf` | 11 | 0, 46, 97, 98, 105, 108, 109, 111, 112, 116 |
|
||||
| `sha256:f6112d6a35d5fdf5d6431b3156b713020953154042814ad12d2b81731c97250b` | `07_matplotlib.pdf` | 13 | 0, 32, 37, 97, 98, 101, 105, 108, 109, 110 |
|
||||
| `sha256:7e05c074b630c0f3e1fc23537c22bf4b6191c783601e534cd156f71c1827702c` | `07_matplotlib.pdf` | 42 | 0, 32, 34, 37, 39, 40, 41, 42, 44, 46 |
|
||||
| `sha256:9958bc1f309f6bafb55834e271bb0b337704fcac51f6d989abe9553fcffa103d` | `07_matplotlib.pdf` | 15 | 0, 46, 97, 98, 105, 108, 109, 110, 111, 112 |
|
||||
@@ -3,14 +3,14 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<base href="%BASE_URL%" />
|
||||
<link rel="icon" href="/modern-logo/favicon.ico" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="The Free Adobe Acrobat alternative (10M+ Downloads)"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="/modern-logo/logo192.png" />
|
||||
<link rel="apple-touch-icon" href="/logo192.png" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
|
||||
<title>Stirling PDF</title>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"@embedpdf/core": "^1.4.1",
|
||||
"@embedpdf/engines": "^1.4.1",
|
||||
"@embedpdf/plugin-annotation": "^1.4.1",
|
||||
"@embedpdf/plugin-bookmark": "^1.4.1",
|
||||
"@embedpdf/plugin-export": "^1.4.1",
|
||||
"@embedpdf/plugin-history": "^1.4.1",
|
||||
"@embedpdf/plugin-interaction-manager": "^1.4.1",
|
||||
@@ -27,6 +26,8 @@
|
||||
"@embedpdf/plugin-viewport": "^1.4.1",
|
||||
"@embedpdf/plugin-zoom": "^1.4.1",
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@tauri-apps/api": "^2.5.0",
|
||||
"@tauri-apps/plugin-fs": "^2.4.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
"@iconify/react": "^6.0.2",
|
||||
"@mantine/core": "^8.3.1",
|
||||
@@ -36,14 +37,8 @@
|
||||
"@mui/icons-material": "^7.3.2",
|
||||
"@mui/material": "^7.3.2",
|
||||
"@reactour/tour": "^3.8.0",
|
||||
"@stripe/react-stripe-js": "^4.0.2",
|
||||
"@stripe/stripe-js": "^7.9.0",
|
||||
"@supabase/supabase-js": "^2.47.13",
|
||||
"@tailwindcss/postcss": "^4.1.13",
|
||||
"@tanstack/react-virtual": "^3.13.12",
|
||||
"@tauri-apps/api": "^2.5.0",
|
||||
"@tauri-apps/plugin-fs": "^2.4.0",
|
||||
"@tauri-apps/plugin-http": "^2.5.4",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"axios": "^1.12.2",
|
||||
"globals": "^16.4.0",
|
||||
@@ -57,8 +52,8 @@
|
||||
"posthog-js": "^1.268.0",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"react-i18next": "^15.7.3",
|
||||
"react-rnd": "^10.5.2",
|
||||
"react-i18next": "^15.7.3",
|
||||
"react-router-dom": "^7.9.1",
|
||||
"signature_pad": "^5.0.4",
|
||||
"tailwindcss": "^4.1.13",
|
||||
@@ -116,11 +111,11 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2.5.0",
|
||||
"@eslint/js": "^9.36.0",
|
||||
"@iconify-json/material-symbols": "^1.2.48",
|
||||
"@iconify-json/material-symbols": "^1.2.37",
|
||||
"@iconify/utils": "^3.0.2",
|
||||
"@playwright/test": "^1.55.0",
|
||||
"@tauri-apps/cli": "^2.5.0",
|
||||
"@testing-library/dom": "^10.4.1",
|
||||
"@testing-library/jest-dom": "^6.8.0",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
|
||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" id="Layer_1" x="0" y="0" version="1.1" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512" xml:space="preserve"><defs id="defs173"><linearGradient id="XMLID_5_" x1="304.496" x2="316.036" y1="422.91" y2="326.263" gradientUnits="userSpaceOnUse"><stop offset="0" style="stop-color:#dcf1f3" id="stop156"/><stop offset="1" style="stop-color:#c2c2c9" id="stop158"/></linearGradient></defs><style id="style150" type="text/css">.st1{fill:#c02223}.st2{fill:#882425}.st3{fill:url(#XMLID_5_)}.st4{fill:url(#XMLID_7_)}</style><g id="XMLID_4_"><path id="XMLID_131_" d="M 347.01402,14.355825 98.978019,69.02261 C 73.825483,74.547445 55.942464,96.792175 55.942464,122.52628 v 315.06096 c 0,22.39012 16.719895,41.14548 38.819234,43.76251 L 224.8861,498.36042 339.48636,384.26465 455.76603,265.15425 453.73057,84.870162 C 453.43979,62.916214 433.08513,46.632491 411.71274,51.284984 l -28.78729,6.251786 0.14539,-13.666697 C 383.36162,24.678542 365.62399,10.284894 347.01402,14.355825 Z" class="st1" style="stroke-width:1.45391"/><path id="XMLID_117_" d="m 383.21622,57.53677 v 285.8375 L 456.05681,265.00885 454.02135,78.763767 C 453.87595,59.863016 436.28372,45.905539 417.81914,49.97647 Z" class="st2" style="stroke-width:1.45391"/><polygon id="XMLID_18_" points="234.7 422.6 368.5 387.7 393.5 262.2" class="st3" style="fill:url(#XMLID_5_)" transform="matrix(1.4556308,0,0,1.4548265,-116.73161,-116.45231)"/><linearGradient id="XMLID_7_" x1="223.084" x2="241.417" y1="372.756" y2="114.557" gradientTransform="matrix(1.4539039,0,0,1.4539039,-116.19976,-116.20474)" gradientUnits="userSpaceOnUse"><stop offset="0" style="stop-color:#dcf1f3" id="stop163"/><stop offset="1" style="stop-color:#c2c2c9" id="stop165"/></linearGradient><path id="XMLID_6_" d="m 282.89686,214.84917 c 0,0 -22.24473,-28.93269 -38.67384,-36.78377 -10.46811,-4.94327 -26.02489,-6.83335 -38.23768,-0.72695 -18.02841,9.0142 -19.91848,34.31213 -3.34397,44.34406 3.92553,2.47165 9.15959,4.50711 15.99294,6.10641 36.63838,8.43264 97.12077,25.87949 89.70587,96.10304 0,0 -4.21633,65.86185 -73.56753,73.42215 -12.2128,1.30851 -24.57098,0.43617 -36.493,-2.32625 -16.42911,-3.63476 -45.50719,-11.04967 -59.75545,-19.91849 l -2.61703,-75.16682 h 6.97875 c 0,0 13.81208,33.43978 53.06749,49.57812 7.26952,2.90781 15.26599,4.07093 22.97168,2.90781 9.74116,-1.45391 21.22699,-6.68796 25.87949,-22.53551 0,0 7.85108,-23.11707 -32.85823,-35.76604 -32.56744,-10.17733 -63.24481,-20.64543 -75.89378,-54.95757 -5.961,-16.28371 -6.97874,-34.31212 -2.90781,-51.61358 5.37944,-22.53551 20.79082,-54.23062 64.40794,-67.89732 0,0 57.28381,-15.55677 96.53922,5.52484 l -1.74468,89.70587 z" class="st4" style="fill:url(#XMLID_7_);stroke-width:1.45391"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 406 KiB |
@@ -1,33 +0,0 @@
|
||||
<svg width="82" height="92" viewBox="0 0 82 92" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_dddd_3933_98714)">
|
||||
<path d="M33.0874 84.4375L70.2191 75.6383L77.157 43.9963L33.0874 84.4375Z" fill="#D0DBDC"/>
|
||||
<path d="M56.3682 0.557473C59.916 -0.147829 63.2976 2.34683 63.2422 5.67271L63.2139 8.04087L68.7031 6.95689C72.7776 6.15095 76.6575 8.97364 76.7129 12.7782L77.1016 44.0213L54.9326 64.6639L33.084 84.4374L8.27637 81.4891C4.06313 81.0356 0.875008 77.7854 0.875 73.9051V19.3036C0.875108 14.8438 4.28482 10.9886 9.08008 10.0311L56.3682 0.557473ZM46.2773 19.7586C38.7933 16.1052 27.8721 18.8006 27.8721 18.8006C19.5566 21.1692 16.6184 26.6627 15.5928 30.5682C14.8168 33.5665 15.0111 36.6907 16.1475 39.5126C18.559 45.4589 24.4073 47.2732 30.6162 49.037C38.3528 51.2221 36.8902 55.2099 36.8809 55.2352C35.9939 57.9815 33.8044 58.8885 31.9473 59.1405C30.4782 59.3421 28.9533 59.1405 27.5674 58.6366C20.0835 55.8397 17.4502 50.0448 17.4502 50.0448H16.1191L16.6182 63.0711C19.3345 64.6081 24.8785 65.8934 28.0107 66.5233C30.2837 67.002 32.6404 67.1534 34.9688 66.9266C48.1902 65.6162 48.9941 54.202 48.9941 54.202C50.4076 42.0323 38.8767 39.0091 31.8916 37.5477C30.589 37.2706 29.5911 36.9174 28.8428 36.4891C25.6828 34.7505 26.0434 30.3658 29.4805 28.8036C31.8088 27.7456 34.7749 28.0729 36.7705 28.9295C39.9027 30.2903 44.1436 35.3045 44.1436 35.3045H45.9453L46.2773 19.7586Z" fill="white"/>
|
||||
<path d="M63.2779 8.03641L63.2781 57.7846L77.1651 44.2035L76.7771 11.9265C76.7494 8.65091 73.3953 6.02067 69.875 6.72618L63.2779 8.03641Z" fill="#D3D3D3"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_dddd_3933_98714" x="-8.34465e-07" y="-4.17233e-07" width="81.1025" height="91.875" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="0.4375"/>
|
||||
<feGaussianBlur stdDeviation="0.4375"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_3933_98714"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="0.4375" dy="1.3125"/>
|
||||
<feGaussianBlur stdDeviation="0.656251"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.09 0"/>
|
||||
<feBlend mode="normal" in2="effect1_dropShadow_3933_98714" result="effect2_dropShadow_3933_98714"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="0.875001" dy="3.0625"/>
|
||||
<feGaussianBlur stdDeviation="0.875001"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"/>
|
||||
<feBlend mode="normal" in2="effect2_dropShadow_3933_98714" result="effect3_dropShadow_3933_98714"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="1.75" dy="5.25"/>
|
||||
<feGaussianBlur stdDeviation="1.09375"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.01 0"/>
|
||||
<feBlend mode="normal" in2="effect3_dropShadow_3933_98714" result="effect4_dropShadow_3933_98714"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect4_dropShadow_3933_98714" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -1,34 +0,0 @@
|
||||
<svg width="82" height="92" viewBox="0 0 82 92" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g opacity="0.2" filter="url(#filter0_dddd_3933_98709)">
|
||||
<path d="M56.3678 0.557543L9.07973 10.0315C4.2844 10.989 0.875 14.8441 0.875 19.3039V73.9053C0.875 77.7856 4.06265 81.0359 8.27589 81.4895L33.0841 84.4375L54.9327 64.6642L77.1014 44.0219L76.7133 12.778C76.6579 8.97326 72.7773 6.15122 68.7027 6.95752L63.2143 8.04098L63.2421 5.67248C63.2975 2.34651 59.9158 -0.147965 56.3678 0.557543Z" fill="#FF4B4B"/>
|
||||
<path d="M63.269 8.04043V57.5772L77.1561 43.9962L76.7681 11.7192C76.7403 8.44358 73.3864 6.02469 69.8661 6.7302L63.269 8.04043Z" fill="#545454"/>
|
||||
<path d="M33.0873 84.4375L70.2189 75.6383L77.1569 43.9963L33.0873 84.4375Z" fill="#D0DBDC"/>
|
||||
<path d="M44.1432 35.3049C44.1432 35.3049 39.9022 30.2907 36.77 28.9301C34.7743 28.0734 31.8084 27.7459 29.48 28.8041C26.0429 30.3663 25.6826 34.7506 28.8425 36.4891C29.5909 36.9175 30.5888 37.2702 31.8915 37.5474C38.8767 39.0088 50.4076 42.0324 48.994 54.2024C48.994 54.2024 48.1901 65.6166 34.9683 66.9268C32.6399 67.1536 30.2839 67.0024 28.0109 66.5236C24.8787 65.8937 19.335 64.6087 16.6185 63.0717L16.1196 50.045H17.4501C17.4501 50.045 20.0834 55.8402 27.5674 58.6371C28.9534 59.141 30.4779 59.3426 31.947 59.141C33.8041 58.889 35.9939 57.982 36.8809 55.2355C36.8809 55.2355 38.3777 51.2292 30.6165 49.0371C24.4075 47.2733 18.5589 45.4592 16.1473 39.5127C15.0109 36.6907 14.8168 33.5663 15.593 30.5679C16.6185 26.6624 19.5567 21.1695 27.8723 18.801C27.8723 18.801 38.7935 16.105 46.2776 19.7585L45.9449 35.3049H44.1432Z" fill="white"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_dddd_3933_98709" x="-8.34465e-07" y="-4.17233e-07" width="81.0944" height="91.875" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="0.4375"/>
|
||||
<feGaussianBlur stdDeviation="0.4375"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_3933_98709"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="0.4375" dy="1.3125"/>
|
||||
<feGaussianBlur stdDeviation="0.656251"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.09 0"/>
|
||||
<feBlend mode="normal" in2="effect1_dropShadow_3933_98709" result="effect2_dropShadow_3933_98709"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="0.875001" dy="3.0625"/>
|
||||
<feGaussianBlur stdDeviation="0.875001"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"/>
|
||||
<feBlend mode="normal" in2="effect2_dropShadow_3933_98709" result="effect3_dropShadow_3933_98709"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="1.75" dy="5.25"/>
|
||||
<feGaussianBlur stdDeviation="1.09375"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.01 0"/>
|
||||
<feBlend mode="normal" in2="effect3_dropShadow_3933_98709" result="effect4_dropShadow_3933_98709"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect4_dropShadow_3933_98709" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,5 +0,0 @@
|
||||
<svg width="77" height="84" viewBox="0 0 77 84" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M32.2124 83.9997L69.3441 75.2005L76.282 43.5585L32.2124 83.9997Z" fill="#D0DBDC"/>
|
||||
<path d="M55.4932 0.119995C59.0409 -0.585293 62.4223 1.9086 62.3672 5.23425L62.3389 7.60339L67.8281 6.51941C71.9024 5.71349 75.7821 8.53542 75.8379 12.3397L76.2266 43.5839L54.0576 64.2264L32.209 83.9999L7.40137 81.0516C3.18818 80.5981 8.70906e-05 77.3479 0 73.4677V18.8661C3.4631e-05 14.4063 3.40977 10.5511 8.20508 9.59363L55.4932 0.119995ZM45.4023 19.3212C37.9183 15.6676 26.9971 18.3632 26.9971 18.3632C18.6818 20.7316 15.7434 26.2243 14.7178 30.1298C13.9417 33.1282 14.136 36.253 15.2725 39.0751C17.684 45.0213 23.5324 46.8357 29.7412 48.5995C37.5024 50.7916 36.0059 54.7977 36.0059 54.7977C35.1189 57.544 32.9294 58.451 31.0723 58.703C29.6032 58.9046 28.0783 58.703 26.6924 58.1991C19.2266 55.4091 16.588 49.6354 16.5752 49.6073H15.2441L15.7432 62.6337C18.4595 64.1706 24.0035 65.4559 27.1357 66.0858C29.4087 66.5646 31.7654 66.7159 34.0938 66.4891C47.3152 65.1787 48.1191 53.7645 48.1191 53.7645C49.5327 41.5946 38.0017 38.5707 31.0166 37.1093C29.714 36.8321 28.7161 36.4799 27.9678 36.0516C24.8078 34.3131 25.1684 29.9283 28.6055 28.3661C30.9338 27.3081 33.8999 27.6354 35.8955 28.4921C39.0277 29.8529 43.2686 34.8671 43.2686 34.8671H45.0703L45.4023 19.3212Z" fill="white"/>
|
||||
<path d="M62.394 7.60263V57.1394L76.2811 43.5584L75.8931 11.2814C75.8653 8.00577 72.5114 5.58689 68.9911 6.2924L62.394 7.60263Z" fill="#EEEEEE"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |