download.lst                                              |    4 
 external/pdfium/Library_pdfium.mk                         |  153 ++++++----
 external/pdfium/UnpackedTarball_pdfium.mk                 |   15 -
 external/pdfium/build.patch.1                             |  119 --------
 external/pdfium/c++20-comparison.patch                    |   13 
 external/pdfium/configs/build_config.h                    |    6 
 external/pdfium/msvc2015.patch.1                          |  202 ++++++++++++++
 external/pdfium/ubsan.patch                               |   26 -
 external/pdfium/visibility.patch.1                        |   30 --
 external/pdfium/windows7.patch.1                          |   34 ++
 include/vcl/filter/PDFiumLibrary.hxx                      |    2 
 solenv/flatpak-manifest.in                                |    6 
 svx/source/svdraw/svdpdf.cxx                              |   31 +-
 xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf |binary
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx             |   16 +
 xmlsecurity/source/pdfio/pdfdocument.cxx                  |   63 ++++
 16 files changed, 480 insertions(+), 240 deletions(-)

New commits:
commit 0eeb6c837ea70530b9323311856d7504160c3229
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Nov 4 21:39:04 2020 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Apr 11 13:58:00 2022 +0200

    xmlsecurity: reject a few dangerous annotation types during pdf sig verify
    
    (cherry picked from commit f231dacde9df1c4aa5f4e0970535c4f4093364a7)
    
    Conflicts:
            xmlsecurity/source/helper/pdfsignaturehelper.cxx
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105926
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit fcab45e0e22f4cf46e71856dba7ae5abd6f99bc5)
    
    Change-Id: I950b49a6e7181639daf27348ddfa0f36586baa65
    
    Conflicts:
            xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
    (cherry-picked from 363997c76749219b900f47043d1b17ba8ec9bccd)
    
    Change-Id: I7096222bc2547046d988e0ba28df725859270790

diff --git a/include/vcl/filter/PDFiumLibrary.hxx 
b/include/vcl/filter/PDFiumLibrary.hxx
index 783b9a6da8b4..027e4939fab1 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -59,6 +59,8 @@ public:
             FPDF_ClosePage(mpPage);
     }
 
+    FPDF_PAGE getPointer() { return mpPage; }
+
     /// Get bitmap checksum of the page, without annotations/commenting.
     BitmapChecksum getChecksum(int nMDPPerm);
 };
diff --git a/xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf 
b/xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf
new file mode 100644
index 000000000000..b30f5b03867c
Binary files /dev/null and 
b/xmlsecurity/qa/unit/pdfsigning/data/bad-cert-p3-stamp.pdf differ
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx 
b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 2341c315ee35..4ca2e5921645 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -482,6 +482,22 @@ void PDFSigningTest::testBadCertP1()
                          rInformation.nStatus);
 }
 
