+
    Ti)                     ^   ^ RI t ^ RIHtHt ^ RIHt ^ RIHtHt ^ RI	t
^ RIt] P                  ! 4       t]P                  4       ] P                  ! RRR7      ] P                  ! RRR7      ] P                   ! RR	R7      ] P                   ! R
RR7      ] P                   ! RRR7      ] P                   ! RRR7      ] P                   ! R
RR7      3R R ll4       t]P                  4       ] P                  ! RRR7      ] P                  ! RRR7      ] P                  ! RRR7      ] P                   ! RRR7      ] P                   ! RRR7      ] P                   ! RRR7      ] P                   ! RRR7      ] P                   ! R
RR7      3R R ll4       t]P                  4       R 4       t]R8X  d
   ]! 4        R# R# )    N)ListOptional)Path)	pdf_utilsai_utils.zPath to the PDF file)helpz>Pairs of 'PageNumber Prompt' (e.g. 1 'Fix typo' 2 'Make blue')zAComma-separated list of extra reference page numbers (e.g. '5,6')Fz8Include full PDF text as context (can confuse the model)z?Output path for the edited PDF. Defaults to 'edited_<filename>'4KzGImage resolution: '4K', '2K', '1K' (higher = better quality but slower)z*Disable Google Search (enabled by default)c                    V ^8  d   QhR\         R\        \         ,          R\        \         ,          R\        R\        \         ,          R\         R\        /# )   pdf_pathedits
style_refsuse_contextoutput
resolutiondisable_google_search)strr   r   bool)formats   "X/home/kuhnn/.local/share/uv/tools/nano-pdf/lib/python3.14/site-packages/nano_pdf/main.py__annotate__r      sc     S+ S+S+9S+ S+ 	S+
 SMS+ S+  S+    c                  aaaaa  \         P                  ! 4        \        T 4      oSP                  4       '       g2   \        P                  ! RT  R24       \        P
                  ! ^R7      hT'       g   RSP                   2p\        T4      ^,          ^ 8w  d.   \        P                  ! R4       \        P
                  ! ^R7      h/ p\        ^ \        T4      ^4       FG  p	 \        Y,          4      p
Y^,           ,          pY9   d   Y;;,          RT 2,          uu&   KC  YT
&   KI  	  \        TP                  4       4      p\         P                  ! \!        S4      4      pT UUu. uF  w  rT^8  g	   Y8  g   K  TNK  	  pppT'       d5   \        P                  ! RT RT R24       \        P
                  ! ^R7      h\        P                  ! RT  R\        T4       R24       RoT'       dU   \        P                  ! R4       \         P"                  ! \!        S4      4      oS'       g   \        P                  ! R4       M\        P                  ! R4       \        P                  ! R4       . oT'       db   TP%                  R4       FL  p \        TP'                  4       4      p
SP)                  \         P*                  ! \!        S4      T
4      4       KN  	  / p. pR TTTTT3R llp\        P                  ! R\        T4       R24       ^ p\.        P0                  P3                  ^
R7      ;_uu_ 4       pT UUu. uF  w  rTP5                  TY4      NK  	  ppp\.        P0                  P7                  T4       Fe  pTP9                  4       pT'       d   Tw  p
pTTT
&   TP)                  T4       T^,          p\        P                  ! RT R\        T4       R 24       Kg  	  RRR4       T'       g.   \        P                  ! R!4       \        P
                  ! ^R7      h\        P                  ! R"\        T4       R#24        \         P:                  ! \!        S4      TT4        T F=  p\        T4      P                  4       '       g   K$  \        T4      P=                  4        K?  	  \        P                  ! R%T 24       R#   \         d6   p\        P                  ! RT 24       \        P
                  ! ^R7      hRp?ii ; i  \         d9    \        P                  ! R	Y,           R
24       \        P
                  ! ^R7      hi ; iu uppi   \         d     \        P                  ! RT R
24        EK  \,         d)   p\        P                  ! RT RT 24        Rp?EK"  Rp?ii ; iu uppi   + '       g   i     EL; i  \,         d6   p\        P                  ! R$T 24       \        P
                  ! ^R7      hRp?ii ; i  T F=  p\        T4      P                  4       '       g   K$  \        T4      P=                  4        K?  	  i ; i)&z{
