We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue of orientation of RedactionAnnotation on Landscape page

I am evaluating Aspose.Pdf product for my company. Requirement was to overlay text at specific location on page. I end up using RedactionAnnotation. But now when code is in dev environment and we are progressing to finalize the use of Aspose.Pdf. I came across with orientation problem on Landscape page. Attached is the sample. Note:- Pdf is in sample file is random pdf from the internet. Pdf is in landscape page orientation.
I will appreciate any help. Thanks

string sourceFile = "landscape.pdf";
            string outputFile = System.IO.Path.GetRandomFileName() + ".pdf";
    var lines = 5;
            var lineWidth = 80;
            var lineSpacing = 15; ;
            var x = 42;
            var y = 80;
            var width = 350;
            var yy = y + lineSpacing;
            Document pdfDocument = new Document(sourceFile);
            List<string> lineList = new List<string>();
            lineList.Add("This is the replacement of text under Graduate Program Title. ");
            lineList.Add("");
            lineList.Add("This is the replacement of text under Graduate Program Title. ");
            lineList.Add("This is the replacement of text under Graduate Program Title. ");
            lineList.Add("This is the replacement of text under Graduate Program Title.  ");
            lineList.Add("This is the replacement of text under Graduate Program Title.  ");
            lineList.Add("This is the replacement of text under Graduate Program Title.  ");

            RedactionAnnotation annot = null;
            for (int i = 0; i < lineList.Count & i < lines; i++)
            {
                annot = new RedactionAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(x, y, width, yy));
                annot.FillColor = Aspose.Pdf.Color.Yellow;
                annot.BorderColor = Aspose.Pdf.Color.Black;
                annot.Color = Aspose.Pdf.Color.Black;
                annot.OverlayText = lineList[i];
                annot.RichText = "What is the richtext";
                annot.TextAlignment = Aspose.Pdf.HorizontalAlignment.Justify;
                annot.Repeat = false;
                pdfDocument.Pages[1].Annotations.Add(annot);
                annot.Redact();
                y = y + lineSpacing;
                yy = yy + lineSpacing;
            }
            pdfDocument.Save(outputFile);

source file is also attached.

lsq01al2.uca.pdf (147.3 KB)original_issue.pdf (110.7 KB)

@jango

Can you please share this input file and the values of x,y,width, and yy variables so that we may try to reproduce the same on our end.

@mudassir.fayyaz Hi, I have updated the above code. Sample Source file is also attached.Earliest help would be much appreciated. Thanks.

@jango

I have been able to reproduce the issue on our end. A ticket with ID PDFNET-50013 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.