+CPPUNIT_TEST_FIXTURE(PDFSigningTest, testBadCertP3Stamp)
+{
+    std::vector<SignatureInformation> aInfos
+        = verify(m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"bad-cert-p3-stamp.pdf", 1,
+                 /*rExpectedSubFilter=*/OString());
+    CPPUNIT_ASSERT(!aInfos.empty());
+    SignatureInformation& rInformation = aInfos[0];
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 0 (SecurityOperationStatus_UNKNOWN)
+    // - Actual  : 1 (SecurityOperationStatus_OPERATION_SUCCEEDED)
+    // i.e. adding a stamp annotation was not considered as a bad modification.
+    
CPPUNIT_ASSERT_EQUAL(xml::crypto::SecurityOperationStatus::SecurityOperationStatus_UNKNOWN,
+                         rInformation.nStatus);
+}
+
 /// Test writing a PAdES signature.
 void PDFSigningTest::testSigningCertificateAttribute()
 {
diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx 
b/xmlsecurity/source/pdfio/pdfdocument.cxx
index 9d056de0a15c..51eac91495a7 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -24,6 +24,11 @@
 #include <svl/cryptosign.hxx>
 #include <vcl/filter/pdfdocument.hxx>
 #include <vcl/bitmap.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+
+#if HAVE_FEATURE_PDFIUM
+#include <fpdf_annot.h>
+#endif
 
 using namespace com::sun::star;
 
@@ -138,8 +143,29 @@ bool IsCompleteSignature(SvStream& rStream, 
vcl::filter::PDFDocument& rDocument,
     return std::find(rAllEOFs.begin(), rAllEOFs.end(), nFileEnd) != 
rAllEOFs.end();
 }
 
+/**
+ * Contains checksums of a PDF page, which is rendered without annotations. It 
also contains
+ * the geometry of a few dangerous annotation types.
+ */
+struct PageChecksum
+{
+    BitmapChecksum m_nPageContent;
+    std::vector<basegfx::B2DRectangle> m_aAnnotations;
+    bool operator==(const PageChecksum& rChecksum) const;
+};
+
+bool PageChecksum::operator==(const PageChecksum& rChecksum) const
+{
+    if (m_nPageContent != rChecksum.m_nPageContent)
+    {
+        return false;
+    }
+
+    return m_aAnnotations == rChecksum.m_aAnnotations;
+}
+
 /// Collects the checksum of each page of one version of the PDF.
-void AnalyizeSignatureStream(SvMemoryStream& rStream, 
std::vector<BitmapChecksum>& rPageChecksums,
+void AnalyizeSignatureStream(SvMemoryStream& rStream, 
std::vector<PageChecksum>& rPageChecksums,
                              int nMDPPerm)
 {
 #if HAVE_FEATURE_PDFIUM
@@ -156,8 +182,35 @@ void AnalyizeSignatureStream(SvMemoryStream& rStream, 
std::vector<BitmapChecksum
             return;
         }
 
-        BitmapChecksum nPageChecksum = pPdfPage->getChecksum(nMDPPerm);
-        rPageChecksums.push_back(nPageChecksum);
+        PageChecksum aPageChecksum;
+        aPageChecksum.m_nPageContent = pPdfPage->getChecksum(nMDPPerm);
+        for (int i = 0; i < FPDFPage_GetAnnotCount(pPdfPage->getPointer()); 
++i)
+        {
+            FPDF_ANNOTATION pAnnotation = 
FPDFPage_GetAnnot(pPdfPage->getPointer(), i);
+            int nType = FPDFAnnot_GetSubtype(pAnnotation);
+            switch (nType)
+            {
+                case FPDF_ANNOT_UNKNOWN:
+                case FPDF_ANNOT_FREETEXT:
+                case FPDF_ANNOT_STAMP:
+                case FPDF_ANNOT_REDACT:
+                {
+                    basegfx::B2DRectangle aB2DRectangle;
+                    FS_RECTF aRect;
+                    if (FPDFAnnot_GetRect(pAnnotation, &aRect))
+                    {
+                        aB2DRectangle = basegfx::B2DRectangle(aRect.left, 
aRect.top, aRect.right,
+                                                              aRect.bottom);
+                    }
+                    aPageChecksum.m_aAnnotations.push_back(aB2DRectangle);
+                    break;
+                }
+                default:
+                    break;
+            }
+            FPDFPage_CloseAnnot(pAnnotation);
+        }
+        rPageChecksums.push_back(aPageChecksum);
     }
 #else
     (void)rStream;
@@ -182,7 +235,7 @@ bool IsValidSignature(SvStream& rStream, 
vcl::filter::PDFObjectElement* pSignatu
     aSignatureStream.WriteStream(rStream, nSignatureEOF);
     rStream.Seek(nPos);
     aSignatureStream.Seek(0);
-    std::vector<BitmapChecksum> aSignedPages;
+    std::vector<PageChecksum> aSignedPages;
     AnalyizeSignatureStream(aSignatureStream, aSignedPages, nMDPPerm);
 
     SvMemoryStream aFullStream;
@@ -191,7 +244,7 @@ bool IsValidSignature(SvStream& rStream, 
vcl::filter::PDFObjectElement* pSignatu
     aFullStream.WriteStream(rStream);
     rStream.Seek(nPos);
     aFullStream.Seek(0);
-    std::vector<BitmapChecksum> aAllPages;
+    std::vector<PageChecksum> aAllPages;
     AnalyizeSignatureStream(aFullStream, aAllPages, nMDPPerm);
 
     // Fail if any page looks different after signing and at the end. 
Annotations/commenting doesn't
commit 9443942a9e9c5db3a3deeb76a36b33c7753e8c05
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Jul 21 21:25:26 2020 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Apr 11 13:43:58 2022 +0200

    external: update pdfium to handle redact annotations
    
    external: update pdfium to 4203
    
    (cherry picked from commit 4488be8a9279be0bd0aebd476589a49d2b95da6e)
    
    Update one mention of pdfium-4137.tar.bz2
    
    ...left behind by 4488be8a9279be0bd0aebd476589a49d2b95da6e "external: update
    pdfium to 4203"
    
    (cherry picked from commit ba4b3d5f7a0fe8d0d985e98897e041d59093d8b0)
    
    external: update pdfium to 4260
    
    (cherry picked from commit f19381e46930bb496e7331754843920933fb4be2)
    
    external: update pdfium to 4306
    
    (cherry picked from commit fe531957e3dcd42927cf15ab31d04473433d81f9)
    
    Conflicts:
            include/vcl/pdf/PDFAnnotationSubType.hxx
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105913
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    (cherry picked from commit b4f50e78e9cd391964128bd0d1446d4dca110cef)
    
    Change-Id: Ic10cf99fa412f8f0b3475e82d0a1839a7f04bd08

diff --git a/download.lst b/download.lst
index cec3e30ecf3c..9f2b42f205a7 100644
--- a/download.lst
+++ b/download.lst
@@ -200,8 +200,8 @@ export OWNCLOUD_ANDROID_LIB_SHA256SUM := 
b18b3e3ef7fae6a79b62f2bb43cc47a5346b633
 export OWNCLOUD_ANDROID_LIB_TARBALL := 
owncloud-android-library-0.9.4-no-binary-deps.tar.gz
 export PAGEMAKER_SHA256SUM := 
66adacd705a7d19895e08eac46d1e851332adf2e736c566bef1164e7a442519d
 export PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
-export PDFIUM_SHA256SUM := 
572460f7f9e2f86d022a9c6a82f1e2ded6c3c29ba352d4b9fac60b87e2159679
-export PDFIUM_TARBALL := pdfium-3550.tar.bz2
+export PDFIUM_SHA256SUM := 
eca406d47ac7e2a84dcc86f93c08f96e591d409589e881477fa75e488e4851d8
+export PDFIUM_TARBALL := pdfium-4306.tar.bz2
 export PIXMAN_SHA256SUM := 
21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz
 export LIBPNG_SHA256SUM := 
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
diff --git a/external/pdfium/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index f9a62bf75b46..3b37143c4599 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -20,13 +20,15 @@ $(eval $(call gb_Library_set_include,pdfium,\
 ))
 
 $(eval $(call gb_Library_add_defs,pdfium,\
-    -DPDFIUM_DLLIMPLEMENTATION \
+    -DFPDF_IMPLEMENTATION \
     -DUSE_SYSTEM_LCMS2 \
     -DUSE_SYSTEM_LIBJPEG \
     -DUSE_SYSTEM_ZLIB \
     -DUSE_SYSTEM_ICUUC \
     -DMEMORY_TOOL_REPLACES_ALLOCATOR \
     -DUNICODE \
+    -DWIN32_LEAN_AND_MEAN \
+    -DCOMPONENT_BUILD \
 ))
 
 # Don't show warnings upstream doesn't care about.
@@ -41,15 +43,12 @@ $(eval $(call 
gb_Library_set_generated_cxx_suffix,pdfium,cpp))
 
 # pdfium
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/cfx_systemhandler \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annot \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annothandlermgr \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_annotiteration \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannot \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_baannothandler \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_datetime \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_formfillenvironment \
-    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interform \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pageview \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widget \
     UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_widgethandler \
@@ -79,20 +78,21 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/fpdf_save \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_text \
     UnpackedTarball/pdfium/fpdfsdk/fpdf_view \
-    UnpackedTarball/pdfium/fpdfsdk/ipdfsdk_pauseadapter \
-    UnpackedTarball/pdfium/fpdfsdk/cpdf_annotcontext \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_pauseadapter \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_interactiveform \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_renderpage \
+    UnpackedTarball/pdfium/fpdfsdk/fpdf_signature \
 ))
 
 # fdrm
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt \
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt_aes \
-    UnpackedTarball/pdfium/core/fdrm/crypto/fx_crypt_sha \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt_aes \
+    UnpackedTarball/pdfium/core/fdrm/fx_crypt_sha \
 ))
 
 # formfiller
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/formfiller/cba_fontmap \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_checkbox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_combobox \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_formfiller \
@@ -103,6 +103,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_textfield \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_button \
     UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_textobject \
+    UnpackedTarball/pdfium/fpdfsdk/formfiller/cffl_privatedata \
 ))
 
 # fpdfapi
@@ -169,8 +170,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/UniKS-UTF16-H_0 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/cmaps_korea1 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/fpdf_cmaps \
-    UnpackedTarball/pdfium/core/fpdfapi/cpdf_modulemgr \
-    UnpackedTarball/pdfium/core/fpdfapi/cpdf_pagerendercontext \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cidfont \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_font \
@@ -185,7 +184,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_color \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_colorspace \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_colorstate \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmark \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmarks \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentmarkitem \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_contentparser \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_docpagedata \
@@ -200,7 +199,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pagemodule \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobject \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobjectholder \
-    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pageobjectlist \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_path \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pathobject \
     UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_pattern \
@@ -237,9 +235,8 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/fpdf_parser_utility \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_walker \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_read_validator \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_charposlist \
+    UnpackedTarball/pdfium/core/fpdfapi/render/charposlist \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_devicebuffer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibtransferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_docrenderdata \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imagecacheentry \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_imageloader \
@@ -251,12 +248,13 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_renderstatus \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_scaledrenderbuffer \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_textrenderer \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transferfunc \
     UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3cache \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphs \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_type3glyphmap \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendershading \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_rendertiling \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_creator \
