diff options
-rw-r--r-- | pyblackbird_cc/resources/views.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py index 4df7208..02985e4 100644 --- a/pyblackbird_cc/resources/views.py +++ b/pyblackbird_cc/resources/views.py @@ -153,6 +153,20 @@ def _write_pdf_to_tempdir(f) -> str: def create_metadata(pdf_files) -> Generator[tuple[services.PDFMetadata, str], None, None]: + """ + Generates PDF metadata and snapshot images for a list of PDF files. + + This function takes a list of PDF file objects, creates temporary files for each one, + and then uses the `services.get_pdf_metadata_from_path` and `services.export_pages_as_images` functions to extract metadata and snapshot images for each PDF. + + The function yields a tuple containing the PDF metadata and a list of snapshot image paths for each PDF file. + + Args: + pdf_files (list[django.core.files.uploadedfile.InMemoryUploadedFile]): A list of PDF file objects. + + Yields: + tuple[services.PDFMetadata, list[str]]: A tuple containing the PDF metadata and a list of snapshot image paths for each PDF file. + """ with tempfile.TemporaryDirectory() as temp_dir: for pdf_file in pdf_files: file_path = os.path.join(temp_dir, pdf_file.name) |