feat(pdfa): add PDF/A archival conversion using ocrmypdf

- Add ENABLE_PDFA_CONVERSION, PDFA_FORMAT, PDFA_UPLOAD_TO_PROVIDERS config settings
- Add original_pdfa_path and processed_pdfa_path columns to FileRecord model
- Create Alembic migration 011_add_pdfa_paths
- Create app/tasks/convert_to_pdfa.py Celery task using ocrmypdf + Ghostscript
- Integrate PDF/A conversion into finalize_document_storage pipeline
- Add comprehensive unit tests (15 tests)
- Update .env.demo and docs/ConfigurationGuide.md

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-02 13:35:13 +00:00
parent 34b9d529e7
commit eea99eb01d
9 changed files with 755 additions and 1 deletions
+14
View File
@@ -76,6 +76,20 @@ def finalize_document_storage(self, original_file: str, processed_file: str, met
# We pass 'True' (delete_after) and 'file_id' as per Main branch requirements
send_to_all_destinations.delay(processed_file, True, file_id)
# 3a. Trigger PDF/A archival conversion if enabled
if settings.enable_pdfa_conversion:
from app.tasks.convert_to_pdfa import convert_to_pdfa
logger.info(f"[{task_id}] PDF/A conversion enabled, queueing archival conversion")
log_task_progress(
task_id,
"finalize_document_storage",
"in_progress",
"Queueing PDF/A archival conversion",
file_id=file_id,
)
convert_to_pdfa.delay(file_id)
# 4. Send Notification (From Copilot)
# Note: This notification is sent after processing is complete but while uploads
# are being queued.