[Libreoffice-commits] core.git: external/pdfium svx/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Jul 12 07:13:52 UTC 2018


 external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1                           |  109 ++++++
 external/pdfium/0001-svx-import-PDF-text-using-PDFium.patch.2                     |  177 ----------
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2                 |  101 -----
 external/pdfium/0004-svx-support-PDF-text-color.patch.2                           |   59 +--
 external/pdfium/0007-svx-improved-text-importing-from-PDF.patch.2                 |   62 ---
 external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 |   76 ----
 external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2             |   35 -
 external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2                |    4 
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2                        |   12 
 external/pdfium/0013-svx-cleanup-pdfium-importer.patch.2                          |  130 -------
 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2                     |   17 
 external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2           |   22 -
 external/pdfium/UnpackedTarball_pdfium.mk                                         |    6 
 svx/source/svdraw/svdpdf.cxx                                                      |    2 
 14 files changed, 167 insertions(+), 645 deletions(-)

New commits:
commit 4ed059490d02afcbe359ab39def6729beeab6196
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 11 21:02:29 2018 +0200

    pdfium: replace FPDFTextObj_GetMatrix() patch with backport
    
    Also remove unused FPDFTextObj_GetUnicode() and FPDFTextObj_GetText().
    
    Change-Id: I4b1f88f878f2754ff790b67d286a9d5366acc641
    Reviewed-on: https://gerrit.libreoffice.org/57292
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1 b/external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1
new file mode 100644
index 000000000000..40b19a235254
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFText_GetMatrix-API.patch.1
@@ -0,0 +1,109 @@
+From 21ef03b50ef64d25a05d7ac047c0e382237c9b15 Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos at collabora.co.uk>
+Date: Tue, 19 Jun 2018 15:45:42 +0000
+Subject: [PATCH] Add FPDFText_GetMatrix() API
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is similar to FPDFPath_GetMatrix(), but works on text, not path
+objects.
+
+Change-Id: If268362b7fa4398124b953e0e2225074523f5f65
+Reviewed-on: https://pdfium-review.googlesource.com/35434
+Reviewed-by: dsinclair <dsinclair at chromium.org>
+Reviewed-by: Nicolás Peña Moreno <npm at chromium.org>
+Commit-Queue: Nicolás Peña Moreno <npm at chromium.org>
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 17 +++++++++++++++++
+ fpdfsdk/fpdf_edittext.cpp          | 30 ++++++++++++++++++++++++++++++
+ public/fpdf_edit.h                 | 25 +++++++++++++++++++++++++
+ 3 files changed, 72 insertions(+)
+
+diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
+index 2996a505e..c38873faa 100644
+--- a/fpdfsdk/fpdf_edittext.cpp
++++ b/fpdfsdk/fpdf_edittext.cpp
+@@ -398,6 +398,11 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
+   return pDoc->LoadFont(fontDict);
+ }
+ 
++CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
++  auto* obj = CPDFPageObjectFromFPDFPageObject(page_object);
++  return obj ? obj->AsText() : nullptr;
++}
++
+ }  // namespace
+ 
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
+@@ -475,6 +480,31 @@ FPDFText_SetFillColor(FPDF_PAGEOBJECT text_object,
+   return FPDFPageObj_SetFillColor(text_object, R, G, B, A);
+ }
+ 
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text,
++                                                       double* a,
++                                                       double* b,
++                                                       double* c,
++                                                       double* d,
++                                                       double* e,
++                                                       double* f) {
++  if (!text || !a || !b || !c || !d || !e || !f)
++    return false;
++
++  CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
++  if (!pTextObj)
++    return false;
++
++  CFX_Matrix text_matrix = pTextObj->GetTextMatrix();
++  *a = text_matrix.a;
++  *b = text_matrix.b;
++  *c = text_matrix.c;
++  *d = text_matrix.d;
++  *e = text_matrix.e;
++  *f = text_matrix.f;
++
++  return true;
++}
++
+ FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font) {
+   CPDF_Font* pFont = CPDFFontFromFPDFFont(font);
+   if (!pFont)
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index c0766a33b..5a2eeb449 100644
+--- a/public/fpdf_edit.h
++++ b/public/fpdf_edit.h
+@@ -954,6 +954,31 @@ FPDFText_SetFillColor(FPDF_PAGEOBJECT text_object,
+                       unsigned int B,
+                       unsigned int A);
+ 
++// Experimental API.
++// Get the transform matrix of a text object.
++//
++//   text - handle to a text.
++//   a    - matrix value.
++//   b    - matrix value.
++//   c    - matrix value.
++//   d    - matrix value.
++//   e    - matrix value.
++//   f    - matrix value.
++//
++// The matrix is composed as:
++//   |a c e|
++//   |b d f|
++// and used to scale, rotate, shear and translate the text.
++//
++// Returns TRUE on success.
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text,
++                                                       double* a,
++                                                       double* b,
++                                                       double* c,
++                                                       double* d,
++                                                       double* e,
++                                                       double* f);
++
+ // Close a loaded PDF font.
+ //
+ // font   - Handle to the loaded font.
+-- 
+2.16.4
+
diff --git a/external/pdfium/0001-svx-import-PDF-text-using-PDFium.patch.2 b/external/pdfium/0001-svx-import-PDF-text-using-PDFium.patch.2
deleted file mode 100644
index 9b0971cf4156..000000000000
--- a/external/pdfium/0001-svx-import-PDF-text-using-PDFium.patch.2
+++ /dev/null
@@ -1,177 +0,0 @@
-From 99fa46eba9be11aa2bd9ef0e21a126656c932c44 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:27:43 +0200
-Subject: [PATCH 01/14] svx: import PDF text using PDFium
-
----
- pdfium/core/fpdfapi/page/cpdf_imageobject.cpp    |  1 +
- pdfium/core/fpdfapi/page/cpdf_pageobject.cpp     |  2 ++
- pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp |  1 +
- pdfium/fpdfsdk/fpdf_editpage.cpp                 | 18 ++++++++++++++++++
- pdfium/fpdfsdk/fpdf_text.cpp                     | 22 ++++++++++++++++++++++
- pdfium/public/fpdf_edit.h                        | 15 +++++++++++++++
- pdfium/public/fpdf_text.h                        | 20 ++++++++++++++++++++
- 7 files changed, 79 insertions(+)
-
-diff --git a/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp b/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-index 3b5a740..58ef90a 100644
---- a/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-@@ -43,6 +43,7 @@ const CPDF_ImageObject* CPDF_ImageObject::AsImage() const {
- void CPDF_ImageObject::CalcBoundingBox() {
-   std::tie(m_Left, m_Right, m_Top, m_Bottom) =
-       m_Matrix.TransformRect(0.f, 1.f, 1.f, 0.f);
-+    fprintf(stderr, "Image BB: %f, %f, %f, %f\n", m_Left, m_Right, m_Top, m_Bottom);
- }
- 
- void CPDF_ImageObject::SetImage(const RetainPtr<CPDF_Image>& pImage) {
-diff --git a/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp b/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp
-index 8bb5bf5..9b5e2ce 100644
---- a/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp
-@@ -98,5 +98,7 @@ FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const {
-   if (pMatrix)
-     rect = pMatrix->TransformRect(rect);
- 
-+  FX_RECT rc = rect.GetOuterRect();
-+  fprintf(stderr, "PageObject BB: %f, %f, %f, %f\n", rc.left, rc.right, rc.top, rc.bottom);
-   return rect.GetOuterRect();
- }
-diff --git a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-index 565be85..87301d3 100644
---- a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-+++ b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-@@ -1767,6 +1767,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
-     return true;
- 
-   float font_size = textobj->m_TextState.GetFontSize();
-+  fprintf(stderr, "Font size: %f, matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", font_size, text_matrix.a, text_matrix.b, text_matrix.c, text_matrix.d, text_matrix.e, text_matrix.f);
-   if (bPattern) {
-     DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
-                             &text_matrix, bFill, bStroke);
-diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
-index ec29891..912df63 100644
---- a/pdfium/fpdfsdk/fpdf_editpage.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -18,6 +18,7 @@
- #include "core/fpdfapi/page/cpdf_page.h"
- #include "core/fpdfapi/page/cpdf_pageobject.h"
- #include "core/fpdfapi/page/cpdf_pathobject.h"
-+#include "core/fpdfapi/page/cpdf_textobject.h"
- #include "core/fpdfapi/page/cpdf_shadingobject.h"
- #include "core/fpdfapi/parser/cpdf_array.h"
- #include "core/fpdfapi/parser/cpdf_document.h"
-@@ -624,3 +625,20 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
-   pPageObj->SetDirty(true);
-   return true;
- }
-+
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-+                      double* a,
-+                      double* b,
-+                      double* c,
-+                      double* d) {
-+  if (!text_object)
-+    return;
-+
-+  CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+  const CFX_Matrix& matrix = pTxtObj->GetTextMatrix();
-+  *a = matrix.a;
-+  *b = matrix.b;
-+  *c = matrix.c;
-+  *d = matrix.d;
-+}
-diff --git a/pdfium/fpdfsdk/fpdf_text.cpp b/pdfium/fpdfsdk/fpdf_text.cpp
-index a1bbbb4..01b74c9 100644
---- a/pdfium/fpdfsdk/fpdf_text.cpp
-+++ b/pdfium/fpdfsdk/fpdf_text.cpp
-@@ -95,6 +95,28 @@ FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
-   return charinfo.m_FontSize;
- }
- 
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_TEXTPAGE text_page,
-+                                                  int index,
-+                                                  double* a,
-+                                                  double* b,
-+                                                  double* c,
-+                                                  double* d) {
-+  if (!text_page || index < 0)
-+    return false;
-+
-+  CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page);
-+  if (index >= textpage->CountChars())
-+    return false;
-+
-+  FPDF_CHAR_INFO charinfo;
-+  textpage->GetCharInfo(index, &charinfo);
-+  *a = charinfo.m_Matrix.a;
-+  *b = charinfo.m_Matrix.b;
-+  *c = charinfo.m_Matrix.c;
-+  *d = charinfo.m_Matrix.d;
-+  return true;
-+}
-+
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
-                                                         int index,
-                                                         double* left,
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index c0766a3..3f45495 100644
---- a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -971,6 +971,21 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
-                           FPDF_FONT font,
-                           float font_size);
- 
-+// Get the matrix of a particular text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+//               or FPDFPageObj_NewTextObjEx.
-+//   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.
-+FPDF_EXPORT void FPDF_CALLCONV
-+FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-+                      double* a,
-+                      double* b,
-+                      double* c,
-+                      double* d);
-+
- #ifdef __cplusplus
- }  // extern "C"
- #endif  // __cplusplus
-diff --git a/pdfium/public/fpdf_text.h b/pdfium/public/fpdf_text.h
-index 3502337..6524cd3 100644
---- a/pdfium/public/fpdf_text.h
-+++ b/pdfium/public/fpdf_text.h
-@@ -342,6 +342,26 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
- //
- FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle);
- 
-+// Get the matrix of a particular character.
-+//
-+// text_page - Handle to a text page information structure.
-+//             Returned by FPDFText_LoadPage function.
-+// index - Zero-based index of the character
-+//   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.
-+//
-+// Return Value:
-+//          On success, return TRUE and fill in |a|, |b|, |c|, and |d|
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFText_GetMatrix(FPDF_TEXTPAGE text_page,
-+                   int index,
-+                   double* a,
-+                   double* b,
-+                   double* c,
-+                   double* d);
-+
- // Function: FPDFLink_LoadWebLinks
- //          Prepare information about weblinks in a page.
- // Parameters:
--- 
-2.16.3
-
diff --git a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
index ab5564a87353..dfbc092ee018 100644
--- a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
+++ b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
@@ -20,8 +20,8 @@ index 912df63..3244943 100644
  #include "core/fpdfapi/page/cpdf_form.h"
  #include "core/fpdfapi/page/cpdf_formobject.h"
  #include "core/fpdfapi/page/cpdf_imageobject.h"
