Skip to content

Commit

Permalink
Test out sending all the options for PDF/A format, see if it works on…
Browse files Browse the repository at this point in the history
… edge
  • Loading branch information
stumpylog committed Dec 4, 2023
1 parent 0269f40 commit f2f99e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/gotenberg_client/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/gotenberg_client/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f2f99e9

Please sign in to comment.