
    j                     x    d dl mZ d dlZd dlZd dlmZ dgZ	 	 	 ddede	d	e
d
edz  dedeej                 fdZdS )    )AnyN)AbstractFileread_pdf   Tfilescalergb_modepasswordkwargsreturnc                     t          j        | |          }	 fd|D             |                                 S # |                                 w xY w)a$  Read a PDF file and convert it into an image in numpy format

    >>> from doctr.io import read_pdf
    >>> doc = read_pdf("path/to/your/doc.pdf")

    Args:
        file: the path to the PDF file
        scale: rendering scale (1 corresponds to 72dpi)
        rgb_mode: if True, the output will be RGB, otherwise BGR
        password: a password to unlock the document, if encrypted
        **kwargs: additional parameters to :meth:`pypdfium2.PdfPage.render`

    Returns:
        the list of pages decoded as numpy ndarray of shape H x W x C
    )r
   c                 T    g | ]$} |j         dd                                 %S ))r   rev_byteorder )renderto_numpy).0pager   r	   r   s     O/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/doctr/io/pdf.py
<listcomp>zread_pdf.<locals>.<listcomp>)   s?    fffZ^J%xJJ6JJSSUUfff    )pdfiumPdfDocumentclose)r   r   r	   r
   r   pdfs    `` ` r   r   r      s`    . 
TH
5
5
5Cffffffbefff				s	   ? A)r   TN)typingr   numpynp	pypdfium2r   doctr.utils.common_typesr   __all__intboolstrlistndarrayr   r   r   r   <module>r'      s                  1 1 1 1 1 1,
 	 
  Dj	
  
"*     r   