From 7088140dbf1d5e0391c2662f0213018a45620ff9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 3 Feb 2020 20:23:23 +0100 Subject: tdf#129976 PDF export of PDF images: adapt transparency to rendering The bugdoc has a transparent PDF image, and we currently put a white background behind that in Impress, given that vcl::RenderPDFBitmaps() works with Bitmap instances, not BitmapEx ones. This means that in case we preserve transparency during PDF export, the content that was rendered OK now becomes unreadable. Adapt the PDF export to do the same as rendering by putting a white background behind the PDF image. Change-Id: I4edcb12fab71bb305d97a50d20fbfbf86d9aab85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87910 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- vcl/source/gdi/pdfwriter_impl.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'vcl/source') diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index ec148b2159d8..6726b02b7173 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8757,6 +8757,16 @@ void PDFWriterImpl::writeReferenceXObject(ReferenceXObjectEmit& rEmit) // Reset line width to the default. aStream.append(" 1 w\n"); + // vcl::RenderPDFBitmaps() effectively renders a white background for transparent input, be + // consistent with that. + aStream.append("1 1 1 rg\n"); + aStream.append("0 0 "); + aStream.append(aSize.Width()); + aStream.append(" "); + aStream.append(aSize.Height()); + aStream.append(" re\n"); + aStream.append("f*\n"); + // No reference XObject, draw the form XObject containing the original // page streams. aStream.append("/Im"); -- cgit