-    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_encryptor \
-    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_flateencoder \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_encryptor \
+    UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_flateencoder \
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_cttgsubtable \
     UnpackedTarball/pdfium/core/fpdfapi/font/cfx_stockfontarray \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cid2unicodemap \
@@ -278,11 +276,17 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_page_object_avail \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_avail \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentmanager \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_transparency \
-    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_dibbase \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transparency \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_dib \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_object_stream \
     UnpackedTarball/pdfium/core/fpdfapi/parser/cpdf_cross_ref_table \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_stringarchivestream \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_occontext \
+    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_contentstream_write_utils \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_annotcontext \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_pagerendercontext \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfuncdib \
+    UnpackedTarball/pdfium/core/fpdfapi/page/cpdf_transferfunc \
 ))
 
 # fpdfdoc
@@ -290,7 +294,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cline \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_aaction \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_action \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_actionfields \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_annot \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_annotlist \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_apsettings \
@@ -298,18 +301,16 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_bookmarktree \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_defaultappearance \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_dest \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_docjsactions \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_filespec \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formcontrol \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_formfield \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_iconfit \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_interform \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_interactiveform \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_link \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_linklist \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_metadata \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_nametree \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_numbertree \
-    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_occontext \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_pagelabel \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_variabletext \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_viewerpreferences \
@@ -320,6 +321,9 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfdoc/ctypeset \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structelement \
     UnpackedTarball/pdfium/core/fpdfdoc/cpdf_structtree \
+    UnpackedTarball/pdfium/core/fpdfdoc/cba_fontmap \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_color_utils \
+    UnpackedTarball/pdfium/core/fpdfdoc/cpdf_icon \
 ))
 
 # fpdftext
@@ -332,7 +336,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # fxcodec
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fxcodec/codec/fx_codec \
+    UnpackedTarball/pdfium/core/fxcodec/fx_codec \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithDecoder \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_ArithIntDecoder \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_BitStream \
@@ -349,18 +353,20 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_Segment \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_SymbolDict \
     UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_TrdProc \
-    UnpackedTarball/pdfium/core/fxcodec/bmp/fx_bmp \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_scanlinedecoder \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gif \
-    UnpackedTarball/pdfium/core/fxcodec/gif/cfx_gifcontext \
     UnpackedTarball/pdfium/core/fxcodec/gif/cfx_lzwdecompressor \
-    UnpackedTarball/pdfium/core/fxcodec/codec/cfx_codec_memory \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_faxmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_iccmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jbig2module \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpxmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_jpegmodule \
-    UnpackedTarball/pdfium/core/fxcodec/codec/ccodec_flatemodule \
+    UnpackedTarball/pdfium/core/fxcodec/cfx_codec_memory \
+    UnpackedTarball/pdfium/core/fxcodec/fax/faxmodule \
+    UnpackedTarball/pdfium/core/fxcodec/scanlinedecoder \
+    UnpackedTarball/pdfium/core/fxcodec/jpeg/jpegmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/cjpx_decoder \
+    UnpackedTarball/pdfium/core/fxcodec/jpx/jpx_decode_utils \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/JBig2_DocumentContext \
+    UnpackedTarball/pdfium/core/fxcodec/basic/basicmodule \
+    UnpackedTarball/pdfium/core/fxcodec/flate/flatemodule \
+    UnpackedTarball/pdfium/core/fxcodec/icc/iccmodule \
+    UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_decoder \
+    UnpackedTarball/pdfium/core/fxcodec/jpeg/jpeg_common \
 ))
 
 # fxcrt
@@ -373,7 +379,6 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_memory \
     UnpackedTarball/pdfium/core/fxcrt/fx_stream \
     UnpackedTarball/pdfium/core/fxcrt/fx_system \
-    UnpackedTarball/pdfium/core/fxcrt/fx_ucddata \
     UnpackedTarball/pdfium/core/fxcrt/fx_unicode \
     UnpackedTarball/pdfium/core/fxcrt/xml/cfx_xmldocument \
     UnpackedTarball/pdfium/core/fxcrt/xml/cfx_xmlelement \
@@ -410,11 +415,13 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxcrt/fx_random \
     UnpackedTarball/pdfium/core/fxcrt/fx_string \
     UnpackedTarball/pdfium/core/fxcrt/widestring \
-    UnpackedTarball/pdfium/core/fxcrt/cfx_seekablemultistream \
     UnpackedTarball/pdfium/core/fxcrt/css/cfx_cssdata \
     UnpackedTarball/pdfium/core/fxcrt/fx_codepage \
+    UnpackedTarball/pdfium/core/fxcrt/fx_number \
     UnpackedTarball/pdfium/core/fxcrt/cfx_utf8encoder \
     UnpackedTarball/pdfium/core/fxcrt/cfx_readonlymemorystream \
+    UnpackedTarball/pdfium/core/fxcrt/observed_ptr \
+    UnpackedTarball/pdfium/core/fxcrt/string_data_template \
 ))
 
 # fxge
@@ -423,13 +430,13 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapstorer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibextractor \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibitmap \
-    UnpackedTarball/pdfium/core/fxge/dib/cfx_filtereddib \
+    UnpackedTarball/pdfium/core/fxge/cfx_drawutils \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagestretcher \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagetransformer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_scanlinecompositor \
     UnpackedTarball/pdfium/core/fxge/dib/cstretchengine \
-    UnpackedTarball/pdfium/core/fxge/dib/fx_dib_main \
+    UnpackedTarball/pdfium/core/fxge/dib/fx_dib \
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitDingbats \
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitFixed \
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitFixedBold \
@@ -451,7 +458,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/agg/fx_agg_driver \
     UnpackedTarball/pdfium/core/fxge/cfx_cliprgn \
     UnpackedTarball/pdfium/core/fxge/cfx_color \
-    UnpackedTarball/pdfium/core/fxge/cfx_facecache \
+    UnpackedTarball/pdfium/core/fxge/cfx_glyphcache \
     UnpackedTarball/pdfium/core/fxge/cfx_folderfontinfo \
     UnpackedTarball/pdfium/core/fxge/cfx_font \
     UnpackedTarball/pdfium/core/fxge/cfx_fontcache \
@@ -464,11 +471,14 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/cfx_renderdevice \
     UnpackedTarball/pdfium/core/fxge/cfx_substfont \
     UnpackedTarball/pdfium/core/fxge/cfx_unicodeencoding \
-    UnpackedTarball/pdfium/core/fxge/cttfontdesc \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_fontmap \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
-    UnpackedTarball/pdfium/core/fxge/fx_ge_text \
+    UnpackedTarball/pdfium/core/fxge/cfx_glyphbitmap \
+    UnpackedTarball/pdfium/core/fxge/scoped_font_transform \
+    UnpackedTarball/pdfium/core/fxge/text_glyph_pos \
+    UnpackedTarball/pdfium/core/fxge/fx_font \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibbase \
+    UnpackedTarball/pdfium/core/fxge/dib/cfx_cmyk_to_srgb \
+    UnpackedTarball/pdfium/core/fxge/text_char_pos \
+    UnpackedTarball/pdfium/core/fxge/cfx_face \
 ))
 
 # javascript, build with pdf_enable_v8 disabled.
