Images not embedded because of paste as link bug in OpenOffice and LibreOffice

Skip to end of metadata
Go to start of metadata

Description

When pasting an image that was copied from some (but not all!) web browsers, both Open Office and LibreOffice only insert a link to that image in the ODT document. This bug was first reported in 2004 for OpenOffice, and 10 years onward it hasn't been fixed.

For LibreOffice the bug was finally solved in February 2014.

Risks

If linked images are removed from their original location they will not show in the ODT document, and the image content will be irreversibly lost.

Assessment

Detection is possible by parsing the content.xml file in the ODF container. Images are represented as a draw element, which has an xlink property that defines the actual image location. In the following example (file here) xlink points to an external image on the web:

<draw:image xlink:href="http://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Luftschiff_Montgolfier.jpg/499px-Luftschiff_Montgolfier.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

On the other hand, in the example below (file here), the image is embedded in directory Pictures inside the ODF container:

<draw:image xlink:href="Pictures/10000000000001F300000257D006F0C7.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

As far as I'm aware no tools exist that perform this check, but it would be easy to create such a tool.

Recommendations

New documents

When pasting an image with LibreOffice writer, always use Paste Special..., and then select Bitmap.

Existing documents

It would be fairly straightforward to write a software tool that fixes ODT documents with non-embedded images. This would involve the following steps:

  1. Check all draw elements in content.xml for external links
  2. Download any externally referenced images (if they are still available!)
  3. Store downloaded images in designated folder in ODT container
  4. Update link in each draw element to location of downloaded image

Needless to say this only works if the linked images are still accessible. Also, some images may have changed since the referring document's creation, in which case the fixed document will not look like it was originally meant to.

Example files

References

Labels:
odt odt Delete
formatissue formatissue Delete
opendocument opendocument Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.