In practical scenarios, such as in electronics, where barcodes on electronic component carriers often wear out, and in logistics, where package labels frequently get damaged, this type of damage makes the recognition of two-dimensional (2D) barcodes challenging. In this study, a new repair method was introduced for quick response (QR) and PDF417 codes. In addition, a structural fusion attention (SFA) mechanism with a recurrent feature reasoning network was integrated to enhance structural integrity and recognition rates. The proposed method significantly outperforms existing inpainting models in terms of accuracy and robustness, which is demonstrated by the custom dataset provided by the authors. Notably, the approach ensures near-perfect recognition rates despite extensive structural impairments. It achieves an accuracy of 98% for large-area PDF417 occlusions and maintains a recognition rate of 100% for QR codes with 75–90% structural damage. These findings highlight the exceptional ability of the proposed method to restore 2D barcodes impaired by diverse levels of structural occlusion.