@@ -782,7 +782,7 @@ private List<PdfiumRedactionRegion> buildPdfiumRegions(
782782
783783 // Log detailed information about the text block
784784 log .debug (
785- "⚠️ REDACT PROCESSING: Page {} (0-indexed={}), text='{}' | RAW COORDINATES from PDFText: x1={}, y1={}, x2={}, y2={} | COMPUTED: width={}, height={} | FONT: size={} | PAGE BOUNDS (cropBox): minX={}, minY={}, maxX={}, maxY={}" ,
785+ "REDACT PROCESSING: Page {} (0-indexed={}), text='{}' | RAW COORDINATES from PDFText: x1={}, y1={}, x2={}, y2={} | COMPUTED: width={}, height={} | FONT: size={} | PAGE BOUNDS (cropBox): minX={}, minY={}, maxX={}, maxY={}" ,
786786 pageIndex + 1 ,
787787 pageIndex ,
788788 block .getText (),
@@ -806,19 +806,6 @@ private List<PdfiumRedactionRegion> buildPdfiumRegions(
806806 height );
807807 continue ;
808808 }
809-
810- // Calculate actual text bounds - ensure we cover the full text height
811- // In PDFBox coordinates: Y1 is bottom (minY), Y2 is top (maxY)
812- // CRITICAL: block.getY1() should be the BOTTOM of the text (minY)
813- // block.getY2() should be the TOP of the text (maxY)
814- // Update: TextFinder returns tight bounds around glyphs. If the text is all
815- // lowercase (x-height), height might be smaller than fontSize.
816- // To guarantee removal by PDFium, we should cover the full font height.
817-
818- // Use the same padding logic as redactFoundText (Visual Redaction)
819- // This ensures PDFium attempts to remove the text in the exact same area where the
820- // black box will be drawn.
821-
822809 float padding = resolvePdfiumVerticalPadding (block , customPadding );
823810 float horizontalPadding = resolvePdfiumHorizontalPadding (block , customPadding );
824811
@@ -831,7 +818,7 @@ private List<PdfiumRedactionRegion> buildPdfiumRegions(
831818 float finalHeight = height + (2 * padding );
832819
833820 log .debug (
834- "📐 CALCULATION (Synced): textBottom={} textTop={} height={} | Padding: {} | Final Box: origin=({}, {}) size=({}, {})" ,
821+ "CALCULATION (Synced): textBottom={} textTop={} height={} | Padding: {} | Final Box: origin=({}, {}) size=({}, {})" ,
835822 block .getY1 (),
836823 block .getY2 (),
837824 height ,
@@ -842,7 +829,6 @@ private List<PdfiumRedactionRegion> buildPdfiumRegions(
842829 finalHeight );
843830
844831 // Validation and clamping
845-
846832 if (originX < minX ) {
847833 float adjustment = minX - originX ;
848834 originX = minX ;
@@ -897,7 +883,7 @@ private List<PdfiumRedactionRegion> buildPdfiumRegions(
897883 adjustedRect .height );
898884 regions .add (region );
899885 log .debug (
900- "✓ Created PDFium region #{}: page={} text='{}' | FINAL: origin=({}, {}) size=({}, {}) | Coverage: x[{} to {}] y[{} to {}]" ,
886+ "Created PDFium region #{}: page={} text='{}' | FINAL: origin=({}, {}) size=({}, {}) | Coverage: x[{} to {}] y[{} to {}]" ,
901887 regions .size (),
902888 pageIndex + 1 ,
903889 block .getText (),
0 commit comments