Edit a PDF page using Nano Banana (Gemini 3 Pro Image).
Usage: python -m src.main edit deck.pdf 1 "prompt A" 2 "prompt B"
Error: codeNError: File  not found.edited_z2Error: Edits must be pairs of 'PageNumber Prompt'.z

ALSO: zError: Invalid page number ''zError: Invalid page number(s) z
. PDF has z pages.zProcessing z with z	 edits... Extracting text context...BWarning: Could not extract text from PDF. Context will be limited.z6Skipping text context (use --use-context to enable)...zRendering reference images...,Warning: Invalid style ref 'Warning: Could not render Page : c                0    V ^8  d   QhR\         R\        /# )r   page_numprompt_text)intr   )r   s   "r   r   edit.<locals>.__annotate__c   s      c  r   c           	        < \         P                  ! R V  R24        \        P                  ! \	        S	4      V 4      p\
        P                  ! VSSVS
S'       * R7      p\        P                  ! RRRR7      pVP                  pVP                  4        \        P                  ! W54       \         P                  ! RV  24       W3#   \         d(   p\         P                  ! RT  R	T 24        R
p?R
# R
p?ii ; i)zStarting Page ...)target_imagestyle_reference_imagesfull_text_contextuser_promptr   enable_searchwb.pdfFmodesuffixdeletezFinished Page zError processing Page r'   N)typerechor   render_page_as_imager   r   generate_edited_slidetempfileNamedTemporaryFilenamecloserehydrate_image_to_pdf	Exception)r)   r*   r/   generated_imagetemp_pdf_filetemp_pdfer   	full_text
input_pathr   style_imagess   &&     r   process_single_page!edit.<locals>.process_single_pagec   s    

^H:S12	$99#j/8TL '<<)'3"+'%"77O %77T&Y^_M$))H!,,_GJJz23'' 	JJ/zA3?@	s   B'C C7C22C7z pages in parallel...)max_workersz
Progress: /z pages completedz%No pages were successfully processed.z
Stitching z pages into final PDF...zError stitching PDF: zDone! Saved to )r   check_system_dependenciesRuntimeErrorr:   r;   Exitr   existsr@   lenranger+   
ValueErrorlistitemsget_page_countr   extract_full_textsplitstripappendr<   rC   
concurrentfuturesThreadPoolExecutorsubmitas_completedresultbatch_replace_pagesunlink)r   r   r   r   r   r   r   rG   edits_by_pageip_numpromptparsed_editstotal_pagesp_invalid_pagesref_pagereplacements
temp_filesrK   completed_countexecutorr^   futurerb   rF   frH   rI   rJ   s   &&&&&ff                     @@@r   editru   
   s   !++-
 hJ