-@@ -626,6 +627,26 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
-   return true;
+@@ -436,6 +437,26 @@ FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
+   pPageObj->Transform(matrix);
  }
  
 +FPDF_EXPORT int FPDF_CALLCONV
@@ -45,80 +45,12 @@ index 912df63..3244943 100644
 +}
 +
  FPDF_EXPORT void FPDF_CALLCONV
- FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-                       double* a,
-@@ -642,3 +663,66 @@ FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-   *c = matrix.c;
-   *d = matrix.d;
- }
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetUnicode(FPDF_PAGEOBJECT text_object, int index)
-+{
-+  if (!text_object || index < 0)
-+    return 0;
-+
-+  CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+  if (index > pTxtObj->CountChars())
-+    return 0;
-+
-+  CPDF_TextObjectItem info;
-+  pTxtObj->GetCharInfo(index, &info);
-+  return info.m_CharCode;
-+}
-+
-+FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-+                                                  int char_start,
-+                                                  int char_count,
-+                                                  unsigned short* result) {
-+  if (!text_object || char_start < 0 || char_count < 0 || !result)
-+    return 0;
-+
-+  CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+  int char_available = pTxtObj->CountChars() - char_start;
-+  if (char_available <= 0)
-+    return 0;
-+
-+  char_count = std::min(char_count, char_available);
-+  if (char_count == 0) {
-+    // Writing out "", which has a character count of 1 due to the NUL.
-+    *result = '\0';
-+    return 1;
-+  }
-+
-+  CPDF_Font* pFont = pTxtObj->GetFont();
-+  WideString str;
-+  for (uint32_t charcode : pTxtObj->GetCharCodes()) {
-+    if (charcode != CPDF_Font::kInvalidCharCode)
-+      str += pFont->UnicodeFromCharCode(charcode);
-+  }
-+
-+//   CFX_WideTextBuf m_TextBuf;
-+//   WideString str = textpage->GetPageText(char_start, char_count);
-+//   return WideString(m_TextBuf.AsStringView().Mid(
-+//       static_cast<size_t>(text_start), static_cast<size_t>(text_count)));
-+
-+//   if (str.GetLength() > static_cast<size_t>(char_count))
-+//     str = str.Left(static_cast<size_t>(char_count));
-+
-+  // Reincode in UTF-16.
-+//   WideString str = text.UTF8Decode();
-+
-+  // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
-+  // the number of items to stay the same.
-+  ByteString byte_str = str.UTF16LE_Encode();
-+  size_t byte_str_len = byte_str.GetLength();
-+  int ret_count = byte_str_len / sizeof(unsigned short);
-+
-+  ASSERT(ret_count <= char_count + 1);  // +1 to account for the NUL terminator.
-+  memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
-+  return ret_count;
-+}
+ FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
+                          FPDF_BYTESTRING blend_mode) {
 diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index 3f45495..602849f 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -971,6 +971,26 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+@@ -996,6 +996,26 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
                            FPDF_FONT font,
                            float font_size);
  
