From 4edf8fd84c8d12339baab3989080e1f8b91b813b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Kub=C3=AD=C4=8Dek?= Date: Sat, 25 Jan 2025 19:15:42 +0100 Subject: [PATCH] Add pdf helper -> save temporary file to pdf --- superfaktura/utils/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/superfaktura/utils/__init__.py b/superfaktura/utils/__init__.py index e69de29..4d46350 100644 --- a/superfaktura/utils/__init__.py +++ b/superfaktura/utils/__init__.py @@ -0,0 +1,10 @@ +import tempfile +from typing import IO + + +def save_temporary_file_as_pdf( + temp_file: IO[bytes], output_path: str = "output.pdf" +) -> None: + with open(output_path, "wb") as f: + f.write(temp_file.read()) + temp_file.close()