Free Support Forum -

CalculateContentBBox doubt

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)

            // get the content boundaries
            Aspose.Pdf.Page mypage = pdfDocument.Pages[pageCount];

            Aspose.Pdf.Rectangle contentBBox = mypage.CalculateContentBBox();

In the first page of the input file, CalculateContentBBox.URX seems way too big.Is that a problem?
input.pdf (541.1 KB)


The value of CalculateContentBBox.URX is equal to the width of the page and it does not seem any issue. Please let us know in case you have further concerns.

Please run the sample file, and you’ll see the problem.
Results show that :

mypage.Rect.URX: 595.32
contentBBox.URX: 5483139

contentBBox.URX is far more larger than Rect.URX. So what’s wrong with the pdf page or aspose?

BTW,the pdf file sample is made by word native pdf converter.


We were now able to reproduce the behavior of the API. Earlier, we assigned the value to Page CropBox by following and the resultant URX was fine:

document.Pages[1].CropBox = document.Pages[1].CalculateContentBBox(); 

However, while testing using the below code snippet, we were able to notice the different values as result.

Aspose.Pdf.Document document = new Aspose.Pdf.Document(dataDir + "input.pdf");
var curx = document.Pages[1].CalculateContentBBox().URX;
var rurx = document.Pages[1].Rect.URX;

Therefore, we have logged an investigation ticket as PDFNET-49468 in our issue tracking system. We will further look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.