(Gramps 5.2.4, MacOS 15.3.1) I have quite a few media files which are pdf format, and these don’t display either as thumbnails or full size in Gramps. I searched the forum for hints and found likely solutions for Linux, but none for Mac. Can I use Apple’s Preview app to do this?
I’m using Linux and this also not working.
To display an image or document in a local application we use: Gio.AppInfo.launch_default_for_uri(path)
. Check that you have a default application defined in your operating system to open pdf
files.
For thumbnails, it is possible to write your own thumbnailer. You just need an application that can be called with a path to the file and an image size that will return a png
file. I don’t know if that is possible with Apple’s Preview.
On Linux we have a default thumbnailer installed that uses the Gnome thumbnailers. Check that you have a Gnome thumbnailer installed that can handle pdf
files.
The utility sips would appear to do this. Overview at:
Craig
I use 5.1.6 on MacOS and set the default viewer to Preview (in Finder for all files of type application/PDF). Note that when I set this default to Adobe Acrobat, it did not display.
When I double click a PDF from the Media list, for instance, it appears in Preview and is readable.
However, the PDF file does not have any of the Image Metadata, or Media Preview.
The media preview is just the PDF icon.
As a comparison,
type=image/tiff has Image Metadata and Media Preview
type=image/png has Image Metadata and Media Preview
type=image/jpeg has Media Preview only
type=image/gif has Media Preview only
type=image/bmp has Media Preview only
type=application/pdf has PDF icon for Media Preview only
I use KDE, but I also have apps installed (evince, nautilus) that should make it work then… but wait… sh*t it’s a flatpak install… have to investigate more about this…
On my system there is a file called /usr/share/thumbnailers/evince.thumbnailer
. It contains a line that describes how it is called evince-thumbnailer -s %s %u %o
and a list of mime types which it can handle including application/pdf
.
I don’t know if these can be accessed from within a Flatpak sandbox.
Fedora suddenly started giving antivirus warnings about evince activity with thumbnail generation
I also would like to see PDF thumbnails in Gramps. Reading through this
thread, I tried a few things which did not work.
I am running Fedora 41 with a native installation of Gramps 5.2.4 and
KDE/Wayland environment. I found a set of parameters for ImageMagick
which will produce a PNG thumbnail:
magick infile.pdf -thumbnail x300 -background white -alpha remove
-format “png” outfile.png
I created /usr/share/thumbnailers/pdf.thumbnailer with this content:
[Thumbnailer Entry]
TryExec=magick
Exec=magick %i -thumbnail %s -background white -alpha remove %u[0]
-format “png” %o
MimeType=application/pdf;
System Settings has a MIME type for application/pdf which launches
Okular. I think that does nothing as regards thumbnails.
Gramps will not display a thumbnail of a PDF. The file manager Dolphin
will display PDF thumbnails - but it uses a different set of thumbnail
generators and so is not a good test.
Is there something in Gramps that has to be configured to generate
thumbnails?
Try:
[Thumbnailer Entry]
TryExec=magick
Exec=magick %i -thumbnail x%s -background white -alpha remove -format "png" %o
MimeType=application/pdf;
You could also put a print (self.all_mime_types)
after self.__find_thumbnailers()
at line 64 in the gramps/plugins/thumbnailer/gnomethumb.py
file.
I changed the pdf.thumbnailer file as suggested. Did not work, and now
Gramps does not show even a generic icon for PDF files on the Gallery
tab. The files will still open, so I have not gone backward! I also
tried using “x200” instead of “x%s”, in case the size spec was not
recognized by ImageMagick.
I added the line to gnomethumb.py. Where does that output go to? I
suspect there is a log file somewhere, but I cannot find it.
When Gramps generates a thumbnail, where does it go? I have a directory
called ~/.cache/thumbnails, but nothing in there is from Gramps.
The output goes to stdout
. Look in the console.
The default location is ~/.cache/gramps/thumb
when using the XDG directory specification. The old default location was ~/.gramps/thumb
.
This directory has two sub-directories: normal
and large
.
These default locations can be over-ridden using environment variables.
I do not have ~/.cache/gramps/thumb. Old installation! I have
~/.gramps/thumb. Looking through the files in it, I do not see any that
derive from a PDF. There are plenty of files from the work I have done
today, all derived from JPGs.
Starting Gramps from a shell prompt gives me this output:
bgee@main2:~$ gramps
(gramps:1837338): Gtk-WARNING **: 10:07:15.705: Theme parsing error:
gtk.css:6:28: The style property GtkRange:slider-width is deprecated and
shouldn’t be used anymore. It will be removed in a future version
(gramps:1837338): Gtk-WARNING **: 10:07:15.705: Theme parsing error:
gtk.css:7:28: The style property GtkRange:stepper-size is deprecated and
shouldn’t be used anymore. It will be removed in a future version
bgee@main2:~$
I see nothing in there from the line in gnomethumb.py. Just to be sure
I got it right, here is an extract from the file beginning at line 57:
LOG = logging.getLogger(“.thumbnail”)
class GnomeThumb(Thumbnailer):
def init(self):
self.all_mime_types = {}
if lin():
self.__find_thumbnailers()
print (self.all_mime_types)
def __find_thumbnailers(self):
path_list = GLib.get_system_data_dirs()
path_list.append(GLib.get_user_data_dir())
file_list = []
for path in path_list:
file_list.extend(
glob.glob(os.path.join(path, "thumbnailers",
“*.thumbnailer”))
)
If it isn’t finding the thumbnailer, then it would be worth printing the contents of path_list
to see where it is looking on your system.
I confess to profound ignorance … How the heck does one print the
value of path_list??
I found an article in Discourse about troubleshooting Gramps paths and
environment. It has a bit of Python code to be run in the Python
Evaluation gramplet. That gramplet requires starting Gramps with a
developer option - which I cannot find documented anywhere.
Thinking about it, though, I think there is another important fact to
recognize. Somehow Gramps is finding a way to generate thumbnails for
JPG files. Is that because of a file in /use/share/thumbnailers? I
don’t know of a way to determine that. There IS a file in that
directory called gdk-pixbuf-thumbnailer.thumbnailer which contains MIME
types for various image file formats including JPG and JPEG. Is Gramps
using that file? If it is, then it ought also to be using the
pdf.thumbnailer file.
If Gramps is trying (and failing) to use the pdf.thumbnailer file, does
it log errors anywhere?
Running “gramps --show” produces a completely empty list. Every item is
set to ‘’ However, the .ini file it references is NOT empty. If I use
the --config= option to display one particular setting, that shows valid
information. “gramps --config=researcher.researcher-city” will show my
city.
Running “gramps --version” produces a list that contains this set of
path entries:
PYTHONPATH:
/usr/lib/python3.13/site-packages/gramps
/usr/lib64/python313.zip
/usr/lib64/python3.13
/usr/lib64/python3.13/lib-dynload
/usr/lib64/python3.13/site-packages
/usr/lib/python3.13/site-packages
/home/bgee/.gramps/gramps52/plugins/lib
System PATH env variable:
We have two thumbnailers installed by default. One uses GdkPixbuf
to thumbnail all files with the mime types image/*
. The other tries to find and use any Gnome thumbnailer that is installed.
Our GnomeThumb
plugin looks for a sub-directory called “thumbnailers” in the directories that are returned by GLib.get_system_data_dirs()
and GLib.get_user_data_dir()
. I don’t know what they will return on your system. The directory /usr/share/thumbnailers
is where the Gnome thumbnailers are registered on my system.
The alternative would be to write your own Pdf thumbnailer as an addon.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.