@@ -142,29 +74,6 @@ index 3f45495..602849f 100644
 +FPDF_EXPORT int FPDF_CALLCONV
 +FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
 +
- // Get the matrix of a particular text object.
- //
- // text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-@@ -986,6 +1006,22 @@ FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-                       double* c,
-                       double* d);
- 
-+// Get the unicode of a special character in a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+//               or FPDFPageObj_NewTextObjEx.
-+// index - The index of the character to get the unicode.
-+// Return Value:
-+// The unicode value.
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetUnicode(FPDF_PAGEOBJECT text_object, int index);
-+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-+                    int char_start,
-+                    int char_count,
-+                    unsigned short* result);
-+
  #ifdef __cplusplus
  }  // extern "C"
  #endif  // __cplusplus
diff --git a/external/pdfium/0004-svx-support-PDF-text-color.patch.2 b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
index 5bf196cdfefa..a99f8f5966dd 100644
--- a/external/pdfium/0004-svx-support-PDF-text-color.patch.2
+++ b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
@@ -29,7 +29,7 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index 3244943..f8e2418 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -633,7 +633,7 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object)
+@@ -443,7 +443,7 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object)
    if (!text_object)
      return 0;
  
@@ -38,7 +38,7 @@ index 3244943..f8e2418 100644
    return pTxtObj->CountChars();
  }
  
