From 7939efc7136987fad348baca2cd686a00aee73cd Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Tue, 13 Mar 2018 23:55:26 -0400 Subject: 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 --- include/vcl/graph.hxx | 6 +++++- include/vcl/pdfread.hxx | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 include/vcl/pdfread.hxx (limited to 'include') diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx index 847e20e202ab..cd2e48c273f7 100644 --- a/include/vcl/graph.hxx +++ b/include/vcl/graph.hxx @@ -231,10 +231,14 @@ public: const VectorGraphicDataPtr& getVectorGraphicData() const; void setPdfData(const std::shared_ptr>& rPdfData); - void setPdfData(const css::uno::Sequence& rPdfData) { setPdfData(std::make_shared>(rPdfData)); } std::shared_ptr> getPdfData() const; bool hasPdfData() const; + /// Set the page number of the multi-page source this Graphic is rendered from. + void setPageNumber(sal_Int32 nPageNumber); + /// Get the page number of the multi-page source this Graphic is rendered from. + sal_Int32 getPageNumber() const; + static css::uno::Sequence getUnoTunnelId(); }; diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx new file mode 100644 index 000000000000..9f2797768646 --- /dev/null +++ b/include/vcl/pdfread.hxx @@ -0,0 +1,46 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX +#define INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX + +#include + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace uno +{ +template class Sequence; +} +} +} +} +class Bitmap; +class Graphic; + +namespace vcl +{ +/// Imports a PDF stream into rGraphic as a GDIMetaFile. +VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Bitmap& rBitmap, + css::uno::Sequence& rPdfData, + sal_uInt64 nPos = STREAM_SEEK_TO_BEGIN, + sal_uInt64 nSize = STREAM_SEEK_TO_END); +VCL_DLLPUBLIC bool ImportPDF(SvStream& rStream, Graphic& rGraphic); + +VCL_DLLPUBLIC size_t ImportPDF(const OUString& rURL, std::vector& rBitmaps, + css::uno::Sequence& rPdfData); +} + +#endif // INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit