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)