sdext/source/pdfimport/wrapper/wrapper.cxx | 21 +++++++++++++++++++++ vcl/source/filter/ipdf/pdfread.cxx | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-)
New commits: commit f08b80fc1a4a4cadc320043aef0ff01090a23d44 Author: Ashod Nakashian <[email protected]> AuthorDate: Sat Mar 3 13:10:49 2018 -0500 Commit: Jan Holesovsky <[email protected]> CommitDate: Tue Mar 26 11:15:38 2019 +0100 pdf: refactor poppler importer This paves the way to add pdf parsing via pdfium. Change-Id: I384687bcdce3011682ebeec18ee3de44759feb1a Reviewed-on: https://gerrit.libreoffice.org/51254 Tested-by: Jenkins <[email protected]> Reviewed-by: Ashod Nakashian <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/69620 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 08fd2e654146..86c64e4ea598 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -1015,6 +1015,14 @@ public: } }; +bool xpdf_ImportFromFile_Poppler(const OUString& aSysUPath, + const ContentSinkSharedPtr& rSink, + const uno::Reference<task::XInteractionHandler>& xIHdl, + const bool bIsEncrypted, + const OUString& aPwd, + const uno::Reference<uno::XComponentContext>& xContext, + const OUString& rFilterOptions); + bool xpdf_ImportFromFile(const OUString& rURL, const ContentSinkSharedPtr& rSink, const uno::Reference<task::XInteractionHandler>& xIHdl, @@ -1045,6 +1053,19 @@ bool xpdf_ImportFromFile(const OUString& rURL, return false; } + return xpdf_ImportFromFile_Poppler(aSysUPath, rSink, xIHdl, bIsEncrypted, aPwd, xContext, rFilterOptions); +} + +/// Parse PDf file using libpoppler, which is quite limited +/// to be phased out in favor of pdfium. +bool xpdf_ImportFromFile_Poppler(const OUString& aSysUPath, + const ContentSinkSharedPtr& rSink, + const uno::Reference<task::XInteractionHandler>& /*xIHdl*/, + const bool bIsEncrypted, + const OUString& aPwd, + const uno::Reference<uno::XComponentContext>& xContext, + const OUString& rFilterOptions) +{ // Determine xpdfimport executable URL: OUString converterURL("$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/xpdfimport"); rtl::Bootstrap::expandMacros(converterURL); //TODO: detect failure diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 02c7be44594f..ab70a0451d9d 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -244,9 +244,9 @@ bool ImportPDF(SvStream& rStream, Graphic& rGraphic, { uno::Sequence<sal_Int8> aPdfData; Bitmap aBitmap; - bool bRet = ImportPDF(rStream, aBitmap, 0, aPdfData, - STREAM_SEEK_TO_BEGIN, - STREAM_SEEK_TO_END, fResolutionDPI); + const bool bRet = ImportPDF(rStream, aBitmap, 0, aPdfData, + STREAM_SEEK_TO_BEGIN, + STREAM_SEEK_TO_END, fResolutionDPI); rGraphic = aBitmap; rGraphic.setPdfData(std::make_shared<css::uno::Sequence<sal_Int8>>(aPdfData)); rGraphic.setPageNumber(0); // We currently import only the first page. _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