-@@ -643,7 +643,7 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
+@@ -453,7 +453,7 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
    if (!text_object)
      return 0;
  
@@ -47,36 +47,9 @@ index 3244943..f8e2418 100644
    return pTxtObj->GetFontSize();
  }
  
-@@ -656,7 +656,7 @@ FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-   if (!text_object)
-     return;
- 
--  CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+  CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-   const CFX_Matrix& matrix = pTxtObj->GetTextMatrix();
-   *a = matrix.a;
-   *b = matrix.b;
-@@ -670,7 +670,7 @@ FPDFTextObj_GetUnicode(FPDF_PAGEOBJECT text_object, int index)
-   if (!text_object || index < 0)
-     return 0;
- 
--  CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+  CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-   if (index > pTxtObj->CountChars())
-     return 0;
- 
-@@ -686,7 +686,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-   if (!text_object || char_start < 0 || char_count < 0 || !result)
-     return 0;
- 
--  CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+  CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-   int char_available = pTxtObj->CountChars() - char_start;
-   if (char_available <= 0)
-     return 0;
-@@ -726,3 +726,23 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-   memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
-   return ret_count;
+@@ -645,3 +645,23 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+   pPageObj->SetDirty(true);
+   return true;
  }
 +
 +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
@@ -102,9 +75,9 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 index 602849f..fa9902e 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1022,6 +1022,22 @@ FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-                     int char_count,
-                     unsigned short* result);
+@@ -1016,6 +1016,22 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
  
 +// Get the stroke RGBA of a text. Range of values: 0 - 255.
 +//
@@ -125,6 +98,22 @@ index 602849f..fa9902e 100644
  #ifdef __cplusplus
  }  // extern "C"
  #endif  // __cplusplus
+diff --git a/pdfium/fpdfsdk/fpdf_edittext.cpp b/pdfium/fpdfsdk/fpdf_edittext.cpp
+index c38873faa..aa3287ef4 100644
+--- a/pdfium/fpdfsdk/fpdf_edittext.cpp
++++ b/pdfium/fpdfsdk/fpdf_edittext.cpp
+@@ -398,11 +398,6 @@ CPDF_Font* LoadCompositeFont(CPDF_Document* pDoc,
+   return pDoc->LoadFont(fontDict);
+ }
+ 
+-CPDF_TextObject* CPDFTextObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object) {
+-  auto* obj = CPDFPageObjectFromFPDFPageObject(page_object);
+-  return obj ? obj->AsText() : nullptr;
+-}
+-
+ }  // namespace
+ 
+ FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
 -- 
 2.16.3
 
