Ajoute le plugin Acrobat Pro d'imposition (acrobat-plugin/)

Suite d'imposition professionnelle en Folder-Level Scripts JS (7 modules +
verification de licence Vision), avec un plugin natif hybride optionnel
(WinINet + Registre) pour deplacer la verification de licence en code
compile. Installeur install.bat sur le meme modele que celui du projet
desktop (git portable, detection automatique des dossiers Acrobat).
This commit is contained in:
Jules
2026-06-21 22:16:24 +02:00
parent 202834a794
commit de76c1776c
14 changed files with 2856 additions and 0 deletions

258
acrobat-plugin/install.bat Normal file
View File

@@ -0,0 +1,258 @@
@echo off
chcp 65001 >nul 2>&1
setlocal EnableDelayedExpansion
title Imposition Professionnelle (Acrobat) — Installation
set "APP_NAME=Imposition Professionnelle (plugin Acrobat)"
set "INSTALL_DIR=%LOCALAPPDATA%\CopydevImposingAcrobat"
set "REPO_DIR=%INSTALL_DIR%\repo"
set "GITEA_REPO=https://git.copydev.fr/jules/copydev-imposing-tool.git"
set "GIT_URL=https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.2/MinGit-2.47.1.2-64-bit.zip"
:: ============================================================
:MENU
cls
echo ============================================================
echo %APP_NAME%
echo ============================================================
echo.
echo 1. Installer
echo 2. Mettre a jour
echo 3. Lancer Acrobat
echo 4. Desinstaller
echo 5. Quitter
echo.
set "CHOIX="
set /p "CHOIX=Votre choix [1-5] : "
if "%CHOIX%"=="1" goto INSTALL
if "%CHOIX%"=="2" goto UPDATE
if "%CHOIX%"=="3" goto LAUNCH
if "%CHOIX%"=="4" goto UNINSTALL
if "%CHOIX%"=="5" goto FIN
echo Choix invalide.
timeout /t 2 >nul
goto MENU
:: ============================================================
:: GIT (portable si absent du systeme)
:: ============================================================
:TROUVER_GIT
set "GIT_CMD="
where git >nul 2>&1
if %ERRORLEVEL%==0 (
set "GIT_CMD=git"
exit /b 0
)
if exist "%INSTALL_DIR%\git\cmd\git.exe" (
set "GIT_CMD=%INSTALL_DIR%\git\cmd\git.exe"
exit /b 0
)
echo Telechargement de Git portable...
if not exist "%INSTALL_DIR%\temp" mkdir "%INSTALL_DIR%\temp"
if not exist "%INSTALL_DIR%\git" mkdir "%INSTALL_DIR%\git"
powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%GIT_URL%' -OutFile '%INSTALL_DIR%\temp\git.zip' -UseBasicParsing"
if not exist "%INSTALL_DIR%\temp\git.zip" (
echo [ERREUR] Echec telechargement Git
exit /b 1
)
powershell -Command "Expand-Archive -Force '%INSTALL_DIR%\temp\git.zip' '%INSTALL_DIR%\git'"
del "%INSTALL_DIR%\temp\git.zip" 2>nul
if not exist "%INSTALL_DIR%\git\cmd\git.exe" (
echo [ERREUR] git.exe introuvable apres extraction
exit /b 1
)
set "GIT_CMD=%INSTALL_DIR%\git\cmd\git.exe"
exit /b 0
:: ============================================================
:: Detection des dossiers JavaScripts d'Acrobat (un par version
:: installee, ex: DC, 2020, 2024...). Cree le dossier si absent
:: (ne necessite pas de droits admin : c'est sous %APPDATA%).
:: ============================================================
:TROUVER_DOSSIERS_ACROBAT
set "NB_DOSSIERS=0"
if not exist "%APPDATA%\Adobe\Acrobat" (
exit /b 1
)
for /d %%D in ("%APPDATA%\Adobe\Acrobat\*") do (
if not exist "%%D\JavaScripts" mkdir "%%D\JavaScripts"
set /a NB_DOSSIERS+=1
set "DOSSIER_JS_!NB_DOSSIERS!=%%D\JavaScripts"
)
if "%NB_DOSSIERS%"=="0" exit /b 1
exit /b 0
:: ============================================================
:: INSTALLATION / MISE A JOUR (meme logique : on clone si absent,
:: on pull sinon, puis on recopie les fichiers a jour)
:: ============================================================
:INSTALL
cls
echo ============================================================
echo INSTALLATION de %APP_NAME%
echo ============================================================
goto DEPLOIEMENT
:UPDATE
cls
echo ============================================================
echo MISE A JOUR de %APP_NAME%
echo ============================================================
goto DEPLOIEMENT
:DEPLOIEMENT
echo.
if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%"
echo [1/4] Git...
call :TROUVER_GIT
if %ERRORLEVEL% neq 0 (
pause
goto MENU
)
echo [OK]
echo.
echo [2/4] Telechargement du code (acrobat-plugin/)...
if exist "%REPO_DIR%\.git" (
pushd "%REPO_DIR%"
"%GIT_CMD%" fetch origin
"%GIT_CMD%" pull origin master
popd
) else (
if exist "%REPO_DIR%" rmdir /s /q "%REPO_DIR%"
"%GIT_CMD%" clone "%GITEA_REPO%" "%REPO_DIR%"
)
if not exist "%REPO_DIR%\acrobat-plugin\src\Imposition-00-Core.js" (
echo [ERREUR] Code source introuvable apres clonage/mise a jour
pause
goto MENU
)
echo [OK]
echo.
echo [3/4] Detection d'Acrobat et copie des scripts...
call :TROUVER_DOSSIERS_ACROBAT
if %ERRORLEVEL% neq 0 (
echo [ERREUR] Aucune installation d'Acrobat trouvee sous %APPDATA%\Adobe\Acrobat
echo Verifiez qu'Acrobat Pro (pas seulement Reader) est installe.
pause
goto MENU
)
for /l %%i in (1,1,%NB_DOSSIERS%) do (
echo -^> !DOSSIER_JS_%%i!
copy /y "%REPO_DIR%\acrobat-plugin\src\*.js" "!DOSSIER_JS_%%i!\" >nul
)
echo [OK] Scripts copies dans %NB_DOSSIERS% dossier^(s^) Acrobat
echo.
echo [4/4] Plugin natif (verification de licence)...
if exist "%REPO_DIR%\acrobat-plugin\native\dist\ImposingLicence.api" (
set "PLUGIN_DEST=%APPDATA%\Adobe\Acrobat"
for /d %%D in ("%APPDATA%\Adobe\Acrobat\*") do (
if not exist "%%D\Plug_ins3" mkdir "%%D\Plug_ins3"
copy /y "%REPO_DIR%\acrobat-plugin\native\dist\ImposingLicence.api" "%%D\Plug_ins3\" >nul
echo -^> %%D\Plug_ins3\ImposingLicence.api
)
echo [OK] Plugin natif copie
echo [!] Dossier "Plug_ins3" a verifier : c'est l'emplacement usuel des
echo plugins utilisateur sans droits admin, mais a confirmer selon
echo votre version d'Acrobat.
) else (
echo [INFO] Aucun .api precompile trouve dans native\dist\
echo Le plugin natif est optionnel : la suite fonctionne en JS seul,
echo avec une verification de licence plus simple ^(voir documentation^).
echo Pour l'activer, compilez native\PluginMain.cpp ^(SDK Acrobat + VS^)
echo et placez le .api resultant dans native\dist\ImposingLicence.api
echo avant de relancer cet installeur.
)
echo.
echo ============================================================
echo TERMINE
echo ============================================================
echo.
echo Redemarrez Acrobat Pro pour charger les scripts.
echo Menu attendu : Edition ^> Imposition Pro
echo.
set /p "LAUNCH=Lancer Acrobat maintenant ? [O/N] : "
if /i "!LAUNCH!"=="O" call :LANCER_ACROBAT
pause
goto MENU
:: ============================================================
:: LANCER ACROBAT
:: ============================================================
:LAUNCH
cls
echo ============================================================
echo LANCEMENT D'ACROBAT
echo ============================================================
echo.
call :LANCER_ACROBAT
timeout /t 2 >nul
goto MENU
:LANCER_ACROBAT
where acrobat >nul 2>&1
if %ERRORLEVEL%==0 (
start "" acrobat
exit /b 0
)
if exist "%ProgramFiles(x86)%\Adobe\Acrobat DC\Acrobat\Acrobat.exe" (
start "" "%ProgramFiles(x86)%\Adobe\Acrobat DC\Acrobat\Acrobat.exe"
exit /b 0
)
if exist "%ProgramFiles%\Adobe\Acrobat DC\Acrobat\Acrobat.exe" (
start "" "%ProgramFiles%\Adobe\Acrobat DC\Acrobat\Acrobat.exe"
exit /b 0
)
echo [!] Executable Acrobat introuvable automatiquement. Lancez-le manuellement.
exit /b 1
:: ============================================================
:: DESINSTALLATION
:: ============================================================
:UNINSTALL
cls
echo ============================================================
echo DESINSTALLATION de %APP_NAME%
echo ============================================================
echo.
echo Seront supprimes :
echo - Les scripts CDImp dans chaque dossier Acrobat\^<version^>\JavaScripts
echo - Le plugin natif ImposingLicence.api ^(s'il a ete installe^)
echo - %INSTALL_DIR% ^(code source local, cle de licence en registre conservee^)
echo.
set /p "CONFIRM=Confirmer ? [O/N] : "
if /i "%CONFIRM%" neq "O" goto MENU
echo.
if exist "%APPDATA%\Adobe\Acrobat" (
for /d %%D in ("%APPDATA%\Adobe\Acrobat\*") do (
del /q "%%D\JavaScripts\Imposition-*.js" 2>nul
del /q "%%D\Plug_ins3\ImposingLicence.api" 2>nul
)
)
echo [OK] Scripts et plugin supprimes
rmdir /s /q "%INSTALL_DIR%" 2>nul
echo [OK] %INSTALL_DIR% supprime
echo.
echo Pour retirer aussi la cle de licence enregistree :
echo supprimez la cle de registre HKCU\Software\Copydev\ImposingAcrobat
echo.
echo ============================================================
echo DESINSTALLATION TERMINEE
echo ============================================================
echo.
pause
goto MENU
:: ============================================================
:FIN
echo Au revoir !
timeout /t 2 >nul
exit /b 0