From 31b2e2cf90f0d1a5d9dff38b476ddc7f23eb0d5d Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Mon, 4 Dec 2023 07:00:39 -0800 Subject: [PATCH] Test out sending all the options for PDF/A format, see if it works on edge --- src/gotenberg_client/_base.py | 4 ++++ src/gotenberg_client/options.py | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gotenberg_client/_base.py b/src/gotenberg_client/_base.py index 42aa930..3c75d18 100644 --- a/src/gotenberg_client/_base.py +++ b/src/gotenberg_client/_base.py @@ -114,6 +114,10 @@ def pdf_format(self, pdf_format: PdfAFormat) -> Self: self._form_data.update(pdf_format.to_form()) return self + def universal_access_pdf(self, *, pdf_ua: bool) -> Self: + self._form_data.update({"pdfua": str(pdf_ua)}) + return self + def trace(self, trace_id: str) -> Self: self._headers["Gotenberg-Trace"] = trace_id return self diff --git a/src/gotenberg_client/options.py b/src/gotenberg_client/options.py index 4751de7..d2ef4ae 100644 --- a/src/gotenberg_client/options.py +++ b/src/gotenberg_client/options.py @@ -18,12 +18,15 @@ class PdfAFormat(enum.Enum): A3b = enum.auto() def to_form(self) -> Dict[str, str]: + format_name = None if self.value == PdfAFormat.A1a.value: - return {"pdfFormat": "PDF/A-1a"} + format_name = "PDF/A-1a" elif self.value == PdfAFormat.A2b.value: - return {"pdfFormat": "PDF/A-2b"} + format_name = "PDF/A-2b" elif self.value == PdfAFormat.A3b.value: - return {"pdfFormat": "PDF/A-3b"} + format_name = "PDF/A-3b" + if format_name is not None: + return {"pdfa": format_name, "pdfFormat": format_name} else: # pragma: no cover raise NotImplementedError(self.value)