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-11 17:38:47 +0200
commit37bdf1659ddb11d8706289511623cc7c8b0d264b (patch)
tree0d64c5e845864fc8e3c02c59c6e3eff3b0772cf2 /svx
parent5722b815fa34422595407e83029fb41583f13894 (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. Change-Id: I1efa97af8110e9a6ee3e8a7339bcc7d70457cfb0 Reviewed-on: https://gerrit.libreoffice.org/36413 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
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 04b92711aa69..3946bb94c3c0 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -555,7 +555,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 )