.Cropbox Applying Coordinates Incorrectly

We have been using the cropbox property of pages to crop a PDF page to a given set of coordinates. This has worked well with in our code and all versions of Aspose PDF.net for about 5 years. A recent set of PDF examples does not work with our code as expected. The cropped areas should be small rectangles that are wider than they are tall (a larger difference in the X coordinates than in the Y). But for some reason we are getting tall and thin crops as a result. Testing the same coordinates and code on other PDFs gives the expected results.

We are using the most up-to-date version of Aspose PDF.net. Here is a code snippet:

            Dim pdfDocument As New Document(filepathPDF)
            Dim pageRect = New Aspose.Pdf.Rectangle(LLX, LLY, URX, URY)
            pdfDocument.Pages(1).CropBox = pageRect
            pdfDocument.Save(filepathPDF_Cropped)

I have attached the sample file to this post.

SR1 Printed.pdf (831.1 KB)

Thank you

@instaknow

Can you please share complete code snippet with the values that you are assigning to the Rectangle? We will test the scenario in our environment and address it accordingly.

Sure:

            Dim pdfDocument As New Document(filepathPDF)
            Dim pageRect = New Aspose.Pdf.Rectangle(376.3, 564.9, 525.5, 573.7)
            pdfDocument.Pages(1).CropBox = pageRect
            pdfDocument.Save(filepathPDF_Cropped)

@instaknow

Would you kindly share an expected output PDF as well for our reference? We were able to reproduce the issue in our environment. We will proceed with logging it in our environment if you can please provide an expected output PDF as well. We are sorry for the inconvenience.

Thank you for your help, we appreciate your assistance with this.

I attached a PDF that shows how we would like to crop the full PDF. To get this, I experimented with the coordinates until I located the right spot manually. The coordinates I had to use were 48.7, 376.3, 39.9, 525.5

SR1 Printed - correct crop.pdf (659.6 KB)

Let me know if you need any additional information and I will happily provide it.

Thanks

@instaknow

An issue as PDFNET-53250 has been logged in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.