Feature: Upgrade Gotenberg to v8 (#7094)

This commit is contained in:
Trenton H
2024-06-26 19:37:50 -07:00
committed by GitHub
parent 80c2d90e74
commit 29e6371cd1
8 changed files with 45 additions and 19 deletions

View File

@@ -102,7 +102,10 @@ class TikaDocumentParser(DocumentParser):
}:
route.pdf_format(PdfAFormat.A2b)
elif settings.OCR_OUTPUT_TYPE == OutputTypeChoices.PDF_A1:
route.pdf_format(PdfAFormat.A1a)
self.log.warn(
"Gotenberg does not support PDF/A-1a, choosing PDF/A-2b instead",
)
route.pdf_format(PdfAFormat.A2b)
elif settings.OCR_OUTPUT_TYPE == OutputTypeChoices.PDF_A3:
route.pdf_format(PdfAFormat.A3b)

View File

@@ -109,7 +109,7 @@ class TestTikaParser(HttpxMockMixin, TestCase):
for setting, expected_key in [
("pdfa", "PDF/A-2b"),
("pdfa-2", "PDF/A-2b"),
("pdfa-1", "PDF/A-1a"),
("pdfa-1", "PDF/A-2b"),
("pdfa-3", "PDF/A-3b"),
]:
with override_settings(OCR_OUTPUT_TYPE=setting):
@@ -124,9 +124,10 @@ class TestTikaParser(HttpxMockMixin, TestCase):
request = self.httpx_mock.get_request()
found = False
for field in request.stream.fields:
if isinstance(field, DataField) and field.name == "pdfFormat":
if isinstance(field, DataField) and field.name == "pdfa":
self.assertEqual(field.value, expected_key)
found = True
break
self.assertTrue(found)
self.httpx_mock.reset(assert_all_responses_were_requested=False)