@@ -480,21 +490,21 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # pwl
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_appstream \
+    UnpackedTarball/pdfium/fpdfsdk/cpdfsdk_appstream \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_button \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_caret \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_combo_box \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_ctrl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_edit_impl \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_font_map \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_icon \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_box \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_impl \
+    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_cbbutton \
+    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_cblistbox \
+    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_list_ctrl \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_scroll_bar \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_special_button \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_timer \
-    UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_timer_handler \
+    UnpackedTarball/pdfium/core/fxcrt/cfx_timer \
     UnpackedTarball/pdfium/fpdfsdk/pwl/cpwl_wnd \
 ))
 
@@ -539,6 +549,10 @@ $(eval $(call gb_Library_add_generated_cobjects,pdfium,\
     UnpackedTarball/pdfium/third_party/libopenjpeg20/sparse_array \
 ))
 
+$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
+    UnpackedTarball/pdfium/third_party/libopenjpeg20/opj_malloc \
+))
+
 # pdfium_base
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/address_space_randomization
 \
@@ -546,6 +560,13 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/spin_lock 
\
     
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_alloc
 \
     UnpackedTarball/pdfium/third_party/base/debug/alias \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/oom_callback
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_bucket
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_oom
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_page
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/partition_root_base
 \
+    
UnpackedTarball/pdfium/third_party/base/allocator/partition_allocator/random \
+    UnpackedTarball/pdfium/third_party/base/memory/aligned_memory \
 ))
 
 # skia_shared
@@ -565,7 +586,6 @@ ifneq (,$(filter LINUX ANDROID,$(OS)))
 $(eval $(call gb_Library_add_libs,pdfium,\
     -ldl \
     -lrt \
-    -lpthread \
 ))
 
 $(eval $(call gb_Library_use_external,pdfium,freetype))
@@ -619,23 +639,33 @@ ifeq ($(OS),WNT)
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/win32/cfx_psrenderer \
     UnpackedTarball/pdfium/core/fxge/win32/cpsoutput \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_device \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_dib \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_gdipext \
-    UnpackedTarball/pdfium/core/fxge/win32/fx_win32_print \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_device_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_display_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_plus_ext \
+    UnpackedTarball/pdfium/core/fxge/win32/cgdi_printer_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cps_printer_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/ctext_only_printer_driver \
+    UnpackedTarball/pdfium/core/fxge/win32/cwin32_platform \
+    UnpackedTarball/pdfium/core/fxge/cfx_windowsrenderdevice \
     UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \
+    UnpackedTarball/pdfium/third_party/base/win/win_util \
+    UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_windowsrenderdevice \
 ))
 
 $(eval $(call gb_Library_use_system_win32_libs,pdfium,\
     gdi32 \
 ))
+
+$(eval $(call gb_Library_add_defs,pdfium,\
+    -DWIN32 \
+))
 endif
 
 ifeq ($(OS),MACOSX)
 # fxge
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/apple/fx_apple_platform \
-    UnpackedTarball/pdfium/core/fxge/apple/fx_mac_imp \
+    UnpackedTarball/pdfium/core/fxge/apple/fx_mac_impl \
     UnpackedTarball/pdfium/core/fxge/apple/fx_quartz_device \
 ))
 
@@ -652,9 +682,16 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafont \
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiafontmgr \
     UnpackedTarball/pdfium/core/fxge/android/cfx_androidfontinfo \
-    UnpackedTarball/pdfium/core/fxge/android/fx_android_imp \
+    UnpackedTarball/pdfium/core/fxge/android/fx_android_impl \
     UnpackedTarball/pdfium/core/fxge/android/cfpf_skiapathfont \
 ))
 endif
 
+ifeq ($(OS),LINUX)
+# fxge
+$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
+    UnpackedTarball/pdfium/core/fxge/fx_ge_linux \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index aaaab0c25ac1..f4643376cee0 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -8,10 +8,12 @@
 #
 
 pdfium_patches :=
-pdfium_patches += visibility.patch.1
 pdfium_patches += ubsan.patch
 # Fixes build on our baseline.
 pdfium_patches += build.patch.1
+# Avoids Windows 8 build dependency.
+pdfium_patches += windows7.patch.1
+pdfium_patches += c++20-comparison.patch
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
@@ -36,7 +38,16 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\
     mv third_party/base/allocator/partition_allocator/page_allocator.cc 
third_party/base/allocator/partition_allocator/page_allocator.cpp && \
     mv third_party/base/allocator/partition_allocator/partition_alloc.cc 
third_party/base/allocator/partition_allocator/partition_alloc.cpp && \
     mv third_party/base/allocator/partition_allocator/spin_lock.cc 
third_party/base/allocator/partition_allocator/spin_lock.cpp && \
-       mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp \
+    mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp && \
+    mv third_party/base/allocator/partition_allocator/oom_callback.cc 
third_party/base/allocator/partition_allocator/oom_callback.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_bucket.cc 
third_party/base/allocator/partition_allocator/partition_bucket.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_oom.cc 
third_party/base/allocator/partition_allocator/partition_oom.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_page.cc 
third_party/base/allocator/partition_allocator/partition_page.cpp && \
+    mv third_party/base/allocator/partition_allocator/partition_root_base.cc 
third_party/base/allocator/partition_allocator/partition_root_base.cpp && \
+    mv third_party/base/allocator/partition_allocator/random.cc 
third_party/base/allocator/partition_allocator/random.cpp && \
+    mv third_party/base/memory/aligned_memory.cc 
third_party/base/memory/aligned_memory.cpp && \
+    mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \
+    mv third_party/libopenjpeg20/opj_malloc.cc 
third_party/libopenjpeg20/opj_malloc.cpp \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 721c1784719d..7cf1021938f5 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -1,24 +1,3 @@
-diff --git a/core/fxge/dib/cfx_imagetransformer.cpp 
b/core/fxge/dib/cfx_imagetransformer.cpp
-index 8e01127b0..f4ce4d915 100644
---- a/core/fxge/dib/cfx_imagetransformer.cpp
-+++ b/core/fxge/dib/cfx_imagetransformer.cpp
-@@ -315,14 +315,14 @@ bool CFX_ImageTransformer::Continue(IFX_PauseIndicator* 
pPause) {
-   } else if (pDestMask) {
-     CalcData cdata = {
-         pDestMask.Get(), result2stretch, pSrcMaskBuf,
--        m_Storer.GetBitmap()->m_pAlphaMask->GetPitch(),
-+        static_cast<uint32_t>(m_Storer.GetBitmap()->m_pAlphaMask->GetPitch()),
-     };
-     CalcMask(cdata);
-   }
- 
-   CalcData cdata = {pTransformed.Get(), result2stretch,
-                     m_Storer.GetBitmap()->GetBuffer(),
--                    m_Storer.GetBitmap()->GetPitch()};
-+                    static_cast<uint32_t>(m_Storer.GetBitmap()->GetPitch())};
-   if (m_Storer.GetBitmap()->IsAlphaMask()) {
-     CalcAlpha(cdata);
-   } else {
 diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
 index 323de4ffc..f11a0b0ad 100644
 --- a/core/fpdfdoc/cpdf_metadata.cpp
@@ -32,38 +11,6 @@ index 323de4ffc..f11a0b0ad 100644
  
    std::vector<UnsupportedFeature> unsupported;
    CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
-diff --git a/fpdfsdk/cpdf_annotcontext.cpp b/fpdfsdk/cpdf_annotcontext.cpp
-index 20c5fc343..a40cd1eae 100644
---- a/fpdfsdk/cpdf_annotcontext.cpp
-+++ b/fpdfsdk/cpdf_annotcontext.cpp
-@@ -16,12 +16,12 @@ CPDF_AnnotContext::CPDF_AnnotContext(CPDF_Dictionary* 
pAnnotDict,
-                                      CPDF_Page* pPage,
-                                      CPDF_Stream* pStream)
-     : m_pAnnotDict(pAnnotDict), m_pPage(pPage) {
--  SetForm(pStream);
-+  SetForm_(pStream);
- }
- 
- CPDF_AnnotContext::~CPDF_AnnotContext() = default;
- 
--void CPDF_AnnotContext::SetForm(CPDF_Stream* pStream) {
-+void CPDF_AnnotContext::SetForm_(CPDF_Stream* pStream) {
-   if (!pStream)
-     return;
- 
-diff --git a/fpdfsdk/cpdf_annotcontext.h b/fpdfsdk/cpdf_annotcontext.h
-index 38cc91e03..7904ae044 100644
---- a/fpdfsdk/cpdf_annotcontext.h
-+++ b/fpdfsdk/cpdf_annotcontext.h
-@@ -23,7 +23,7 @@ class CPDF_AnnotContext {
-                     CPDF_Stream* pStream);
-   ~CPDF_AnnotContext();
- 
--  void SetForm(CPDF_Stream* pStream);
-+  void SetForm_(CPDF_Stream* pStream);
-   bool HasForm() const { return !!m_pAnnotForm; }
-   CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }
-   CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict.Get(); }
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..f71c362e2 100644
 --- a/third_party/base/span.h
@@ -77,37 +24,6 @@ index 0fb627ba8..f71c362e2 100644
    span& operator=(const span& other) noexcept = default;
    ~span() noexcept {
      if (!size_) {
-diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
-index d3bf38d31..e8aea9707 100644
---- a/fpdfsdk/fpdf_annot.cpp
-+++ b/fpdfsdk/fpdf_annot.cpp
-@@ -389,7 +389,7 @@ FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, 
FPDF_PAGEOBJECT obj) {
- 
-   // Get the annotation's corresponding form object for parsing its AP stream.
-   if (!pAnnot->HasForm())
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
- 
-   // Check that the object did not come from the same annotation. If this 
check
-   // succeeds, then it is assumed that the object came from
-@@ -425,7 +425,7 @@ FPDF_EXPORT int FPDF_CALLCONV 
FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot) {
-     if (!pStream)
-       return 0;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
-   return pdfium::CollectionSize<int>(*pAnnot->GetForm()->GetPageObjectList());
- }
-@@ -442,7 +442,7 @@ FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index) {
-     if (!pStream)
-       return nullptr;
- 
--    pAnnot->SetForm(pStream);
-+    pAnnot->SetForm_(pStream);
-   }
- 
-   return FPDFPageObjectFromCPDFPageObject(
 diff --git a/third_party/base/span.h b/third_party/base/span.h
 index 0fb627ba8..dda1fc8bc 100644
 --- a/third_party/base/span.h
@@ -121,29 +37,14 @@ index 0fb627ba8..dda1fc8bc 100644
        : span(container.data(), container.size()) {}
    template <
        typename Container,
-diff --git a/core/fpdfdoc/cpdf_dest.h b/core/fpdfdoc/cpdf_dest.h
-index 7f4eb86c0..5e227f86e 100644
---- a/core/fpdfdoc/cpdf_dest.h
-+++ b/core/fpdfdoc/cpdf_dest.h
-@@ -41,7 +41,7 @@
-               float* pZoom) const;
- 
-  private:
--  UnownedPtr<const CPDF_Array> const m_pArray;
-+  UnownedPtr<const CPDF_Array> m_pArray;
- };
- 
- #endif  // CORE_FPDFDOC_CPDF_DEST_H_
-diff --git a/core/fpdfdoc/cpdf_filespec.h b/core/fpdfdoc/cpdf_filespec.h
-index 7050f695b..916afed8b 100644
---- a/core/fpdfdoc/cpdf_filespec.h
-+++ b/core/fpdfdoc/cpdf_filespec.h
-@@ -41,7 +41,7 @@ class CPDF_FileSpec {
- 
-  private:
-   UnownedPtr<const CPDF_Object> const m_pObj;
--  UnownedPtr<CPDF_Object> const m_pWritableObj;
-+  UnownedPtr<CPDF_Object> m_pWritableObj;
- };
+--- a/core/fxcodec/jpx/cjpx_decoder.cpp
++++ b/core/fxcodec/jpx/cjpx_decoder.cpp
+@@ -70,7 +70,7 @@ Optional<OpjImageRgbData> alloc_rgb(size_t size) {
+   if (!data.b)
+     return {};
+ 
+-  return data;
++  return std::move(data);
+ }
  
- #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
+ void sycc_to_rgb(int offset,
diff --git a/external/pdfium/c++20-comparison.patch 
b/external/pdfium/c++20-comparison.patch
new file mode 100644
index 000000000000..025f9ba010db
--- /dev/null
+++ b/external/pdfium/c++20-comparison.patch
@@ -0,0 +1,13 @@
+--- core/fxcrt/fx_memory_wrappers.h
++++ core/fxcrt/fx_memory_wrappers.h
+@@ -70,8 +70,8 @@
+   }
+ 
+   // There's no state, so they are all the same,
+-  bool operator==(const FxAllocAllocator& that) { return true; }
+-  bool operator!=(const FxAllocAllocator& that) { return false; }
++  bool operator==(const FxAllocAllocator& that) const { return true; }
++  bool operator!=(const FxAllocAllocator& that) const { return false; }
+ };
+ 
+ #endif  // CORE_FXCRT_FX_MEMORY_WRAPPERS_H_
diff --git a/external/pdfium/configs/build_config.h 
b/external/pdfium/configs/build_config.h
index edd70af53034..ec93c278767c 100644
--- a/external/pdfium/configs/build_config.h
+++ b/external/pdfium/configs/build_config.h
@@ -6,7 +6,7 @@
 
 // This file adds defines about the platform we're currently building on.
 //  Operating System:
-//    OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
+//    OS_WIN / OS_APPLE / OS_LINUX / OS_POSIX (MACOSX or LINUX)
 //  Compiler:
 //    COMPILER_MSVC / COMPILER_GCC
 //  Processor:
@@ -21,7 +21,7 @@
 #define OS_ANDROID 1
 #define OS_LINUX 1
 #elif defined(__APPLE__)
-#define OS_MACOSX 1
+#define OS_APPLE 1
 #elif defined(__linux__)
 #define OS_LINUX 1
 #elif defined(__DragonFly__)
