Vector screenshots for the manuals: better quality and more visually attractive

Hossein Noorikhah at
Mon May 31 20:49:48 UTC 2021


You may already know that with Gtk 3, it is possible to take vector
from a GUI. The utility created by Joachim Breitner (nomeata) takes care of

But, this does not work out of the box. I have tried to take vector
from LibreOffice gtk3 gui, and it led to an immediate crash. I have
debugged the
soffice binary, and I came across several assertions that are checked and
aborts in case of specific threading situations. I have temporarily disabled
these assertions and aborts, and by further disabling the autosave,
was fine, and I could take vector screenshots. The tiny patch is attached.

I have created a proof of concept document from "LibreOffice Writer Guide",
section titled “20. Customizing Writer”, and created vector screenshots in
format for almost all of the previously raster screenshots. The quality of
PDF output is much better, the file is more visually attractive and it is
for print and display.

Vector ODT:

Vector PDF:

There are few remaining things:

1. Vector screenshot does not add window decorations, so some workaround is
needed. For example, some toplevel Gtk widgets contain decorations in the
screenshots, so these can be used for containing the window contents.

2. Trying to take screenshots closes menus, etc, and this can be handled by
creating a delay in taking screenshots.

3. Not everything is vector. For example, document contents in LibreOffice
also toolbar and status bar icons are not vectors. This is because of the
text and images are rendered in LibreOffice. If you take screenshots from
applications, the output is different. Try Glade and Gedit for the

On the development side, I doubt that having these aborts will be useful at
runtime. There are hundreds of aborts and thousands of asserts in the code
in which I
think should be revised. Crashing the application in case of some problem is
usually a bad idea.

Assertions in C++, and Why Not to Use assert()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vector.diff
Type: text/x-patch
Size: 1809 bytes
Desc: not available
URL: <>

More information about the LibreOffice mailing list