Bug 124790 - Mailmerge: Background image in printed address labels not visible
Summary: Mailmerge: Background image in printed address labels not visible
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Whiteboard: target:6.4.5
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Regressions-alg_writerframes
  Show dependency treegraph
Reported: 2019-04-17 11:15 UTC by Thomas Törnblom
Modified: 2020-06-02 08:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

ODT label document with background images (129.42 KB, application/vnd.oasis.opendocument.text)
2020-05-18 14:09 UTC, Thomas Törnblom
ODS document with names for the labels (14.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-05-18 14:09 UTC, Thomas Törnblom
PDF printout from linux (142.13 KB, application/pdf)
2020-05-18 14:10 UTC, Thomas Törnblom
PDF printout from win10 (407.02 KB, application/pdf)
2020-05-18 14:11 UTC, Thomas Törnblom
PDF export from Win7 LO70+ (72.25 KB, application/pdf)
2020-05-18 14:35 UTC, Timur
PDF print from Win7 LO70+ (102.61 KB, application/pdf)
2020-05-18 14:36 UTC, Timur

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Törnblom 2019-04-17 11:15:43 UTC
I have been using OpenOffice on Mac OS X to print address labels with a jpeg background but would like to use LibreOffice instead due to issues with OO.

While the old document opens OK in LO, the background of the text layer does not appear to be transparent and thus the background image is not visible.

I just installed LO 6.2.2 for windows (win 10) and now I can at least see the background image and field names in the document, but when I print to a pdf the image is gone.

I've also upgraded to pre-release, but it behaves the same.

Steps to Reproduce:
1. Download and unpack http://hax.se/testkort.zip
2. Open the Testkort.odt document in Writer
3. Register the Testadresser.odb database (testadresser.ods is the source)
4. Print the document to a pdf file
5. Open the resulting pdf file

Actual Results:
Address labels with only the names, no background image

Expected Results:
Address labels with both background image and names similar to the result from the OpenOffice result provided in the file test2.pdf

Reproducible: Always

User Profile Reset: No

Additional Info:
I suspect the issue is that the top text layer is not transparent

Version: (x64)
Build ID: 9ba025bafb03b962c34687cf87806cc03a3a7436
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: sv-SE (en_SE); UI-Language: en-US
Calc: threaded

Users on the Swedish LO mailing have verified my results.

I have been trying different versions and versions from up to works ok, but as of it no longer works.

A colleague found this article that might be relevant: https://superuser.com/questions/971892/how-do-i-set-a-background-image-in-libreoffice-writer-5
Comment 1 Dieter 2019-06-01 10:56:18 UTC
Thomas, I just opened testkort.odt, but I couldn't reproduce it with 

Version: (x64)
Build-ID: 2412653d852ce75f65fbfa83fb7e7b669a126d64
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: threaded

Perhaps a user of Swedish LO mailing list can confirm it here, since they could verified your results.
Comment 2 Xisco Faulí 2019-06-04 12:16:23 UTC
Reproduced in

Build ID: 4abdaf4afb2245d404f6709124b3c627b07b8a3c
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 3 Timur 2020-05-14 10:36:36 UTC
This report is more complicated than needed and not clear. It's wrong to attach zip, should be single files. While reporter is using mail merge, that may not be a bug, so it needed to be clear and if not so, single ODT was supposed to be attached. There's no "wrong" PDF, just "right", not clear what's missing. Reporter marked 4.4 as starting version, is it really so, tested or just like that. Regression was marked but not explained. 

That being said, I used just ODT without serial print and I see images in Windows 7 so not clear what's the bug. Export to PDF also seems to work.  
I revert to NeedInfo. 

We have separate bug here in master, images are flipped, but let's first clarify the starting position.
Comment 4 Timur 2020-05-14 10:54:10 UTC
I reproduces missing images in Linux with 4.4 but it was fixed in 6.0 series. 
So it's not clear for report and confirmation.
Comment 5 Timur 2020-05-15 10:53:32 UTC
Thomas and Xisco, please respond.
Comment 6 Thomas Törnblom 2020-05-15 14:34:43 UTC
I just installed on Windows 10, and it seems to work.

I will try out with real data on OSx when I get home.

Looking good so far, thanks!
Comment 7 Thomas Törnblom 2020-05-15 18:35:20 UTC
Just tested, and it seems that the background graphics works now.

Now I just need to figure out how to produce the labels, just opening the document that works in OO does not work...
Comment 8 Timur 2020-05-18 10:06:00 UTC
Bibisect 4.3:
 af1025800ec5bd1184da14f92a494470fa7c490b is the first *bad* commit
commit af1025800ec5bd1184da14f92a494470fa7c490b
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Thu May 28 20:34:05 2015 +0800

    commit 6e61ecd09679a66060f932835622821d39e92f01
    Author:     Armin Le Grand <alg@apache.org>
    AuthorDate: Wed Mar 19 16:17:02 2014 +0000
    Commit:     Miklos Vajna <vmiklos@collabora.co.uk>
    CommitDate: Fri Mar 28 14:31:08 2014 +0100
        Merge back branch alg_writerframes to trunk
        (cherry picked from commit b635b4fa4e42053d30ab639643d2236a20243f62)
      Previous source-hash-c7190108f02921868cb617040aebdb2d22c02c1f


Bibisect 6.0:
 b1008b030246939187e5c30ba750d6abb397161d is the first *good* commit
commit b1008b030246939187e5c30ba750d6abb397161d
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Thu Jun 22 02:10:02 2017 +0200

    source 77da7b934d782153be9271605691ceee6c66233a
    source 77da7b934d782153be9271605691ceee6c66233a
    source 48da675a67a2bfd2eadfd6d4c6dba0dee74b5326
    source 9b68ce7b0f2326ec540717ec5c8207825403774e
    source d2e4aeb929b346acd0d1a2eaeee7237b89b99474
    source 08792a4b332d907c72d1fc7301133f5b306ec8dd
    source d7824bf16898d8cb776420e0c2bff82e6df61b86
    source f05d0d05829dd51cb9d8071ac97cc219779ee40a
    source 266bcae306a1dd6e0d9df80ba30ade7311385c28
    source 08316e5edfc36ed75a4e8dc5b6aa7eea3af4eea9
    source 136ce64b18283acf9db5d130f8ac9108591dd4ee
    source b29bae1064c9f980cc50a667e8b96c5e370326d7

Same range that fixed this made problem in bug 128871. Can't says which source.
Comment 9 Thomas Törnblom 2020-05-18 11:42:36 UTC
Turned out the problem was not fixed after all.

The thing that did change was that the background image is visible on screen, but when printing to pdf, and I assume it will be the same when printing to a printer, the background image is not visible, just the text.
Comment 10 Thomas Törnblom 2020-05-18 12:03:31 UTC
Just tested on linux, and it behaves the same.

The document looks ok in Writer, with the field names on the labels shown, but when I try to print, the preview shows just the text, no background image, and when I print to a PDF it contains just the text as well.
Comment 11 Timur 2020-05-18 13:45:56 UTC
Please go back to basics per Comment 3 and explain: 
- do you reproduce the problem you see just with ODT (no ODS and ODB needed, serial letter: no)?
- attach PDFs you get. 
- try to change openGL and HW acceleration in Options-View 
- write exact Win and Lin versions you tested with.
Comment 12 Thomas Törnblom 2020-05-18 14:09:10 UTC
Created attachment 160975 [details]
ODT label document with background images

This is the master ODT document, with background images, to be used to generate labels.
Comment 13 Thomas Törnblom 2020-05-18 14:09:55 UTC
Created attachment 160976 [details]
ODS document with names for the labels
Comment 14 Thomas Törnblom 2020-05-18 14:10:42 UTC
Created attachment 160977 [details]
PDF printout from linux
Comment 15 Thomas Törnblom 2020-05-18 14:11:20 UTC
Created attachment 160978 [details]
PDF printout from win10
Comment 16 Thomas Törnblom 2020-05-18 14:20:39 UTC
- As far as I know you need both the ODT and an address source for this to work.
  I have attached both the ODT and a short ODS document, which the ODT document   refers to
- I have attached PDF:s both from linux (ubuntu 18.04.4 LTS) and windows 10 (Windows 10 Enterprise version 1909)

When I opened one of the PDF:s the background images briefly flashed by once, so I suspect the background is there, but that the text layer is on top of it and has a non transparent background so that it hides the background image.
Comment 17 Timur 2020-05-18 14:35:21 UTC
Created attachment 160979 [details]
PDF export from Win7 LO70+

(In reply to Thomas Törnblom from comment #16)
> - As far as I know you need both the ODT and an address source for this to
> work.
No, you can simply print ODT. Please do it, to be the same. 

Because my PDF export is fine.
Comment 18 Timur 2020-05-18 14:36:21 UTC
Created attachment 160980 [details]
PDF print from Win7 LO70+

PDF print from 7.0+ has another bug, image is flipped.
Comment 19 Timur 2020-05-18 14:38:03 UTC Comment hidden (obsolete)
Comment 20 Thomas Törnblom 2020-05-18 14:47:06 UTC
It works if you just print the ODT document, but doesn't if you generate a document with the names from the ODS file.

The LO version (win10) is:
Version: (x86)
Build ID: 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU-trådar:4; Operativsystem:Windows 10.0 Build 18363; UI-rendering: GL; VCL: win; 
Språkinställning: sv-SE (sv_SE); UI-språk: sv-SE
Calc: threaded

The linux version:
Build ID: 1:6.0.7-0ubuntu0.18.04.10
CPU threads: 1; OS: Linux 5.3; UI render: default; VCL: gtk3; 
Locale: sv-SE (en_US.UTF-8); Calc: group

I have no "OpenGL" settings, but enabling OpenCL made no difference.
Comment 21 Timur 2020-05-18 14:52:56 UTC
OK, I confirm the bug with mailmerge serial print in 6.4 but that is fine with master 7.0+. So I change back to Fixed

What I bibisected previously was simple print. 

Flipped image will be another bug. 

For the future: when reporting mailmerge bug, please use new sample from built-in Bibliography database.
Comment 22 Timur 2020-05-18 14:59:15 UTC
1. Fixed is for bibisect I did in 6.0
2. Another bibisect in 7.' could reveal this fix
3. Thomas, you may report new 7.0+ flipped image (you may install master separately to your working LO).
Comment 23 Thomas Törnblom 2020-05-18 16:46:51 UTC

I assume this will be fixed once 7 advances so that one can add an Address Book Source, which seems impossible with on OSx.
Comment 24 Xisco Faulí 2020-05-19 12:07:41 UTC
(In reply to Timur from comment #22)
> Note: 
> 1. Fixed is for bibisect I did in 6.0
> 2. Another bibisect in 7.' could reveal this fix
> 3. Thomas, you may report new 7.0+ flipped image (you may install master
> separately to your working LO).

Hi Timur,
Do you know which commit fixed this issue ?
Comment 25 Timur 2020-05-20 06:30:09 UTC
Mail merge fixed in 7.0 with:
 9224ac67849062bc3046578d354c642e3d9ff9c5 is the first good commit
commit 9224ac67849062bc3046578d354c642e3d9ff9c5
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Thu Apr 23 09:45:17 2020 

    source 539a5501e6732b5083e112e76511024c8ce9678a
    Previous source 7a714957f28758f9b112abc1bda8f502052c7b01


commit 539a5501e6732b5083e112e76511024c8ce9678a	[log]
author	Miklos Vajna <vmiklos@collabora.com>	Wed Apr 22 21:06:58 2020 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	Thu Apr 23 09:20:40 2020 +0200
tree 3cc09baf677f5388faaa2867ceb22977743482e0
parent 7a714957f28758f9b112abc1bda8f502052c7b01 [diff]

sw: handle SubtractFlys when replacing compat options

This was added in commit c5cf8824a619401627f18abc7b3049551c71ac2a
(tdf#86578: sw: fix rendering of legacy documents with fly achored at
fly), it's off by default and on for legacy ODT files.
Comment 26 Xisco Faulí 2020-06-01 14:35:14 UTC
Hi Timur,
I do confirm https://git.libreoffice.org/core/+/539a5501e6732b5083e112e76511024c8ce9678a%5E!/ fixes this issue. Le'ts backport it to libreoffice-6-4. Thanks for bisecting it!!
Comment 27 Commit Notification 2020-06-02 08:31:41 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":


tdf#124790: sw: handle SubtractFlys when replacing compat options

It will be available in 6.4.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.