Inconsistent coordinate handling in image and text insertion

Hello,
we are processing PDF documents using the Aspose.PDF DLL version 19.2.0.0 (the newest version). We have a document whose coordinates of the lower left corner of the page are different from (0, 0). This broke our text insertion code, but is easily remedied by taking into account the actual coordinates of the lower left corner of Page.Rect. The problem arises when we want to handle image insertion the same way - it appears that the coordinate correction is already performed by your code in case of images. This is a major inconsistency between image and text insertion. We are attaching an SSCCE demonstrating the issue. Due to the attachment size constraint on your forum, we cannot include the Aspose.PDF.dll file in the project. Code sample below.

using (var document = new Document(args[0]))
                {
                    using (var image = new MemoryStream())
                    {
                        var bitmap = new Bitmap(32, 32);
                        Graphics.FromImage(bitmap).FillRectangle(Brushes.Red, 0, 0, bitmap.Width, 10);
                        Graphics.FromImage(bitmap).FillRectangle(Brushes.Yellow, 0, 11, bitmap.Width, 10);
                        Graphics.FromImage(bitmap).FillRectangle(Brushes.Green, 0, 22, bitmap.Width, 10);
                        bitmap.Save(image, ImageFormat.Bmp);

                        //if we take into account the coordinates of the left lower corner of the page, text insertion works as intended but image insertion breaks
                        //document.Pages[1].AddImage(image, new Rectangle(page.Rect.LLX + 10,page.Rect.LLX + 10, page.Rect.LLY + 42, page.Rect.LLY + 42));

                        document.Pages[1].AddImage(image, new Rectangle(10, 10, 42, 42));

                        var page = document.Pages[1];
                        var textBuilder = new TextBuilder(page);
                        var textParagraph = new TextParagraph();
                        var textFragment = new TextFragment("sample text");
                        textFragment.TextState.Font = FontRepository.OpenFont(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "tahoma.ttf"));
                        textFragment.TextState.ForegroundColor = Color.Blue;
                        textFragment.TextState.FontSize = 6f;
                        textParagraph.AppendLine(textFragment);

                        //if we take into account the coordinates of the left lower corner of the page, text insertion works as intended but image insertion breaks
                        //textParagraph.Rectangle = new Rectangle(page.Rect.LLX + 10,page.Rect.LLX + 10, page.Rect.LLY + 100, page.Rect.LLY + 100);

                        textParagraph.Rectangle = new Rectangle(10, 10, 100, 100);

                        textBuilder.AppendParagraph(textParagraph);

                        using (var saveStream = new MemoryStream())
                        {
                            document.Save(saveStream);
                            File.WriteAllBytes(args[0] + "_out.pdf", saveStream.ToArray());
                        }
                    }
                }

Best regards,
WEBCON Sp. z o.o.

PDFTextInsertSSCCE2.zip (588.0 KB)

@abruks

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46070 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi there
Any update?

@abruks

Thank you for getting back to us.

We are afraid PDFNET-46070 is still pending for investigations. However, we have recorded your concerns and will let you know as soon as any further update will be available.