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
Key | Summary | Category |
---|---|---|
REDACTIONNET-551 | The PageAreaFilter for images is not functioning correctly | Bug |
REDACTIONNET-552 | Collected PDF images may have an inappropriate size for further processing | Bug |
REDACTIONNET-557 | Enhance PDF images positioning system | Improvement |
REDACTIONNET-558 | Enhance Presentation images positioning system | Improvement |
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();
};
}