From c82f6e80d94f8598221009035c8f336f5f656333 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Tue, 5 Jun 2018 11:35:14 +0200 Subject: [PATCH 11/14] svx: correctly possition form objects from PDF --- pdfium/fpdfsdk/fpdf_editpage.cpp | 25 +++++++++++++++++++++++++ pdfium/public/fpdf_edit.h | 18 ++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp index bf68250..f4a1688 100644 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp @@ -810,3 +810,28 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index) return nullptr; } + +FPDF_EXPORT void FPDF_CALLCONV +FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f) +{ + if (!form_object || !a || !b || !c || !d || !e || !f) + return; + + CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object); + if (pFrmObj) + { + const CFX_Matrix& matrix = pFrmObj->form_matrix(); + *a = matrix.a; + *b = matrix.b; + *c = matrix.c; + *d = matrix.d; + *e = matrix.e; + *f = matrix.f; + } +} diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h index ca76954..f249e64 100644 --- a/pdfium/public/fpdf_edit.h +++ b/pdfium/public/fpdf_edit.h @@ -1098,6 +1098,24 @@ FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object); FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index); +// Get the matrix of a particular form object. +// +// form_object - Handle of form object +// a - Pointer to a double value receiving coefficient "a" of the matrix. +// b - Pointer to a double value receiving coefficient "b" of the matrix. +// c - Pointer to a double value receiving coefficient "c" of the matrix. +// d - Pointer to a double value receiving coefficient "d" of the matrix. +// e - Pointer to a double value receiving coefficient "e" of the matrix. +// f - Pointer to a double value receiving coefficient "f" of the matrix. +FPDF_EXPORT void FPDF_CALLCONV +FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f); + #ifdef __cplusplus } // extern "C" #endif // __cplusplus -- 2.16.3