
    Mg                         S SK r S SKJrJrJr  \" \S/S9\" S5       " S S5      5       5       r\" \S/S9\" S5       " S S	5      5       5       r\" \S/S
S9\" S5       " S S5      5       5       rg)    N)pluginrequireLINUXwkhtmltopdf)platformnative	htmltopdfc                       \ rS rSrSrS rSrg)r	      z0Convert your html file or web page into pdf filec                 &    UR                  S5        g )NzQWelcome to the htmltopdf convertor! 
Type 'help htmltopdf' to learn how to use it)say)selfjarvisss      ?/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/htmltopdf.py__call__htmltopdf.__call__
   s    

gh     N__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r   r   r   r	   r	      s     ;ir   zhtmltopdf filec                       \ rS rSrSrS rSrg)htmltopdf_file   z
Transform your html file into a pdf file in the Jarvis source directory.
Type your url as the following:
'htmltopdf example.html'
The output file will be the following:
'example.pdf'
Your html file must be in the jarvis source directory
c                 .   U(       d  UR                  S5        g SU;  a  UR                  S5        g  [        R                  " X"R                  SS5      S-   5        g ! [         a-  nUR                  SR                  U5      S-   5         S nAg S nAff = f)	Nz1please enter a file name after calling the pluginhtmlzYour file must end with '.html'z.html .pdfzOS error: {0}zL
Make sur your file is in the source directory of Jarvis and is an html file)r   pdfkit	from_filereplaceOSErrorformatr   r   r   errs       r   r   htmltopdf_file.__call__   s    JJJK1_JJ89J  IIgr$:V$CD J

?11#6  :I  I  J  JJs   )A 
B'#BBr   Nr   r   r   r   r   r      s    	Jr   r   T)r   r   networkzhtmltopdf urlc                       \ rS rSrSrS rSrg)htmltopdf_url&   z
Transform your url page into a pdf file in the Jarvis source directory. type your url as the following:
'htmltopdf google.com'
The output file will be the following:
'google.com.pdf'
c                    U(       d  UR                  S5        g SU;  a  UR                  S5        g  [        R                  " X"S-   5        g ! [         a-  nUR                  SR	                  U5      S-   5         S nAg S nAff = f)Nz,please enter an url after calling the plugin.z!please make sur your url is validr#   zIO error: {0}zE
Make sure your URL is valid and that you have access to the internet)r   r$   from_urlIOErrorr(   r)   s       r   r   htmltopdf_url.__call__0   sz    JJEF\JJ:;Cv:. C

?11#6  :B  B  C  CCs   A 
B#A??Br   Nr   r   r   r   r.   r.   &   s    	Cr   r.   )r$   r   r   r   r	   r   r.   r   r   r   <module>r5      s     ) ) 	%0i i  1i 	%0J J  1J, 	%>C C  ?Cr   