summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-03-13 23:55:26 -0400
committerJan Holesovsky <kendy@collabora.com>2018-06-07 10:45:18 +0200
commit7939efc7136987fad348baca2cd686a00aee73cd (patch)
treec142fd2770bb97d83fa91b971e370cf3b4acc73c /sdext
parent9b11fdd36ec80f9d1ae0a05455745361e0ce9ced (diff)
sd: import PDFs as images using Pdfium new SdPdfFilter
LOK now opens PDFs as images using Pdfium, which has a superior accuracy and support to poppler, the default pdf reader. Change-Id: Ifbbecf7f048f001836fb98886705cba47e6bed4e
Diffstat (limited to 'sdext')
-rw-r--r--sdext/CppunitTest_sdext_pdfimport.mk1
-rw-r--r--sdext/Executable_pdf2xml.mk1
-rw-r--r--sdext/Executable_pdfunzip.mk1
-rw-r--r--sdext/Library_pdfimport.mk1
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx40
5 files changed, 17 insertions, 27 deletions
diff --git a/sdext/CppunitTest_sdext_pdfimport.mk b/sdext/CppunitTest_sdext_pdfimport.mk
index f5fc54696329..87a917f8d81d 100644
--- a/sdext/CppunitTest_sdext_pdfimport.mk
+++ b/sdext/CppunitTest_sdext_pdfimport.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sdext_pdfimport,\
sal \
test \
unotest \
+ tl \
xo \
))
diff --git a/sdext/Executable_pdf2xml.mk b/sdext/Executable_pdf2xml.mk
index c0f7fe6f5727..b2439164a1ed 100644
--- a/sdext/Executable_pdf2xml.mk
+++ b/sdext/Executable_pdf2xml.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Executable_use_libraries,pdf2xml,\
unotest \
cppuhelper \
sal \
+ tl \
xo \
))
diff --git a/sdext/Executable_pdfunzip.mk b/sdext/Executable_pdfunzip.mk
index 006f8e5c9430..1fcca8a863d7 100644
--- a/sdext/Executable_pdfunzip.mk
+++ b/sdext/Executable_pdfunzip.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_Executable_use_libraries,pdfunzip,\
cppuhelper \
sal \
vcl \
+ tl \
xo \
))
diff --git a/sdext/Library_pdfimport.mk b/sdext/Library_pdfimport.mk
index 465a406b66b8..f0d38e624d1d 100644
--- a/sdext/Library_pdfimport.mk
+++ b/sdext/Library_pdfimport.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,pdfimport,\
cppu \
cppuhelper \
sal \
+ tl \
xo \
))
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 7d3d68901e37..affd350a6a8c 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -35,6 +35,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/byteseq.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/propertysequence.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/io/XInputStream.hpp>
@@ -71,6 +72,12 @@
#include <rtl/character.hxx>
+#include <vcl/bitmapaccess.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/pdfread.hxx>
+#include <vcl/pngwrite.hxx>
+
using namespace com::sun::star;
namespace pdfi
@@ -1001,20 +1008,12 @@ 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,
- const OUString& rPwd,
- const uno::Reference< uno::XComponentContext >& xContext,
- const OUString& rFilterOptions )
+bool xpdf_ImportFromFile(const OUString& rURL,
+ const ContentSinkSharedPtr& rSink,
+ const uno::Reference<task::XInteractionHandler>& xIHdl,
+ const OUString& rPwd,
+ const uno::Reference<uno::XComponentContext>& xContext,
+ const OUString& rFilterOptions)
{
OSL_ASSERT(rSink);
@@ -1039,19 +1038,6 @@ 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