diff options
Diffstat (limited to 'vcl/inc/pdf')
-rw-r--r-- | vcl/inc/pdf/ExternalPDFStreams.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/pdf/pdfcompat.hxx | 42 |
2 files changed, 43 insertions, 1 deletions
diff --git a/vcl/inc/pdf/ExternalPDFStreams.hxx b/vcl/inc/pdf/ExternalPDFStreams.hxx index 7840217630c8..45b15f7a74bc 100644 --- a/vcl/inc/pdf/ExternalPDFStreams.hxx +++ b/vcl/inc/pdf/ExternalPDFStreams.hxx @@ -42,7 +42,7 @@ struct VCL_DLLPUBLIC ExternalPDFStream aPDFStream.WriteBytes(maDataContainer.getData(), maDataContainer.getSize()); aPDFStream.Seek(0); auto pPDFDocument = std::make_shared<filter::PDFDocument>(); - if (!pPDFDocument->Read(aPDFStream)) + if (!pPDFDocument->ReadWithPossibleFixup(aPDFStream)) { SAL_WARN("vcl.pdfwriter", "PDFWriterImpl::writeReferenceXObject: reading the PDF document failed"); diff --git a/vcl/inc/pdf/pdfcompat.hxx b/vcl/inc/pdf/pdfcompat.hxx new file mode 100644 index 000000000000..8f629b3bc8ee --- /dev/null +++ b/vcl/inc/pdf/pdfcompat.hxx @@ -0,0 +1,42 @@ +/* -*- 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> +#include <tools/gen.hxx> +#include <tools/stream.hxx> +#include <tools/UnitConversion.hxx> +#include <vcl/graph.hxx> + +namespace vcl::pdf +{ +/// Convert to inch, then assume 96 DPI. +inline double pointToPixel(const double fPoint, const double fResolutionDPI) +{ + return o3tl::convert(fPoint, o3tl::Length::pt, o3tl::Length::in) * fResolutionDPI; +} + +/// Decide if PDF data is old enough to be compatible. +bool isCompatible(SvStream& rInStream, sal_uInt64 nPos, sal_uInt64 nSize); + +/// Converts to highest supported format version (currently 1.6). +/// Usually used to deal with missing referenced objects in the +/// source pdf stream. +bool convertToHighestSupported(SvStream& rInStream, SvStream& rOutStream); + +/// Takes care of transparently downgrading the version of the PDF stream in +/// case it's too new for our PDF export. +bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream); + +BinaryDataContainer createBinaryDataContainer(SvStream& rStream); + +} // end of vcl::filter::ipdf namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |