[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 3 commits - include/vcl svx/source vcl/Library_vcl.mk vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 30 13:25:15 UTC 2020
include/vcl/VectorGraphicSearch.hxx | 3
include/vcl/filter/PDFiumLibrary.hxx | 43 +++++++++
svx/source/svdraw/svdpdf.cxx | 14 ---
svx/source/svdraw/svdpdf.hxx | 4
vcl/Library_vcl.mk | 1
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 12 --
vcl/source/filter/ipdf/pdfread.cxx | 26 +----
vcl/source/graphic/VectorGraphicSearch.cxx | 128 +++++++++++++++++++----------
vcl/source/pdf/PDFiumLibrary.cxx | 36 ++++++++
9 files changed, 182 insertions(+), 85 deletions(-)
New commits:
commit 8ced05ba5557c66f3d38155b65fabac7dddd321b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 12:13:59 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Jul 30 15:24:22 2020 +0200
vcl: use HAVE_FEATURE_PDFIUM in VectorGraphicSearch impl.
Change-Id: Id6c30e8f1c5bdb0481b0c7d4680554e3e8caa323
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95393
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 67f7a26c047ae2878e3ecd76f83af3941b9079c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95935
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 8c0776fb005cb99a1f8e289f26173bec9c246585)
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 911c19cebd38..a719329b7708 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -10,6 +10,10 @@
#include <vcl/VectorGraphicSearch.hxx>
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
+
#include <vcl/filter/PDFiumLibrary.hxx>
#include <sal/config.h>
@@ -289,4 +293,45 @@ std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
return std::vector<basegfx::B2DRectangle>();
}
+#else // !HAVE_FEATURE_PDFIUM
+
+class VectorGraphicSearch::Implementation
+{
+};
+
+VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
+ : maGraphic(rGraphic)
+{
+}
+
+VectorGraphicSearch::~VectorGraphicSearch() {}
+
+bool VectorGraphicSearch::search(OUString const& /*rSearchString*/,
+ SearchStartPosition /*eStartPosition*/)
+{
+ return false;
+}
+
+bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& /*rData*/,
+ OUString const& /*rSearchString*/,
+ SearchStartPosition /*eStartPosition*/)
+{
+ return false;
+}
+
+basegfx::B2DSize VectorGraphicSearch::pageSize() { return basegfx::B2DSize(); }
+
+bool VectorGraphicSearch::next() { return false; }
+
+bool VectorGraphicSearch::previous() { return false; }
+
+int VectorGraphicSearch::index() { return -1; }
+
+std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
+{
+ return std::vector<basegfx::B2DRectangle>();
+}
+
+#endif // HAVE_FEATURE_PDFIUM
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 272cd803e4b63eeca1e6689f5c6147141a365ccb
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 12:02:39 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Jul 30 15:24:11 2020 +0200
vcl: VectorGraphicSearch - move SearchContext into Implementation
Change-Id: I3bbf085fd8b8b66a56e364168c1e70b4ce986467
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95392
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 978198a055972aff00f47b70ca79e6322a5fbac3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95934
(cherry picked from commit 044cfb405e44c5df25bccd6e421a1a228262a963)
diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index b67c63a844d8..2dc8cca3b76a 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -19,8 +19,6 @@
#include <memory>
-class SearchContext;
-
enum class SearchStartPosition
{
Begin,
@@ -33,7 +31,6 @@ private:
class Implementation;
std::unique_ptr<Implementation> mpImplementation;
Graphic maGraphic;
- std::unique_ptr<SearchContext> mpSearchContext;
bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString,
SearchStartPosition eStartPosition);
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 5c4022685f71..911c19cebd38 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -17,25 +17,8 @@
#include <fpdf_doc.h>
#include <fpdf_text.h>
-class VectorGraphicSearch::Implementation
+namespace
{
-public:
- std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
- FPDF_DOCUMENT mpPdfDocument;
-
- Implementation()
- : mpPDFium(vcl::pdf::PDFiumLibrary::get())
- , mpPdfDocument(nullptr)
- {
- }
-
- ~Implementation()
- {
- if (mpPdfDocument)
- FPDF_CloseDocument(mpPdfDocument);
- }
-};
-
class SearchContext
{
private:
@@ -181,17 +164,38 @@ public:
}
};
+} // end anonymous namespace
+
+class VectorGraphicSearch::Implementation
+{
+public:
+ std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
+ FPDF_DOCUMENT mpPdfDocument;
+
+ std::unique_ptr<SearchContext> mpSearchContext;
+
+ Implementation()
+ : mpPDFium(vcl::pdf::PDFiumLibrary::get())
+ , mpPdfDocument(nullptr)
+ {
+ }
+
+ ~Implementation()
+ {
+ mpSearchContext.reset();
+
+ if (mpPdfDocument)
+ FPDF_CloseDocument(mpPdfDocument);
+ }
+};
+
VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
: mpImplementation(std::make_unique<VectorGraphicSearch::Implementation>())
, maGraphic(rGraphic)
{
}
-VectorGraphicSearch::~VectorGraphicSearch()
-{
- mpSearchContext.reset();
- mpImplementation.reset();
-}
+VectorGraphicSearch::~VectorGraphicSearch() { mpImplementation.reset(); }
bool VectorGraphicSearch::search(OUString const& rSearchString, SearchStartPosition eStartPosition)
{
@@ -242,45 +246,45 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
sal_Int32 nPageIndex = std::max(rData->getPageIndex(), sal_Int32(0));
- mpSearchContext.reset(new SearchContext(mpImplementation->mpPdfDocument, nPageIndex,
- rSearchString, eStartPosition));
+ mpImplementation->mpSearchContext.reset(new SearchContext(
+ mpImplementation->mpPdfDocument, nPageIndex, rSearchString, eStartPosition));
- return mpSearchContext->initialize();
+ return mpImplementation->mpSearchContext->initialize();
}
basegfx::B2DSize VectorGraphicSearch::pageSize()
{
basegfx::B2DSize aSize;
- if (mpSearchContext)
- aSize = mpSearchContext->getPageSize();
+ if (mpImplementation->mpSearchContext)
+ aSize = mpImplementation->mpSearchContext->getPageSize();
return aSize;
}
bool VectorGraphicSearch::next()
{
- if (mpSearchContext)
- return mpSearchContext->next();
+ if (mpImplementation->mpSearchContext)
+ return mpImplementation->mpSearchContext->next();
return false;
}
bool VectorGraphicSearch::previous()
{
- if (mpSearchContext)
- return mpSearchContext->previous();
+ if (mpImplementation->mpSearchContext)
+ return mpImplementation->mpSearchContext->previous();
return false;
}
int VectorGraphicSearch::index()
{
- if (mpSearchContext)
- return mpSearchContext->index();
+ if (mpImplementation->mpSearchContext)
+ return mpImplementation->mpSearchContext->index();
return -1;
}
std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
{
- if (mpSearchContext)
- return mpSearchContext->getTextRectangles();
+ if (mpImplementation->mpSearchContext)
+ return mpImplementation->mpSearchContext->getTextRectangles();
return std::vector<basegfx::B2DRectangle>();
}
commit 5c77719e84ab7a2bb7519ec55e2fe2be7dd4631b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 11:50:20 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Jul 30 15:23:33 2020 +0200
pdfium: only init pdfium library one and destroy on LO exit
With more and more usage of PDFium, it is hard to keep track of
the life-time of the PDFium library, so it can happen that a
FPDF_DestroyLibrary happens when we still have another instance
where PDFium is still use. The result of this is a crash. To
prevent this, just initialize the library once and delete, when
on LO exit.
This can be improved in the future to only keep the library
active when in actual use.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95391
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 067a8a954c8e1d8d6465a4ab5fb61e93f16c26c2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95933
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 3538b83c8d83e66f63c745bd769d118117704026)
Change-Id: I5c7e5de7f8b97d10efb394c67c7a61b976c8d57c
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
new file mode 100644
index 000000000000..bc7912c17e81
--- /dev/null
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
+
+#include <memory>
+#include <rtl/instance.hxx>
+#include <vcl/dllapi.h>
+
+namespace vcl::pdf
+{
+class VCL_DLLPUBLIC PDFium final
+{
+private:
+ PDFium(const PDFium&) = delete;
+ PDFium& operator=(const PDFium&) = delete;
+
+public:
+ PDFium();
+ ~PDFium();
+};
+
+struct PDFiumLibrary : public rtl::StaticWithInit<std::shared_ptr<PDFium>, PDFiumLibrary>
+{
+ std::shared_ptr<PDFium> operator()() { return std::make_shared<PDFium>(); }
+};
+
+} // namespace vcl::pdf
+
+#endif // HAVE_FEATURE_PDFIUM
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 6d89c4bf5390..7017cc1a9246 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -143,6 +143,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
, mnPageCount(0)
, mdPageWidthPts(0)
, mdPageHeightPts(0)
+ , mpPDFium(vcl::pdf::PDFiumLibrary::get())
{
mpVD->EnableOutput(false);
mpVD->SetLineColor();
@@ -156,13 +157,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
svl::Items<EE_ITEMS_START, EE_ITEMS_END>{});
checkClip();
- FPDF_LIBRARY_CONFIG aConfig;
- aConfig.version = 2;
- aConfig.m_pUserFontPaths = nullptr;
- aConfig.m_pIsolate = nullptr;
- aConfig.m_v8EmbedderSlot = 0;
- FPDF_InitLibraryWithConfig(&aConfig);
-
// Load the buffer using pdfium.
auto const& rVectorGraphicData = mrGraphic.getVectorGraphicData();
mpPdfDocument = FPDF_LoadMemDocument(
@@ -197,11 +191,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
mnPageCount = FPDF_GetPageCount(mpPdfDocument);
}
-ImpSdrPdfImport::~ImpSdrPdfImport()
-{
- FPDF_CloseDocument(mpPdfDocument);
- FPDF_DestroyLibrary();
-}
+ImpSdrPdfImport::~ImpSdrPdfImport() { FPDF_CloseDocument(mpPdfDocument); }
void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport,
int nPageIndex)
diff --git a/svx/source/svdraw/svdpdf.hxx b/svx/source/svdraw/svdpdf.hxx
index 9dd6626d3318..6de25eb82767 100644
--- a/svx/source/svdraw/svdpdf.hxx
+++ b/svx/source/svdraw/svdpdf.hxx
@@ -45,6 +45,8 @@
#include <postwin.h>
#include <fpdfview.h>
+#include <vcl/filter/PDFiumLibrary.hxx>
+
// Forward Declarations
class SfxItemSet;
@@ -104,6 +106,8 @@ class ImpSdrPdfImport final
tools::Rectangle PointsToLogic(double left, double right, double top, double bottom) const;
Point PointsToLogic(double x, double y) const;
+ std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
+
// check for clip and evtl. fill maClip
void checkClip();
bool isClip() const;
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index d65aad0a5e6d..9d478d0dd368 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -305,6 +305,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/gdi/wall \
vcl/source/gdi/scrptrun \
vcl/source/gdi/CommonSalLayout \
+ vcl/source/pdf/PDFiumLibrary \
vcl/source/graphic/GraphicLoader \
vcl/source/graphic/GraphicObject \
vcl/source/graphic/GraphicObject2 \
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 9b2268f3bf8e..edde9018c539 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -33,6 +33,8 @@
#include <fpdf_text.h>
#include <fpdfview.h>
+#include <vcl/filter/PDFiumLibrary.hxx>
+
using namespace ::com::sun::star;
static std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
@@ -78,6 +80,7 @@ class PdfExportTest : public test::BootstrapFixture, public unotest::MacrosTest
SvMemoryStream maMemory;
// Export the document as PDF, then parse it with PDFium.
DocumentHolder exportAndParse(const OUString& rURL, const utl::MediaDescriptor& rDescriptor);
+ std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
public:
PdfExportTest();
@@ -207,18 +210,11 @@ void PdfExportTest::setUp()
mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
mxDesktop.set(frame::Desktop::create(mxComponentContext));
- FPDF_LIBRARY_CONFIG config;
- config.version = 2;
- config.m_pUserFontPaths = nullptr;
- config.m_pIsolate = nullptr;
- config.m_v8EmbedderSlot = 0;
- FPDF_InitLibraryWithConfig(&config);
+ mpPDFium = vcl::pdf::PDFiumLibrary::get();
}
void PdfExportTest::tearDown()
{
- FPDF_DestroyLibrary();
-
if (mxComponent.is())
mxComponent->dispose();
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index f9104152fbe8..2502b98e1b35 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -23,6 +23,8 @@
#include <bitmapwriteaccess.hxx>
#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/filter/PDFiumLibrary.hxx>
+
using namespace com::sun::star;
namespace
@@ -83,12 +85,7 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream, sal_uInt64 n
else
{
// Downconvert to PDF-1.6.
- FPDF_LIBRARY_CONFIG aConfig;
- aConfig.version = 2;
- aConfig.m_pUserFontPaths = nullptr;
- aConfig.m_pIsolate = nullptr;
- aConfig.m_v8EmbedderSlot = 0;
- FPDF_InitLibraryWithConfig(&aConfig);
+ auto pPdfium = vcl::pdf::PDFiumLibrary::get();
// Read input into a buffer.
SvMemoryStream aInBuffer;
@@ -109,7 +106,6 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream, sal_uInt64 n
return false;
FPDF_CloseDocument(pPdfDocument);
- FPDF_DestroyLibrary();
aWriter.m_aStream.Seek(STREAM_SEEK_TO_BEGIN);
rOutStream.WriteStream(aWriter.m_aStream);
@@ -154,12 +150,7 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBi
const size_t nFirstPage, int nPages, const double fResolutionDPI)
{
#if HAVE_FEATURE_PDFIUM
- FPDF_LIBRARY_CONFIG aConfig;
- aConfig.version = 2;
- aConfig.m_pUserFontPaths = nullptr;
- aConfig.m_pIsolate = nullptr;
- aConfig.m_v8EmbedderSlot = 0;
- FPDF_InitLibraryWithConfig(&aConfig);
+ auto pPdfium = vcl::pdf::PDFiumLibrary::get();
// Load the buffer using pdfium.
FPDF_DOCUMENT pPdfDocument = FPDF_LoadMemDocument(pBuffer, nSize, /*password=*/nullptr);
@@ -209,7 +200,6 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBi
}
FPDF_CloseDocument(pPdfDocument);
- FPDF_DestroyLibrary();
return rBitmaps.size();
#else
@@ -256,12 +246,7 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
auto pGfxLink = std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize,
GfxLinkType::NativePdf);
- FPDF_LIBRARY_CONFIG aConfig;
- aConfig.version = 2;
- aConfig.m_pUserFontPaths = nullptr;
- aConfig.m_pIsolate = nullptr;
- aConfig.m_v8EmbedderSlot = 0;
- FPDF_InitLibraryWithConfig(&aConfig);
+ auto pPdfium = vcl::pdf::PDFiumLibrary::get();
// Load the buffer using pdfium.
FPDF_DOCUMENT pPdfDocument = FPDF_LoadMemDocument(
@@ -301,7 +286,6 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
}
FPDF_CloseDocument(pPdfDocument);
- FPDF_DestroyLibrary();
return rGraphics.size();
#else
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 94d954516f13..5c4022685f71 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -10,6 +10,8 @@
#include <vcl/VectorGraphicSearch.hxx>
+#include <vcl/filter/PDFiumLibrary.hxx>
+
#include <sal/config.h>
#include <fpdf_doc.h>
@@ -18,10 +20,12 @@
class VectorGraphicSearch::Implementation
{
public:
+ std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
FPDF_DOCUMENT mpPdfDocument;
Implementation()
- : mpPdfDocument(nullptr)
+ : mpPDFium(vcl::pdf::PDFiumLibrary::get())
+ , mpPdfDocument(nullptr)
{
}
@@ -181,19 +185,12 @@ VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
: mpImplementation(std::make_unique<VectorGraphicSearch::Implementation>())
, maGraphic(rGraphic)
{
- FPDF_LIBRARY_CONFIG aConfig;
- aConfig.version = 2;
- aConfig.m_pUserFontPaths = nullptr;
- aConfig.m_pIsolate = nullptr;
- aConfig.m_v8EmbedderSlot = 0;
- FPDF_InitLibraryWithConfig(&aConfig);
}
VectorGraphicSearch::~VectorGraphicSearch()
{
mpSearchContext.reset();
mpImplementation.reset();
- FPDF_DestroyLibrary();
}
bool VectorGraphicSearch::search(OUString const& rSearchString, SearchStartPosition eStartPosition)
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
new file mode 100644
index 000000000000..604807524bf9
--- /dev/null
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
+
+#include <vcl/filter/PDFiumLibrary.hxx>
+#include <fpdf_doc.h>
+
+namespace vcl::pdf
+{
+PDFium::PDFium()
+{
+ FPDF_LIBRARY_CONFIG aConfig;
+ aConfig.version = 2;
+ aConfig.m_pUserFontPaths = nullptr;
+ aConfig.m_pIsolate = nullptr;
+ aConfig.m_v8EmbedderSlot = 0;
+ FPDF_InitLibraryWithConfig(&aConfig);
+}
+
+PDFium::~PDFium() { FPDF_DestroyLibrary(); }
+
+} // end vcl::pdf
+
+#endif // HAVE_FEATURE_PDFIUM
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list