\(;78jja  :??+, 5zA~

GHjja   M1c%j!$
	%MEQ3ZF%$*VH(==$'-e$ % ++-.L **3z?;K#/L<411q5AOQQ<ML

3M?*[MY`abjja  	JJXJfS->,?yIJ I

/0//J@	JJ[\

KL 
JJ./L "((-HNHNN,-##I$B$B3z?TY$Z[ . LJ 6 
JJS.//DEFO				.	.2	.	>	>(T`aT`yq8??#6BT`a ((55g>F]]_F"(x&.U#!!(+q OJJO#4Ac,6G5HHXYZ ? 
? 

:;jja   
JJc,/00HIJ	!%%c*o|VL AAw~~Q   
JJ)*G  !

WQC=!jja  !8  	%JJ5ehZqAB**!$$	% M6  G

9(1EFF N

<XJbLMMNL b 
?	>	>(  !

*1#./jja  !
 AAw~~Q  s   S %=T$T)U?UAU=V?V9
 BV?!W T0TTAU%V6V6V6V11V69V??W	X0XXX "Y=Yz/Insert after this page number (0 for beginning)z&Description of the new slide to createz^Comma-separated list of reference page numbers for style (e.g. '1,2'). Defaults to first page.TzQInclude full PDF text as context (enabled by default for better slide generation)z8Output path for the PDF. Defaults to 'edited_<filename>'c                    V ^8  d   QhR\         R\        R\         R\        \         ,          R\        R\        \         ,          R\         R\        /# )	r   r   
after_pagerh   r   r   r   r   r   )r   r+   r   r   )r   s   "r   r   r      st     gT gTgTgT gT 	gT
 gT SMgT gT  gTr   c                
    \         P                  ! 4        \        T 4      p	T	P                  4       '       g2   \        P                  ! RT  R24       \        P
                  ! ^R7      hT'       g   RT	P                   2p\         P                  ! \        T	4      4      p
T^ 8  g   Y8  d2   \        P                  ! RT
 R24       \        P
                  ! ^R7      h\        P                  ! R	T  R
T R24       RpT'       dT   \        P                  ! R4       \         P                  ! \        T	4      4      pT'       g   \        P                  ! R4       \        P                  ! R4       . pT'       d   TP                  R4       Fu  p \        TP                  4       4      pT^8  g   Y8  d   \        P                  ! RT R24       KF  TP                  \         P                   ! \        T	4      T4      4       Kw  	  MF\        P                  ! R4        TP                  \         P                   ! \        T	4      ^4      4       \        P                  ! R4        \&        P(                  ! TTTTT'       * R7      p\        P                  ! R4       \*        P,                  ! RRRR 7      pTP                  pTP/                  4         \         P0                  ! TT4       \        P                  ! R!4       \         P2                  ! \        T	4      TY4        \        T4      P                  4       '       d   \        T4      P5                  4        \        P                  ! R#T R$T 24       R#   \         d6   p\        P                  ! RT 24       \        P
                  ! ^R7      hRp?ii ; i  \"         d     \        P                  ! RT R24        EKT  \$         d)   p\        P                  ! RT RT 24        Rp?EK  Rp?ii ; i  \$         d%   p\        P                  ! RT 24        Rp?ELRp?ii ; i  \$         d6   p\        P                  ! RT 24       \        P
                  ! ^R7      hRp?ii ; i  \$         d6   p\        P                  ! R"T 24       \        P
                  ! ^R7      hRp?ii ; i  \        T4      P                  4       '       d   \        T4      P5                  4        i i ; i)%zx
Add a new slide to a PDF using AI generation.
Usage: nano-pdf add deck.pdf 0 "Title slide with 'Welcome to Q3 Review'"
r   r   Nr   r   r   z(Error: after_page must be between 0 and z#. Use 0 to insert at the beginning.zAdding new slide to z after page r.   r!   r"   r#   z#Rendering style reference images...r$   zWarning: Style ref page z out of range, skippingr%   r    r&   r'   z*Using page 1 as default style reference...z"Warning: Could not render Page 1: zGenerating new slide with AI...)r0   r2   r1   r   r3   zError generating slide: z$Converting to PDF with text layer...r4   r5   Fr6   zInserting slide into PDF...zError creating PDF: z!Done! New slide added after page z. Saved to )r   rO   rP   r:   r;   rQ   r   rR   r@   rX   r   rY   rZ   r+   r[   r\   r<   rU   rC   r   generate_new_slider>   r?   rA   rB   insert_pagerd   )r   rw   rh   r   r   r   r   r   rG   rI   rj   rH   rJ   rn   rg   rD   rE   rF   s   &&&&&&&&          r   addr{      s    !++-
 hJ

\(;78jja  :??+, **3z?;KA~1

=k]Jmnojja  	JJ%hZ|J<sKL I

/0//J@	JJ[\ 
JJ45L"((-H	NHNN,-19 3JJ!9%@WXY##I$B$B3z?TY$Z[ . 	

?@	A	 > >s:PQ RS
 
JJ01
!"55#/'!33
 
JJ56//T&QVWM!!H$(((C 	

01c*oxL >  ""N!!#	JJ2:,k&RSm  !

WQC=!jja  !P  G

9(1EFF N

<XJbLMMN  	AJJ;A3?@@	A  !

-aS12jja  !   !

)!-.jja  !
 >  ""N!!# #s   M0 A N3/N3/P  Q AR 0N0;0N++N03%PP%P&P		PQ P;;Q R0Q>>RS0SSS	 	;Tc                 2    \         P                  ! R4       R# )z
Show version.
zNano PDF v0.2.1N)r:   r;    r   r   versionr~   
  s    
 
JJ !r   __main__)r:   typingr   r   pathlibr   nano_pdfr   r   concurrent.futuresr]   r>   TyperappcommandArgumentOptionru   r{   r~   __name__r}   r   r   <module>r      sw    !  (  kkmNN3-CD~~c0pq %T8{ |U1kl!LL4uvll4.wx"',,u;g"hS+ S+j NN3-CDnnS/`a..+ST %T  9Y  !ZT  1D  E!LL4noll4.wx"',,u;g"hgT gTR " " zE r   