
    TAi]                    b    S r SSKJr  SSKrSSKJrJrJrJr  \R                  " \
5      rSS jrg)z OCRmyPDF PDF annotation cleanup.    )annotationsN)
DictionaryNameNameTreePdfc           	        Sn[         R                  U R                  ;  a  U$ [         R                  U R                  [         R                     ;  a  U$ U R                  [         R                     [         R                     n[	        U[
        5      (       d  U$ [        U5      n[        S UR                  5        5       5      n[        U R                  5       H  u  pV[         R                  U;  a  M  U[         R                      H  n[	        U[
        5      (       d  M  [         R                  U;  d%  [         R                  U[         R                     ;  a  MU  [        U[         R                     [         R                     5      nX;  d  M  [        R!                  SUS-    SU S35        U[         R                     [         R                  	 SnM     GM     U$ )aS  Remove broken goto annotations from a PDF.

If a PDF contains a GoTo Action that points to a named destination that does not
exist, Ghostscript PDF/A conversion will fail. In any event, a named destination
that is not defined is not useful.

Args:
    pdf: Opened PDF file.

Returns:
    bool: True if the file was modified, False if not.
Fc              3  $   #    U  H  ov   M     g 7f)N ).0ks     L/var/www/html/land-ocr/venv/lib/python3.13/site-packages/ocrmypdf/_annots.py	<genexpr>1remove_broken_goto_annotations.<locals>.<genexpr>*   s     +?a?s   z)Disabling a hyperlink annotation on page    z% to a non-existent named destination .T)r   NamesRootDests
isinstancer   r   setkeys	enumeratepagesAnnotsADstrlogwarning)	pdfmodifieddestsnametreenamesnpageannotnamed_destinations	            r   remove_broken_goto_annotationsr)      se    H zz!zz$**--HHTZZ ,EeZ((H +8==?++ESYY';;d"$++&EeZ00vvU"dffE$&&M&A #E$&&M$&&$9 : - ?Aw G6(),
 $&&M$&&)# ' (, O    )r    r   returnbool)__doc__
__future__r   loggingpikepdfr   r   r   r   	getLogger__name__r   r)   r
   r*   r   <module>r3      s+    ' "  3 3!3r*   