@@ -48,7 +48,7 @@
 
 // For access to standard POSIX features, use OS_POSIX instead of a more
 // specific macro.
-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || 
defined(OS_SOLARIS)
+#if defined(OS_APPLE) || defined(OS_LINUX) || defined(OS_BSD) || 
defined(OS_SOLARIS)
 #define OS_POSIX 1
 #endif
 
diff --git a/external/pdfium/msvc2015.patch.1 b/external/pdfium/msvc2015.patch.1
new file mode 100644
index 000000000000..36cb5332c7b0
--- /dev/null
+++ b/external/pdfium/msvc2015.patch.1
@@ -0,0 +1,202 @@
+Fix MSVC 2015 build
+
+--- pdfium/third_party/base/optional.h.orig    2020-10-26 19:26:04.000000000 
+0100
++++ pdfium/third_party/base/optional.h 2020-12-03 16:00:54.879883100 +0100
+@@ -36,7 +36,7 @@
+ struct OptionalStorageBase {
+   // Provide non-defaulted default ctor to make sure it's not deleted by
+   // non-trivial T::T() in the union.
+-  constexpr OptionalStorageBase() : dummy_() {}
++  OptionalStorageBase() : dummy_() {}
+ 
+   template <class... Args>
+   constexpr explicit OptionalStorageBase(in_place_t, Args&&... args)
+@@ -88,7 +88,7 @@
+ struct OptionalStorageBase<T, true /* trivially destructible */> {
+   // Provide non-defaulted default ctor to make sure it's not deleted by
+   // non-trivial T::T() in the union.
+-  constexpr OptionalStorageBase() : dummy_() {}
++  OptionalStorageBase() : dummy_() {}
+ 
+   template <class... Args>
+   constexpr explicit OptionalStorageBase(in_place_t, Args&&... args)
+@@ -607,32 +607,32 @@
+     return *this;
+   }
+ 
+-  constexpr const T* operator->() const {
++  const T* operator->() const {
+     CHECK(storage_.is_populated_);
+     return &storage_.value_;
+   }
+ 
+-  constexpr T* operator->() {
++  T* operator->() {
+     CHECK(storage_.is_populated_);
+     return &storage_.value_;
+   }
+ 
+-  constexpr const T& operator*() const & {
++  const T& operator*() const & {
+     CHECK(storage_.is_populated_);
+     return storage_.value_;
+   }
+ 
+-  constexpr T& operator*() & {
++  T& operator*() & {
+     CHECK(storage_.is_populated_);
+     return storage_.value_;
+   }
+ 
+-  constexpr const T&& operator*() const && {
++  const T&& operator*() const && {
+     CHECK(storage_.is_populated_);
+     return std::move(storage_.value_);
+   }
+ 
+-  constexpr T&& operator*() && {
++  T&& operator*() && {
+     CHECK(storage_.is_populated_);
+     return std::move(storage_.value_);
+   }
+@@ -641,22 +641,22 @@
+ 
+   constexpr bool has_value() const { return storage_.is_populated_; }
+ 
+-  constexpr T& value() & {
++  T& value() & {
+     CHECK(storage_.is_populated_);
+     return storage_.value_;
+   }
+ 
+-  constexpr const T& value() const & {
++  const T& value() const & {
+     CHECK(storage_.is_populated_);
+     return storage_.value_;
+   }
+ 
+-  constexpr T&& value() && {
++  T&& value() && {
+     CHECK(storage_.is_populated_);
+     return std::move(storage_.value_);
+   }
+ 
+-  constexpr const T&& value() const && {
++  const T&& value() const && {
+     CHECK(storage_.is_populated_);
+     return std::move(storage_.value_);
+   }
+--- pdfium/third_party/base/span.h.orig        2020-10-26 19:26:04.000000000 
+0100
++++ pdfium/third_party/base/span.h     2020-12-03 16:28:15.642138100 +0100
+@@ -193,7 +193,7 @@
+ 
+   // TODO(dcheng): Implement construction from a |begin| and |end| pointer.
+   template <size_t N>
+-  constexpr span(T (&array)[N]) noexcept : span(array, N) {}
++  span(T (&array)[N]) noexcept : span(array, N) {}
+   // TODO(dcheng): Implement construction from std::array.
+   // Conversion from a container that provides |T* data()| and |integral_type
+   // size()|.
+--- pdfium/core/fpdfapi/page/cpdf_colorspace.cpp.orig  2020-12-03 
16:54:15.514659400 +0100
++++ pdfium/core/fpdfapi/page/cpdf_colorspace.cpp       2020-12-03 
16:38:52.167650200 +0100
+@@ -905,7 +905,7 @@
+     float R;
+     float G;
+     float B;
+-    GetRGB(lab, &R, &G, &B);
++    GetRGB(pdfium::span<float>(lab), &R, &G, &B);
+     pDestBuf[0] = static_cast<int32_t>(B * 255);
+     pDestBuf[1] = static_cast<int32_t>(G * 255);
+     pDestBuf[2] = static_cast<int32_t>(R * 255);
+--- pdfium/core/fpdfapi/page/cpdf_meshstream.cpp.orig  2020-12-03 
16:54:09.233498800 +0100
++++ pdfium/core/fpdfapi/page/cpdf_meshstream.cpp       2020-12-03 
16:41:29.173766500 +0100
+@@ -209,7 +209,7 @@
+       func->Call(color_value, 1, result, &nResults);
+   }
+ 
+-  m_pCS->GetRGB(result, &r, &g, &b);
++  m_pCS->GetRGB(pdfium::span<float>(result), &r, &g, &b);
+   return std::tuple<float, float, float>(r, g, b);
+ }
+ 
+--- pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp.orig  2020-12-03 
16:53:56.077095400 +0100
++++ pdfium/core/fpdfapi/parser/cpdf_security_handler.cpp       2020-12-03 
16:44:23.951334200 +0100
+@@ -481,7 +481,7 @@
+   uint8_t passcode[32];
+   GetPassCode(owner_password, passcode);
+   uint8_t digest[16];
+-  CRYPT_MD5Generate(passcode, digest);
++  CRYPT_MD5Generate(pdfium::span<uint8_t>(passcode), digest);
+   if (m_Revision >= 3) {
+     for (uint32_t i = 0; i < 50; i++)
+       CRYPT_MD5Generate(digest, digest);
+@@ -570,10 +570,10 @@
+     uint8_t passcode[32];
+     GetPassCode(owner_password_copy, passcode);
+     uint8_t digest[16];
+-    CRYPT_MD5Generate(passcode, digest);
++    CRYPT_MD5Generate(pdfium::span<uint8_t>(passcode), digest);
+     if (m_Revision >= 3) {
+       for (uint32_t i = 0; i < 50; i++)
+-        CRYPT_MD5Generate(digest, digest);
++        CRYPT_MD5Generate(pdfium::span<uint8_t>(digest), digest);
+     }
+     uint8_t enckey[32];
+     memcpy(enckey, digest, key_len);
+--- pdfium/core/fpdfapi/page/cpdf_dib.cpp.orig 2020-12-03 16:53:44.548444600 
+0100
++++ pdfium/core/fpdfapi/page/cpdf_dib.cpp      2020-12-03 16:49:11.937584700 
+0100
+@@ -874,7 +874,7 @@
+     color_values[0] += m_CompData[0].m_DecodeStep;
+     color_values[1] += m_CompData[0].m_DecodeStep;
+     color_values[2] += m_CompData[0].m_DecodeStep;
+-    m_pColorSpace->GetRGB(color_values, &R, &G, &B);
++    m_pColorSpace->GetRGB(pdfium::span<float>(color_values), &R, &G, &B);
+     FX_ARGB argb1 = ArgbEncode(255, FXSYS_roundf(R * 255),
+                                FXSYS_roundf(G * 255), FXSYS_roundf(B * 255));
+     if (argb0 != 0xFF000000 || argb1 != 0xFFFFFFFF) {
+--- 
pdfium/third_party/base/allocator/partition_allocator/partition_alloc.cc.orig   
   2020-12-03 17:09:02.887283800 +0100
++++ pdfium/third_party/base/allocator/partition_allocator/partition_alloc.cc   
2020-12-03 17:07:22.198993800 +0100
+@@ -67,12 +67,12 @@
+   // Chained hooks are not supported. Registering a non-null hook when a
+   // non-null hook is already registered indicates somebody is trying to
+   // overwrite a hook.
+-  CHECK((!allocation_observer_hook_ && !free_observer_hook_) ||
++  CHECK((!allocation_observer_hook_.load() && !free_observer_hook_.load()) ||
+         (!alloc_hook && !free_hook));
+   allocation_observer_hook_ = alloc_hook;
+   free_observer_hook_ = free_hook;
+ 
+-  hooks_enabled_ = allocation_observer_hook_ || allocation_override_hook_;
++  hooks_enabled_ = allocation_observer_hook_.load() || 
allocation_override_hook_.load();
+ }
+ 
+ void PartitionAllocHooks::SetOverrideHooks(AllocationOverrideHook* alloc_hook,
+@@ -80,14 +80,14 @@
+                                            ReallocOverrideHook realloc_hook) {
+   subtle::SpinLock::Guard guard(set_hooks_lock_);
+ 
+-  CHECK((!allocation_override_hook_ && !free_override_hook_ &&
+-         !realloc_override_hook_) ||
++  CHECK((!allocation_override_hook_.load() && !free_override_hook_.load() &&
++         !realloc_override_hook_.load()) ||
+         (!alloc_hook && !free_hook && !realloc_hook));
+   allocation_override_hook_ = alloc_hook;
+   free_override_hook_ = free_hook;
+   realloc_override_hook_ = realloc_hook;
+ 
+-  hooks_enabled_ = allocation_observer_hook_ || allocation_override_hook_;
++  hooks_enabled_ = allocation_observer_hook_.load() || 
allocation_override_hook_.load();
+ }
+ 
+ void PartitionAllocHooks::AllocationObserverHookIfEnabled(
+--- 
pdfium/third_party/base/allocator/partition_allocator/partition_page.h.orig     
   2020-12-03 17:13:56.944624000 +0100
++++ pdfium/third_party/base/allocator/partition_allocator/partition_page.h     
2020-12-03 17:13:34.385932300 +0100
+@@ -25,6 +25,8 @@
+ struct DeferredUnmap {
+   void* ptr = nullptr;
+   size_t size = 0;
++  DeferredUnmap(void* const p, size_t const s) : ptr(p), size(s) {}
++  DeferredUnmap() = default;
+   // In most cases there is no page to unmap and ptr == nullptr. This function
+   // is inlined to avoid the overhead of a function call in the common case.
+   ALWAYS_INLINE void Run();
diff --git a/external/pdfium/ubsan.patch b/external/pdfium/ubsan.patch
index 91428326fc5d..8610e24f2828 100644
--- a/external/pdfium/ubsan.patch
+++ b/external/pdfium/ubsan.patch
@@ -1,18 +1,18 @@
---- core/fxcrt/string_data_template.h
-+++ core/fxcrt/string_data_template.h
-@@ -78,7 +78,8 @@
+--- core/fxcrt/string_data_template.cpp
++++ core/fxcrt/string_data_template.cpp
+@@ -82,7 +82,8 @@ void StringDataTemplate<CharType>::CopyContentsAt(size_t 
offset,
+   ASSERT(nLen >= 0);
+   ASSERT(offset + nLen <= m_nAllocLength);
  
-   void CopyContentsAt(size_t offset, const CharType* pStr, size_t nLen) {
-     ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength);
--    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
-+    if (nLen != 0)
-+      memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
-     m_String[offset + nLen] = 0;
-   }
+-  memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
++  if (nLen != 0)
++    memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
+   m_String[offset + nLen] = 0;
+ }
  
---- core/fxge/cfx_facecache.cpp
-+++ core/fxge/cfx_facecache.cpp
-@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> 
CFX_FaceCache::RenderGlyph(
+--- core/fxge/cfx_glyphcache.cpp
++++ core/fxge/cfx_glyphcache.cpp
+@@ -183,7 +183,8 @@ std::unique_ptr<CFX_GlyphBitmap> 
CFX_GlyphCache::RenderGlyph(
        }
      }
    } else {
diff --git a/external/pdfium/visibility.patch.1 
b/external/pdfium/visibility.patch.1
deleted file mode 100644
index 04e89b38ab10..000000000000
--- a/external/pdfium/visibility.patch.1
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/public/fpdfview.h b/public/fpdfview.h
-index 1ff0aeb26..f48036f2b 100644
---- a/public/fpdfview.h
-+++ b/public/fpdfview.h
-@@ -129,14 +129,20 @@ typedef int FPDF_ANNOTATION_SUBTYPE;
- // Dictionary value types.
- typedef int FPDF_OBJECT_TYPE;
- 
--#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
--// On Windows system, functions are exported in a DLL
-+#if defined(PDFIUM_DLLIMPLEMENTATION)
-+#ifdef _WIN32
- #define FPDF_EXPORT __declspec(dllexport)
--#define FPDF_CALLCONV __stdcall
- #else
--#define FPDF_EXPORT
--#define FPDF_CALLCONV
-+#define FPDF_EXPORT __attribute__ ((visibility("default")))
-+#endif
-+#else
-+#ifdef _WIN32
-+#define FPDF_EXPORT __declspec(dllimport)
-+#else
-+#define FPDF_EXPORT __attribute__ ((visibility("default")))
- #endif
-+#endif
-+#define FPDF_CALLCONV
- 
- // Exported Functions
- #ifdef __cplusplus
diff --git a/external/pdfium/windows7.patch.1 b/external/pdfium/windows7.patch.1
new file mode 100644
index 000000000000..d33f273ff4ca
--- /dev/null
+++ b/external/pdfium/windows7.patch.1
@@ -0,0 +1,34 @@
+diff --git a/third_party/base/win/win_util.cc 
b/third_party/base/win/win_util.cc
+index ae2dba84d..7a3718848 100644
+--- a/third_party/base/win/win_util.cc
++++ b/third_party/base/win/win_util.cc
+@@ -12,28 +12,7 @@ namespace base {
+ namespace win {
+ 
+ bool IsUser32AndGdi32Available() {
+-  static auto is_user32_and_gdi32_available = []() {
+-    // If win32k syscalls aren't disabled, then user32 and gdi32 are 
available.
+-
+-    typedef decltype(
+-        GetProcessMitigationPolicy)* GetProcessMitigationPolicyType;
+-    GetProcessMitigationPolicyType get_process_mitigation_policy_func =
+-        reinterpret_cast<GetProcessMitigationPolicyType>(GetProcAddress(
+-            GetModuleHandle(L"kernel32.dll"), "GetProcessMitigationPolicy"));
+-
+-    if (!get_process_mitigation_policy_func)
+-      return true;
+-
+-    PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY policy = {};
+-    if (get_process_mitigation_policy_func(GetCurrentProcess(),
+-                                           ProcessSystemCallDisablePolicy,
+-                                           &policy, sizeof(policy))) {
+-      return policy.DisallowWin32kSystemCalls == 0;
+-    }
+-
+-    return true;
+-  }();
+-  return is_user32_and_gdi32_available;
++  return true;
+ }
+ 
+ }  // namespace win
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 0a26b353e3bf..a211b4e3291f 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -54,10 +54,10 @@
                     "type": "shell"
                 },
                 {
-                    "url": 
"https://dev-www.libreoffice.org/src/pdfium-3550.tar.bz2";,
-                    "sha256": 
"572460f7f9e2f86d022a9c6a82f1e2ded6c3c29ba352d4b9fac60b87e2159679",
+                    "url": 
"https://dev-www.libreoffice.org/src/pdfium-4306.tar.bz2";,
+                    "sha256": 
"eca406d47ac7e2a84dcc86f93c08f96e591d409589e881477fa75e488e4851d8",
                     "type": "file",
-                    "dest-filename": "external/tarballs/pdfium-3550.tar.bz2"
+                    "dest-filename": "external/tarballs/pdfium-4306.tar.bz2"
                 },
                 {
                     "url": 
"https://dev-www.libreoffice.org/src/0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz";,
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 881880255f90..3d46fcdd55fc 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -218,7 +218,7 @@ void ImpSdrPdfImport::DoObjects(SvdProgressInfo* 
pProgrInfo, sal_uInt32* pAction
         // Load the page text to extract it when we get text elements.
         FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage);
 
-        const int nPageObjectCount = FPDFPage_CountObject(pPdfPage);
+        const int nPageObjectCount = FPDFPage_CountObjects(pPdfPage);
         if (pProgrInfo)
             pProgrInfo->SetActionCount(nPageObjectCount);
 
@@ -767,9 +767,9 @@ void ImpSdrPdfImport::ImportForm(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     // Get the form matrix to perform correct translation/scaling of the form 
sub-objects.
     const Matrix aOldMatrix = mCurMatrix;
 
-    double a, b, c, d, e, f;
-    FPDFFormObj_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
-    mCurMatrix = Matrix(a, b, c, d, e, f);
+    FS_MATRIX matrix;
+    FPDFFormObj_GetMatrix(pPageObject, &matrix);
+    mCurMatrix = Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, 
matrix.f);
 
     const int nCount = FPDFFormObj_CountObjects(pPageObject);
     for (int nIndex = 0; nIndex < nCount; ++nIndex)
@@ -797,8 +797,8 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     if (left == right || top == bottom)
         return;
 
-    double a, b, c, d, e, f;
-    FPDFText_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
+    FS_MATRIX matrix;
+    FPDFTextObj_GetMatrix(pPageObject, &matrix);
     Matrix aTextMatrix(mCurMatrix);
 
     aTextMatrix.Transform(left, right, top, bottom);
@@ -816,8 +816,8 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     OUString sText(pText.get(), nActualChars);
 
     const double dFontSize = FPDFTextObj_GetFontSize(pPageObject);
-    double dFontSizeH = fabs(sqrt2(a, c) * dFontSize);
-    double dFontSizeV = fabs(sqrt2(b, d) * dFontSize);
+    double dFontSizeH = fabs(sqrt2(matrix.a, matrix.c) * dFontSize);
+    double dFontSizeV = fabs(sqrt2(matrix.b, matrix.d) * dFontSize);
     dFontSizeH = lcl_PointToPixel(dFontSizeH);
     dFontSizeV = lcl_PointToPixel(dFontSizeV);
     dFontSizeH = lcl_ToLogic(dFontSizeH);
@@ -850,7 +850,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
     Color aTextColor(COL_TRANSPARENT);
     bool bFill = false;
     bool bUse = true;
-    switch (FPDFText_GetTextRenderMode(pPageObject))
+    switch (FPDFTextObj_GetTextRenderMode(pPageObject))
     {
         case FPDF_TEXTRENDERMODE_FILL:
         case FPDF_TEXTRENDERMODE_FILL_CLIP:
@@ -860,6 +860,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT 
pPageObject, FPDF_TEXTPAGE pTex
             break;
         case FPDF_TEXTRENDERMODE_STROKE:
         case FPDF_TEXTRENDERMODE_STROKE_CLIP:
+        case FPDF_TEXTRENDERMODE_UNKNOWN:
             break;
         case FPDF_TEXTRENDERMODE_INVISIBLE:
         case FPDF_TEXTRENDERMODE_CLIP:
@@ -939,7 +940,7 @@ void ImpSdrPdfImport::ImportText(const Point& rPos, const 
Size& rSize, const OUS
     if (nAngle)
     {
         nAngle *= 10;
-        double a = nAngle * nPi180;
+        double a = nAngle * F_PI18000;
         double nSin = sin(a);
         double nCos = cos(a);
         pText->NbcRotate(aPos, nAngle, nSin, nCos);
@@ -1032,9 +1033,9 @@ void ImpSdrPdfImport::ImportImage(FPDF_PAGEOBJECT 
pPageObject, int /*nPageObject
 
 void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int 
/*nPageObjectIndex*/)
 {
-    double a, b, c, d, e, f;
-    FPDFPath_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
-    Matrix aPathMatrix(a, b, c, d, e, f);
+    FS_MATRIX matrix;
+    FPDFPath_GetMatrix(pPageObject, &matrix);
+    Matrix aPathMatrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, 
matrix.f);
     aPathMatrix.Concatinate(mCurMatrix);
 
     basegfx::B2DPolyPolygon aPolyPoly;
@@ -1137,12 +1138,12 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT 
pPageObject, int /*nPageObjectI
     unsigned int nG;
     unsigned int nB;
     unsigned int nA;
-    FPDFPath_GetFillColor(pPageObject, &nR, &nG, &nB, &nA);
+    FPDFPageObj_GetFillColor(pPageObject, &nR, &nG, &nB, &nA);
     mpVD->SetFillColor(Color(nR, nG, nB));
 
     if (bStroke)
     {
-        FPDFPath_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
+        FPDFPageObj_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
         mpVD->SetLineColor(Color(nR, nG, nB));
     }
     else

Reply via email to