diff --git a/external/pdfium/0007-svx-improved-text-importing-from-PDF.patch.2 b/external/pdfium/0007-svx-improved-text-importing-from-PDF.patch.2
deleted file mode 100644
index e7afda576d15..000000000000
--- a/external/pdfium/0007-svx-improved-text-importing-from-PDF.patch.2
+++ /dev/null
@@ -1,62 +0,0 @@
-From 87f3da183a87f3ff5df854971a0c3bc2134ecd61 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:31:35 +0200
-Subject: [PATCH 07/14] svx: improved text importing from PDF
-
----
- pdfium/fpdfsdk/fpdf_editpage.cpp | 9 +++++++--
- pdfium/public/fpdf_edit.h        | 6 +++++-
- 2 files changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
-index f8e2418..2249e8e 100644
---- a/pdfium/fpdfsdk/fpdf_editpage.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -652,8 +652,11 @@ FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-                       double* a,
-                       double* b,
-                       double* c,
--                      double* d) {
--  if (!text_object)
-+                      double* d,
-+                      double* e,
-+                      double* f)
-+{
-+  if (!text_object || !a || !b || !c || !d || !e || !f)
-     return;
- 
-   CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-@@ -662,6 +665,8 @@ FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-   *b = matrix.b;
-   *c = matrix.c;
-   *d = matrix.d;
-+  *e = matrix.e;
-+  *f = matrix.f;
- }
- 
- FPDF_EXPORT int FPDF_CALLCONV
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index 89ec8cf..fc906f4 100644
---- a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -1038,12 +1038,16 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
- //   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
- FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-                       double* a,
-                       double* b,
-                       double* c,
--                      double* d);
-+                      double* d,
-+                      double* e,
-+                      double* f);
- 
- // Get the unicode of a special character in a text object.
- //
--- 
-2.16.3
-
diff --git a/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 b/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2
deleted file mode 100644
index d85b33177f06..000000000000
--- a/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2
+++ /dev/null
@@ -1,76 +0,0 @@
-From 92e382401059237c84c13114d4612ceaa5b0c214 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:32:12 +0200
-Subject: [PATCH 08/14] svx: correct the positioning of PDF Paths and the
- stroke width
-
----
- pdfium/core/fpdfapi/page/cpdf_page.cpp           |  3 +++
- pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp |  2 +-
- pdfium/core/fxge/cfx_pathdata.cpp                |  2 ++
- pdfium/fpdfsdk/fpdf_editpath.cpp                 | 16 ++++++++--------
- 4 files changed, 14 insertions(+), 9 deletions(-)
-
-diff --git a/pdfium/core/fpdfapi/page/cpdf_page.cpp b/pdfium/core/fpdfapi/page/cpdf_page.cpp
-index eee6673..00657d6 100644
---- a/pdfium/core/fpdfapi/page/cpdf_page.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_page.cpp
-@@ -37,12 +37,14 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
-   CFX_FloatRect mediabox = GetBox("MediaBox");
-   if (mediabox.IsEmpty())
-     mediabox = CFX_FloatRect(0, 0, 612, 792);
-+  fprintf(stderr, "Page mediabox: %f, %f, %f, %f\n", mediabox.left, mediabox.right, mediabox.top, mediabox.bottom);
- 
-   m_BBox = GetBox("CropBox");
-   if (m_BBox.IsEmpty())
-     m_BBox = mediabox;
-   else
-     m_BBox.Intersect(mediabox);
-+  fprintf(stderr, "Page cropbox: %f, %f, %f, %f\n", m_BBox.left, m_BBox.right, m_BBox.top, m_BBox.bottom);
- 
-   m_PageSize.width = m_BBox.Width();
-   m_PageSize.height = m_BBox.Height();
-@@ -50,6 +52,7 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
-   int rotate = GetPageRotation();
-   if (rotate % 2)
-     std::swap(m_PageSize.width, m_PageSize.height);
-+  fprintf(stderr, "Page rotate: %d, Page Width: %f, Page Height: %f\n", rotate, m_PageSize.width, m_PageSize.height);
- 
-   switch (rotate) {
-     case 0:
-diff --git a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-index 87301d3..bf82d55 100644
---- a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-+++ b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-@@ -1767,7 +1767,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
-     return true;
- 
-   float font_size = textobj->m_TextState.GetFontSize();
--  fprintf(stderr, "Font size: %f, matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", font_size, text_matrix.a, text_matrix.b, text_matrix.c, text_matrix.d, text_matrix.e, text_matrix.f);
-+//   fprintf(stderr, "Font size: %f, matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", font_size, text_matrix.a, text_matrix.b, text_matrix.c, text_matrix.d, text_matrix.e, text_matrix.f);
-   if (bPattern) {
-     DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
-                             &text_matrix, bFill, bStroke);
-diff --git a/pdfium/core/fxge/cfx_pathdata.cpp b/pdfium/core/fxge/cfx_pathdata.cpp
-index ac1ff42..a483edf 100644
---- a/pdfium/core/fxge/cfx_pathdata.cpp
-+++ b/pdfium/core/fxge/cfx_pathdata.cpp
-@@ -199,6 +199,7 @@ void CFX_PathData::Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix) {
- void CFX_PathData::AppendPoint(const CFX_PointF& point,
-                                FXPT_TYPE type,
-                                bool closeFigure) {
-+  fprintf(stderr, "Append: %f, %f (%s)\n", point.x, point.y, closeFigure ? "CLOSE" : "OPEN");
-   m_Points.push_back(FX_PATHPOINT(point, type, closeFigure));
- }
- 
-@@ -294,6 +295,7 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width,
- void CFX_PathData::Transform(const CFX_Matrix* pMatrix) {
-   if (!pMatrix)
-     return;
-+  fprintf(stderr, "XForm: %f, %f %f, %f, %f, %f\n", pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, pMatrix->e, pMatrix->f);
-   for (auto& point : m_Points)
-     point.m_Point = pMatrix->Transform(point.m_Point);
- }
--- 
-2.16.3
-
diff --git a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 b/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
index 25bba8d52cbb..c141cc4b58ea 100644
--- a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
+++ b/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
@@ -10,41 +10,6 @@ Subject: [PATCH 09/14] svx: support color text for imported PDFs
  pdfium/public/fpdf_edit.h                     | 10 +++---
  4 files changed, 46 insertions(+), 17 deletions(-)
 
-diff --git a/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp b/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-index 58ef90a..416d82d 100644
---- a/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-@@ -43,7 +43,7 @@ const CPDF_ImageObject* CPDF_ImageObject::AsImage() const {
- void CPDF_ImageObject::CalcBoundingBox() {
-   std::tie(m_Left, m_Right, m_Top, m_Bottom) =
-       m_Matrix.TransformRect(0.f, 1.f, 1.f, 0.f);
--    fprintf(stderr, "Image BB: %f, %f, %f, %f\n", m_Left, m_Right, m_Top, m_Bottom);
-+    // fprintf(stderr, "Image BB: %f, %f, %f, %f\n", m_Left, m_Right, m_Top, m_Bottom);
- }
- 
- void CPDF_ImageObject::SetImage(const RetainPtr<CPDF_Image>& pImage) {
-diff --git a/pdfium/core/fxge/cfx_pathdata.cpp b/pdfium/core/fxge/cfx_pathdata.cpp
-index a483edf..13e2cdb 100644
---- a/pdfium/core/fxge/cfx_pathdata.cpp
-+++ b/pdfium/core/fxge/cfx_pathdata.cpp
-@@ -199,7 +199,7 @@ void CFX_PathData::Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix) {
- void CFX_PathData::AppendPoint(const CFX_PointF& point,
-                                FXPT_TYPE type,
-                                bool closeFigure) {
--  fprintf(stderr, "Append: %f, %f (%s)\n", point.x, point.y, closeFigure ? "CLOSE" : "OPEN");
-+//   fprintf(stderr, "Append: %f, %f (%s)\n", point.x, point.y, closeFigure ? "CLOSE" : "OPEN");
-   m_Points.push_back(FX_PATHPOINT(point, type, closeFigure));
- }
- 
-@@ -295,7 +295,7 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width,
- void CFX_PathData::Transform(const CFX_Matrix* pMatrix) {
-   if (!pMatrix)
-     return;
--  fprintf(stderr, "XForm: %f, %f %f, %f, %f, %f\n", pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, pMatrix->e, pMatrix->f);
-+//   fprintf(stderr, "XForm: %f, %f %f, %f, %f, %f\n", pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, pMatrix->e, pMatrix->f);
-   for (auto& point : m_Points)
-     point.m_Point = pMatrix->Transform(point.m_Point);
- }
 diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index 2249e8e..9c353a4 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
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
index c2c8592b7142..f0b09bbf7abf 100644
--- a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
+++ b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
@@ -29,7 +29,7 @@ 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,
+@@ -704,3 +704,31 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
  
    return true;
  }
@@ -54,8 +54,6 @@ index 9c353a4..bf68250 100644
 +  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);
diff --git a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
index cae9ec808aba..008c7047bdfa 100644
--- a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
+++ b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
@@ -64,7 +64,7 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index f4a1688..f34d3b5 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -27,6 +27,7 @@
+@@ -26,6 +26,7 @@
  #include "core/fpdfapi/parser/cpdf_string.h"
  #include "core/fpdfdoc/cpdf_annot.h"
  #include "core/fpdfdoc/cpdf_annotlist.h"
@@ -72,8 +72,8 @@ index f4a1688..f34d3b5 100644
  #include "fpdfsdk/cpdfsdk_helpers.h"
  #include "public/fpdf_formfill.h"
  #include "third_party/base/logging.h"
-@@ -732,6 +733,46 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-   return ret_count;
+@@ -656,6 +657,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+   return true;
  }
  
 +FPDF_EXPORT int FPDF_CALLCONV
