php - y axis inversion on pdfTron

one text

I got a problem with usage of PDFTron on the back-end ( PHP ) vs frontend.

I have a front end that allow user to define formFields emplacement. When Field is set, we call backend to put them in database and when the document is validated by user, we launch a treatment on back-end to field the pdf binary with the formField.

We do something like that :

// Open PDF file with PDFTron
        $doc = new \PDFDoc($temporaryFileName);
        $doc->InitSecurityHandler();

        // get first page by default
        $page = $doc->getPage(1);

        $rect = new \Rect($x1FromFront, $y1FromFront, $x2FromFront, $y2FromFront);

        // Create a new signature field
        $widgetAnnot = \SignatureWidget::Create($doc, $rect, 'Ressource_Stamp');
        $page->AnnotPushBack($widgetAnnot);

        // save documents
        $doc->Save($temporaryFileName, \SDFDoc::e_linearized);
        $doc->Close();

But we have a problem, indeed, the y axis on front seems to be not on same order than back-end axis.

If I have "75" for the y1 value on front, the field is displayed on top, But when I apply the signWidget with backend with "75" for y1, the field is displayed has bottom.

It seems that the 0,0 of axys is "top-left" in front and "top-bottom" on back-end:

Annotation Rect on front : https://www.pdftron.com/api/web/Core.Annotations.Annotation.html#getRect : https://www.pdftron.com/api/web/Core.Math.Rect.html ==> Upper-left

Rect on BackEnd : https://www.pdftron.com/api/web/Core.PDFNet.Rect.html#main ==> lower-left.

Is there a way to inverse the y axis to get always same coordinate between front and PHP ? Or do we need to compute the y value from the page Height ?

Source