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

Free Support Forum - aspose.com

What is llx- lly - yrx and ury

What is llx, lly , yrx and ury in rectangle coordinates. When i passed llx as x-axis value, lly as y-axis, urx as width, ury as height. For example am passing 887, 515, 106, 446 in a pdf but it is cropping some other zone.

Please confirm about this

Hi there,

Thanks for your inquiry. Please note Aspose.Pdf page origin is left bottom(0,0), so you need to to reset the article coordinates as following. Moreover, please note Aspose.Pdf measuring unit is point and where 1 inch = 72 points and 1 cm = 1/2.54 inch = 0.3937 inch = 28.3 points.

llx(lower left x coordinate)=margin from left.
lly(lower left y coordinate)=margin from bottom(bottom of rectangle)
urx(upper right x coordinate)=width of article
ury(upper right y coordinate)=margin from bottom of upper boundary of article.

Rectangle Coordinates for your required image will be as following. Hopefully it will help you to accomplish the task.

Document document = new Document(myDir + “CNI_1958_01_01_FE_01_MN.pdf”);<o:p></o:p>

com.aspose.pdf.Rectangle rect = document.getPages().get_Item(1).getRect();

com.aspose.pdf.Rectangle pageRect = new com.aspose.pdf.Rectangle(889.92, 927.36, 990, 1065);


document.save(myDir + "crop_java.pdf");

Hopefully it would help you to understand the rectangle coordinates.

Best Regards,

can you provide the calculation formula

how can you convert x , y with and height into required parameter

like 887, 515, 106, 446 into 889.92, 927.36, 990, 1065 please provide the Calculation formula i am unable to identify it
Hi Chintan,

Thanks for your inquiry. As shared in your other related query, please note Aspose.Pdf page origin is left bottom(0,0). So rectangle coordinates of page will be x=0,y=0,urx=page width and ury= page height.

For example if you have X,Y,width and height values of a rectangle. And X and Y values are top left coordinates of your rectangle, then you can convert these values to Aspose.Pdf Rectangle parameters as following. However if still there is any confusion then please share some further details and your sample PDF document, so we will look into it and guide you accordingly.


Best Regards,

Old but always needed for many I guess :slight_smile:

In fact your answer was not 100% correct imho. Here is my code that solves the requirements to give x,y, width and height based on the idea that 0,0 for x,y is top-left of a document.

  private readonly float _mm2Pt = Convert.ToSingle(0.352777778);
  var pdfDocument = new Document(fs);

  var currentPage = pdfDocument.Pages[pageNumber];
  var pHeight = currentPage.Rect.Height;
  var bX = (x / _mm2Pt);
  var bY = pHeight - (y / _mm2Pt) - (h / _mm2Pt);
  var bW = bX + (w / _mm2Pt);
  var bH = bY + (h / _mm2Pt);

  var appearance = new DefaultAppearance(font, fontSize, System.Drawing.Color.FromName(fontColor));
  var rectangle = new Rectangle(bX, bY, bW, bH);

And btw, I made x,y,w,h values given in mm, easier for me as euro…


Thanks for sharing these details.

It is good to know that you have managed to get the desired results. Your shared code snippet would definitely help others facing similar issue. Please keep using our API and in case of any further assistance, please feel free to let us know.