I am redaction a rasterized PDF using coordinates I get from a third party API, but the redaction is not being done on the provided coordinates. Do I have to convert the coordinate to point or do I have to perform any other mathematical conversion for this.
Please share following details and we’ll look into this scenario:
- Sample/problematic and resultant PDF files
- Source code for redaction
- GroupDocs.Redaction for .NET version that you are using in your application
I will share these details shortly.
The coordinate center or (0, 0) point is the top-left corner of the image, and the coordinates increase down and to the right. For instance, the point (100, 200) is located 100 pixels to the right and 200 pixels down from the upper-left corner of the image.
@AlexanderObraztsov Yes that’s what I am doing but I have a document whose width is 626 pixels and I am redacting a point(200,200) that should be 200 pixels from left but when the document is redacted the point is around 50 pixels from left. To make it easier the redacted area is smaller than the values provide, for instance a redaction with point(200,200) and size(200, 200) is much smaller.sample_1.pdf (1.7 MB)
I have also attached the PDF.
Edit: This document is rasterized using groupdocs.
@AlexanderObraztsov Here is the source code.
static void Main(string[] args)
{
RedactDocumentAsync("filepath").GetAwaiter();
}
private static async Task RedactDocumentAsync(string inputFilePath)
{
try
{
//set redaction policy
RedactionPolicy redactionPolicy = new RedactionPolicy(new GroupDocs.Redaction.Redaction[]
{
new ImageAreaRedaction(new System.Drawing.Point(200, 200), new RegionReplacementOptions(System.Drawing.Color.Black, new Size(200 , 200)))
});
Redactor redactor = new Redactor(inputFilePath);
//applying redaction policy
RedactorChangeLog result = redactor.Apply(redactionPolicy);
//saving the document after successful redaction
if (result.Status != RedactionStatus.Failed)
{
redactor.Save();
}
}
catch (Exception)
{
throw;
}
}
@AlexanderObraztsov What’s actually happening is after rasterizing the document with GroupDocs.Redaction the rasterized document’s dpi is changed, is there a way to set dpi while rasterizing in GroupDocs or should I use a third party tool for this.
At this moment we do not have the DPI as an option or setting, but we will consider adding it in one of upcoming releases.