Home > Back-end >  Rect not being drawn on Android PdfDocument canvas
Rect not being drawn on Android PdfDocument canvas

Time:03-15

I just switched from using iText to the native android PdfDocument, due to lack of documentation of Debugger

However, an usual behavior occurs - either only one rectangle is being drawn, or the rectangles are overlapping each other exactly, despite having different coordinates.

Because if I attempt to only draw the right rectangle, it still appears on the left side in the document, with the exact proportions of the left rectangle, as seen in the image below.

Pdf screenshot

CodePudding user response:

It was a stupid mistake. The documentation for RectF clearly states that left <= right and top <= bottom. The debugger clearly shows that the right cell has a left value that is > right.

I replaced pageMargin with width.toFloat() - pageMargin in the right cell, which solved the issue.

  • Related