GroupDocs.Redaction for .NET 24.10 Release Notes

Major Features

There are the following improvements in this release:

  • Revised the page position calculation for images in PDFs and Presentations, and fixed related bugs.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
REDACTIONNET-551The PageAreaFilter for images is not functioning correctlyBug
REDACTIONNET-552Collected PDF images may have an inappropriate size for further processingBug
REDACTIONNET-557Enhance PDF images positioning systemImprovement
REDACTIONNET-558Enhance Presentation images positioning systemImprovement

Public API and Backward Incompatible Changes

Public API changes

No changes in public API.

Usage

The primary goal of image positioning is to calculate where each image is located on the page and how it should be processed. Often, an image’s actual dimensions differ from its visible size on the page. For example, an image with dimensions of 300x300 px might be scaled down to fit within a 100x100 px shape. To prevent miscalculations in such cases, we’ve enhanced the image positioning system. This enhancement may impact older code, as image redactions could be misaligned after reprocessing. Now, all coordinates are based on the page size, so if an image’s actual size differs from its container, it will be treated as if it has the same size as the containing shape.

C#


// This example demonstrates how to hide part of an image by overlaying a red square.
// You can limit the number of pages and select specific areas on a page to process using filters.
// If any suitable images are found on the page, they are painted red in the specified areas, constrained by the filter area.

            using (Redactor redactor = new Redactor("Sample.pptx"))
            {
                Regex rx = new Regex("urna");
                ReplacementOptions optionsText = new ReplacementOptions("[redarea]");
                optionsText.Filters = new RedactionFilter[] {
                    new PageRangeFilter(PageSeekOrigin.End, 0, 1), // last slide
                    new PageAreaFilter(new System.Drawing.Point(0, 0), new System.Drawing.Size(300, 100)) 
                };
                RegionReplacementOptions optionsImg = new RegionReplacementOptions(System.Drawing.Color.Red, new System.Drawing.Size(100, 300));
                // Redacted area will be an intersection, which is 100x100
                RedactorChangeLog result = redactor.Apply(new PageAreaRedaction(rx, optionsText, optionsImg));
                if (result.Status != RedactionStatus.Failed)
                {
                    redactor.Save();
                };
            }