diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-04-15 21:56:49 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-07 10:45:28 +0200 |
commit | 3ac5ec542031e08996768918d8793b5da3648fda (patch) | |
tree | a6ee6903933ba4e578f2079c5671da085dafdd6f /external/pdfium | |
parent | 81dfcf9b251192841f5049b028d4039d17133b5a (diff) |
svx: support importing forms from PDFs
Still missing the context matrix transformations.
Change-Id: Id9457c6475463127d3bc444f36fa373a6ec8fcb6
(cherry picked from commit 08e2c68e99151c70d06581261bbc137f80967d9e)
Diffstat (limited to 'external/pdfium')
-rw-r--r-- | external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 | 96 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 1 |
2 files changed, 97 insertions, 0 deletions
diff --git a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 new file mode 100644 index 000000000000..c2c8592b7142 --- /dev/null +++ b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 @@ -0,0 +1,96 @@ +From 636f92aac24f0accfbce910c9153d5479e097e5f Mon Sep 17 00:00:00 2001 +From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> +Date: Tue, 5 Jun 2018 11:34:38 +0200 +Subject: [PATCH 10/14] svx: support importing forms from PDFs + +--- + pdfium/fpdfsdk/cpdfsdk_helpers.h | 5 +++++ + pdfium/fpdfsdk/fpdf_editpage.cpp | 30 ++++++++++++++++++++++++++++++ + pdfium/public/fpdf_edit.h | 17 +++++++++++++++++ + 3 files changed, 52 insertions(+) + +diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h +index 13362cf..477bb74 100644 +--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h ++++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h +@@ -209,6 +209,11 @@ inline CPDF_TextObject* CPDFTextObjectFromFPDFPageObject( + return reinterpret_cast<CPDF_TextObject*>(page_object); + } + ++inline CPDF_FormObject* CPDFFormObjectFromFPDFPageObject( ++ FPDF_PAGEOBJECT page_object) { ++ return reinterpret_cast<CPDF_FormObject*>(page_object); ++} ++ + ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string); + + #ifdef PDF_ENABLE_XFA +diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp +index 9c353a4..bf68250 100644 +--- a/pdfium/fpdfsdk/fpdf_editpage.cpp ++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp +@@ -780,3 +780,33 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, + + return true; + } ++ ++FPDF_EXPORT int FPDF_CALLCONV ++FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object) ++{ ++ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object); ++ if (pFrmObj) ++ { ++ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList(); ++ if (pObjectList) ++ return pObjectList->size(); ++ } ++ ++ return 0; ++} ++ ++FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV ++FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index) ++{ ++ CPDF_FormObject* pFrmObj = CPDFFormObjectFromFPDFPageObject(form_object); ++ if (pFrmObj) ++ { ++ const CFX_Matrix& matrix = pFrmObj->form_matrix(); ++ fprintf(stderr, "Form matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f); ++ const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList(); ++ if (pObjectList) ++ return pObjectList->GetPageObjectByIndex(index); ++ } ++ ++ return nullptr; ++} +diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h +index 4264ccd..ca76954 100644 +--- a/pdfium/public/fpdf_edit.h ++++ b/pdfium/public/fpdf_edit.h +@@ -1081,6 +1081,23 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object, + unsigned int* B, + unsigned int* A); + ++// Get number of page objects inside the form object. ++// ++// form_object - Handle to a form object. Returned by FPDFPage_GetObject. ++// Return value: ++// The number of the page objects. ++FPDF_EXPORT int FPDF_CALLCONV ++FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object); ++ ++// Get the page object from a form object. ++// ++// form_object - Handle to a form object. Returned by FPDFPage_GetObject. ++// index - The index of a page object. ++// Return value: ++// The handle of the page object. Null for failed. ++FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV ++FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index); ++ + #ifdef __cplusplus + } // extern "C" + #endif // __cplusplus +-- +2.16.3 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index 04a2f70d3204..707c904fdd96 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -23,6 +23,7 @@ pdfium_patches += 0006-svx-improve-path-importing-from-PDF.patch.2 pdfium_patches += 0007-svx-improved-text-importing-from-PDF.patch.2 pdfium_patches += 0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 pdfium_patches += 0009-svx-support-color-text-for-imported-PDFs.patch.2 +pdfium_patches += 0010-svx-support-importing-forms-from-PDFs.patch.2 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) |