@@ -123,9 +123,9 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 index f249e64..e14b2a5 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1065,6 +1065,19 @@ FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-                     int char_count,
-                     unsigned short* result);
+@@ -1088,6 +1088,19 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
  
 +// Get the processed text of a text object.
 +//
diff --git a/external/pdfium/0013-svx-cleanup-pdfium-importer.patch.2 b/external/pdfium/0013-svx-cleanup-pdfium-importer.patch.2
deleted file mode 100644
index 91fb38d2825b..000000000000
--- a/external/pdfium/0013-svx-cleanup-pdfium-importer.patch.2
+++ /dev/null
@@ -1,130 +0,0 @@
-From 2f56db06360e547f995c6b20050974d5f4c6f7c6 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:36:05 +0200
-Subject: [PATCH 13/14] svx: cleanup pdfium importer
-
----
- pdfium/core/fpdfapi/page/cpdf_imageobject.cpp    |  1 -
- pdfium/core/fpdfapi/page/cpdf_page.cpp           |  3 ---
- pdfium/core/fpdfapi/page/cpdf_pageobject.cpp     |  2 --
- pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp |  1 -
- pdfium/core/fxge/cfx_pathdata.cpp                |  2 --
- pdfium/fpdfsdk/fpdf_editpage.cpp                 | 12 ------------
- 6 files changed, 21 deletions(-)
-
-diff --git a/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp b/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-index 416d82d..3b5a740 100644
---- a/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_imageobject.cpp
-@@ -43,7 +43,6 @@ const CPDF_ImageObject* CPDF_ImageObject::AsImage() const {
- void CPDF_ImageObject::CalcBoundingBox() {
-   std::tie(m_Left, m_Right, m_Top, m_Bottom) =
-       m_Matrix.TransformRect(0.f, 1.f, 1.f, 0.f);
--    // fprintf(stderr, "Image BB: %f, %f, %f, %f\n", m_Left, m_Right, m_Top, m_Bottom);
- }
- 
- void CPDF_ImageObject::SetImage(const RetainPtr<CPDF_Image>& pImage) {
-diff --git a/pdfium/core/fpdfapi/page/cpdf_page.cpp b/pdfium/core/fpdfapi/page/cpdf_page.cpp
-index 00657d6..eee6673 100644
---- a/pdfium/core/fpdfapi/page/cpdf_page.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_page.cpp
-@@ -37,14 +37,12 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
-   CFX_FloatRect mediabox = GetBox("MediaBox");
-   if (mediabox.IsEmpty())
-     mediabox = CFX_FloatRect(0, 0, 612, 792);
--  fprintf(stderr, "Page mediabox: %f, %f, %f, %f\n", mediabox.left, mediabox.right, mediabox.top, mediabox.bottom);
- 
-   m_BBox = GetBox("CropBox");
-   if (m_BBox.IsEmpty())
-     m_BBox = mediabox;
-   else
-     m_BBox.Intersect(mediabox);
--  fprintf(stderr, "Page cropbox: %f, %f, %f, %f\n", m_BBox.left, m_BBox.right, m_BBox.top, m_BBox.bottom);
- 
-   m_PageSize.width = m_BBox.Width();
-   m_PageSize.height = m_BBox.Height();
-@@ -52,7 +50,6 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
-   int rotate = GetPageRotation();
-   if (rotate % 2)
-     std::swap(m_PageSize.width, m_PageSize.height);
--  fprintf(stderr, "Page rotate: %d, Page Width: %f, Page Height: %f\n", rotate, m_PageSize.width, m_PageSize.height);
- 
-   switch (rotate) {
-     case 0:
-diff --git a/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp b/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp
-index 9b5e2ce..8bb5bf5 100644
---- a/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp
-+++ b/pdfium/core/fpdfapi/page/cpdf_pageobject.cpp
-@@ -98,7 +98,5 @@ FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const {
-   if (pMatrix)
-     rect = pMatrix->TransformRect(rect);
- 
--  FX_RECT rc = rect.GetOuterRect();
--  fprintf(stderr, "PageObject BB: %f, %f, %f, %f\n", rc.left, rc.right, rc.top, rc.bottom);
-   return rect.GetOuterRect();
- }
-diff --git a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-index bf82d55..565be85 100644
---- a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-+++ b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
-@@ -1767,7 +1767,6 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
-     return true;
- 
-   float font_size = textobj->m_TextState.GetFontSize();
--//   fprintf(stderr, "Font size: %f, matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", font_size, text_matrix.a, text_matrix.b, text_matrix.c, text_matrix.d, text_matrix.e, text_matrix.f);
-   if (bPattern) {
-     DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
-                             &text_matrix, bFill, bStroke);
-diff --git a/pdfium/core/fxge/cfx_pathdata.cpp b/pdfium/core/fxge/cfx_pathdata.cpp
-index 13e2cdb..ac1ff42 100644
---- a/pdfium/core/fxge/cfx_pathdata.cpp
-+++ b/pdfium/core/fxge/cfx_pathdata.cpp
-@@ -199,7 +199,6 @@ void CFX_PathData::Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix) {
- void CFX_PathData::AppendPoint(const CFX_PointF& point,
-                                FXPT_TYPE type,
-                                bool closeFigure) {
--//   fprintf(stderr, "Append: %f, %f (%s)\n", point.x, point.y, closeFigure ? "CLOSE" : "OPEN");
-   m_Points.push_back(FX_PATHPOINT(point, type, closeFigure));
- }
- 
-@@ -295,7 +294,6 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width,
- void CFX_PathData::Transform(const CFX_Matrix* pMatrix) {
-   if (!pMatrix)
-     return;
--//   fprintf(stderr, "XForm: %f, %f %f, %f, %f, %f\n", pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, pMatrix->e, pMatrix->f);
-   for (auto& point : m_Points)
-     point.m_Point = pMatrix->Transform(point.m_Point);
- }
-diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
-index f34d3b5..29c8b01 100644
---- a/pdfium/fpdfsdk/fpdf_editpage.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -711,17 +711,6 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-       str += pFont->UnicodeFromCharCode(charcode);
-   }
- 
--//   CFX_WideTextBuf m_TextBuf;
--//   WideString str = textpage->GetPageText(char_start, char_count);
--//   return WideString(m_TextBuf.AsStringView().Mid(
--//       static_cast<size_t>(text_start), static_cast<size_t>(text_count)));
--
--//   if (str.GetLength() > static_cast<size_t>(char_count))
--//     str = str.Left(static_cast<size_t>(char_count));
--
--  // Reincode in UTF-16.
--//   WideString str = text.UTF8Decode();
--
-   // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected
-   // the number of items to stay the same.
-   ByteString byte_str = str.UTF16LE_Encode();
-@@ -843,7 +832,6 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
-   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);
--- 
-2.16.3
-
diff --git a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
index 8bf3e920f180..d56c2ce69e70 100644
--- a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
+++ b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
@@ -40,16 +40,7 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index 29c8b01..a52e1a9 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -718,7 +718,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
-   int ret_count = byte_str_len / sizeof(unsigned short);
- 
-   ASSERT(ret_count <= char_count + 1);  // +1 to account for the NUL terminator.
--  memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
-+  memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
-   return ret_count;
- }
- 
-@@ -758,7 +758,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
+@@ -693,7 +693,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
    int ret_count = byte_str_len / kBytesPerCharacter;
  
    ASSERT(ret_count <= char_count + 1);  // +1 to account for the NUL terminator.
