slidedeckai.helpers.file_manager#


File manager to help with uploaded PDF files.

get_pdf_contents

Extract the text contents from a PDF file.

validate_page_range

Validate the page range for the uploaded PDF file.

File manager to help with uploaded PDF files.

slidedeckai.helpers.file_manager.get_pdf_contents(pdf_file: UploadedFile, page_range: tuple[int, None] | tuple[int, int]) str[source]#

Extract the text contents from a PDF file.

Parameters:
  • pdf_file – The uploaded PDF file.

  • page_range – The range of pages to extract contents from.

Returns:

The contents.

slidedeckai.helpers.file_manager.validate_page_range(pdf_file: UploadedFile, start: int, end: int) tuple[int, None] | tuple[int, int][source]#

Validate the page range for the uploaded PDF file. Adjusts start and end to be within the valid range of pages in the PDF.

Parameters:
  • pdf_file – The uploaded PDF file.

  • start – The start page

  • end – The end page

Returns:

The validated page range tuple