summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-04-11 16:50:53 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-04-12 10:46:01 +0200
commit198c3a5929e183ed710c8838844148bd0c1a533a (patch)
tree0294783e43423a26c00a05eb9f646d95e9f6e9d0 /svx
parent4ea13cdfebb24cdb59af37000f216e8201f87b22 (diff)
Related: tdf#106972 vcl PDF import: downgrade PDF >= 1.5
There are two problems with these newer PDF versions: - the current PDF export code doesn't know how to roundtrip such PDF images (needs work on both the import and export side) - upgrading the default PDF export version would upset readers who can't parse PDF >= 1.5 So instead of raising the default PDF export version, for now just be conservative and depend on pdfium to downgrade the PDF image version to 1.4 if it would be higher. Given that this modifies the input of the graphic filter this also needs changes in the ODF export, so that the filter result will contain that downgraded data, not the original one. Reviewed-on: https://gerrit.libreoffice.org/36413 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 37bdf1659ddb11d8706289511623cc7c8b0d264b) Conflicts: vcl/source/filter/ipdf/pdfread.cxx Change-Id: I1efa97af8110e9a6ee3e8a7339bcc7d70457cfb0
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xml/xmlgrhlp.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 6ac0f44d5701..de29f96df181 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -564,7 +564,20 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName,
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aStream.xStream ));
if( bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData() )
- pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize());
+ {
+ const uno::Sequence<sal_Int8>& rPdfData = aGraphic.getPdfData();
+ if (rPdfData.hasElements())
+ {
+ // The graphic has PDF data attached to it, use that.
+ // vcl::ImportPDF() possibly downgraded the PDF data from a
+ // higher PDF version, while aGfxLink still contains the
+ // original data provided by the user.
+ pStream->WriteBytes(rPdfData.getConstArray(), rPdfData.getLength());
+ bRet = (pStream->GetError() == 0);
+ }
+ else
+ pStream->WriteBytes(aGfxLink.GetData(), aGfxLink.GetDataSize());
+ }
else
{
if( aGraphic.GetType() == GraphicType::Bitmap )