@@ -58,7 +49,7 @@ index 29c8b01..a52e1a9 100644
    return ret_count;
  }
  
-@@ -801,10 +801,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
+@@ -736,10 +736,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
        return false;
    }
  
@@ -78,8 +69,8 @@ index 29c8b01..a52e1a9 100644
    *A = static_cast<unsigned int>(
        (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
  
-@@ -834,7 +839,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
-     const CFX_Matrix& matrix = pFrmObj->form_matrix();
+@@ -768,7 +773,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
+   {
      const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
      if (pObjectList)
 -        return pObjectList->GetPageObjectByIndex(index);
diff --git a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
index 798b2b6c1ef8..8eb0bac1eed2 100644
--- a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
+++ b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
@@ -12,7 +12,15 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index a52e1a9..9daffc0 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -648,6 +648,29 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
+@@ -20,6 +20,7 @@
+ #include "core/fpdfapi/page/cpdf_pageobject.h"
+ #include "core/fpdfapi/page/cpdf_pathobject.h"
+ #include "core/fpdfapi/page/cpdf_shadingobject.h"
++#include "core/fpdfapi/page/cpdf_textobject.h"
+ #include "core/fpdfapi/parser/cpdf_array.h"
+ #include "core/fpdfapi/parser/cpdf_document.h"
+ #include "core/fpdfapi/parser/cpdf_number.h"
+@@ -458,6 +459,29 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
    return pTxtObj->GetFontSize();
  }
  
@@ -40,15 +48,15 @@ index a52e1a9..9daffc0 100644
 +}
 +
  FPDF_EXPORT void FPDF_CALLCONV
- FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object,
-                       double* a,
+ FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
+                          FPDF_BYTESTRING blend_mode) {
 diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 index 4351649..f858ab2 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1030,6 +1030,17 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
- FPDF_EXPORT int FPDF_CALLCONV
- FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
+@@ -1068,6 +1068,17 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+                           FPDF_FONT font,
+                           float font_size);
  
 +// Get the font name of a text object.
 +//
@@ -61,7 +69,7 @@ index 4351649..f858ab2 100644
 +FPDF_EXPORT int FPDF_CALLCONV
 +FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result);
 +
- // Get the matrix of a particular text object.
+ // Get the number of characters from a text object.
  //
  // text_object - Handle of text object returned by FPDFPageObj_NewTextObj
 -- 
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index aa197395312b..64d3a5adb946 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -14,7 +14,8 @@ pdfium_patches += icu.patch.1
 # Fixes build on our baseline.
 pdfium_patches += build.patch.1
 # Adds missing editing API
-pdfium_patches += 0001-svx-import-PDF-text-using-PDFium.patch.2
+# Backport of <https://pdfium-review.googlesource.com/35434>.
+pdfium_patches += 0001-Add-FPDFText_GetMatrix-API.patch.1
 pdfium_patches += 0002-svx-more-accurate-PDF-text-importing.patch.2
 pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
 pdfium_patches += 0004-svx-support-PDF-text-color.patch.2
@@ -24,13 +25,10 @@ pdfium_patches += 0005-svx-support-Paths-in-PDFs-while-importing.patch.1
 pdfium_patches += 0006-Add-FPDFPath_GetDrawMode-API.patch.1
 # Backport of <https://pdfium-review.googlesource.com/33670>.
 pdfium_patches += 0006-Add-FPDFPath_GetMatrix-and-FPDFPath_SetMatrix-APIs.patch.1
-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
 pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2
 pdfium_patches += 0012-svx-import-processed-PDF-text.patch.2
-pdfium_patches += 0013-svx-cleanup-pdfium-importer.patch.2
 pdfium_patches += 0014-svx-update-PDFium-patch-and-code.patch.2
 pdfium_patches += 0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
 
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index f5d741bdfd80..5b664eb23c65 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -816,7 +816,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex
         return;
 
     double a, b, c, d, e, f;
-    FPDFTextObj_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
+    FPDFText_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
     Matrix aTextMatrix(mCurMatrix);
 
     aTextMatrix.Transform(left, right, top, bottom);


More information about the Libreoffice-commits mailing list