
    iQ                     `    d Z ddlmZ dZ	 ddlZ G d de      Zy# e$ rZeZY dZ[dZ[ww xY w)z>Creates a pdfium backend class to convert a pdf to a png file.    )ConversionBackendNc            	       6    e Zd ZdZdefdZd	dedededdfdZy)
PdfiumBackendz$Classmethod to create PdfiumBackend.returnc                     t         syy)NTF)
PDFIUM_EXC)selfs    R/home/agent/.local/lib/python3.12/site-packages/camelot/backends/pdfium_backend.py	installedzPdfiumBackend.installed   s        pdf_pathpng_path
resolutionNc                     | j                         st        dt              t        j                  |      }|j                          |d   j                  |dz        j                         }|j                  |       y)a,  Convert PDF to png.

        Parameters
        ----------
        pdf_path : str
            Path where to read the pdf file.
        png_path : str
            Path where to save png file.

        Raises
        ------
        OSError
            Raise an error if pdfium is not installed
        zpypdfium2 is not available: r   H   )scaleN)	r   OSErrorr   pdfiumPdfDocument
init_formsrenderto_pilsave)r	   r   r   r   docimages         r
   convertzPdfiumBackend.convert   sh     ~~8GHH  *AJO4;;=

8r   )i,  )	__name__
__module____qualname____doc__boolr   strintr    r   r
   r   r      s2    .4 
 s  d r   r   )	r    camelot.backends.baser   r   	pypdfium2r   ModuleNotFoundErrorer   r$   r   r
   <module>r)      s>    D 3 
% 	  Js    -(-