darktable lua script 'selection_to_pdf'

I am trying to use the Lua script “selection_to_pdf” to create an overview of an image selection as a PDF file.

Unfortunately I can’t get along with it, because it gives error messages.

I use Arch Linux and darktable 3.8.0, xdg-open 1.1.3 and pdflatex shows the following version information:

$ pdflatex --version
pdfTeX 3.141592653-2.6-1.40.23 (TeX Live 2021/Arch Linux)
kpathsea version 6.3.3
Copyright 2021 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03

I have selected 10 images in the lighttable and specified “Export thumbnails to pdf” as the destination file in the export module. I specified a title and a filename with save path.

Auswahl_048

When I click on ‘export’ I can see that the selected images are exported. At the end the message ‘problem running pdflatex’ appears briefly in darktable. In the output of the terminal I see the following message:

This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021/Arch Linux) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/tmp//pdfout.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2021-11-22>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/share/texmf-dist/tex/latex/graphics-def/pdftex.def)))
(/usr/share/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty
(/usr/share/texmf-dist/tex/generic/iftex/iftex.sty)))
(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(/tmp//pdfout.aux) (/usr/share/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).
) (/usr/share/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
(/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex

LaTeX Warning: File `{/tmp/_DSF3488-0025 Citiyscape - Frankfurt_06}.pdf' not fo
and on input line 11.


! Package pdftex.def Error: File `/tmp/_DSF3488-0025 Citiyscape - Frankfurt_06.
pdf' not found: using draft setting.

See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
 ...                                              
                                                  
l.11 ...F3488-0025 Citiyscape - Frankfurt_06}.pdf}
                                                  \newline
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on /tmp//pdfout.log.
29.943748 LUA ERROR : ...unix/.config/darktable/lua/official/selection_to_pdf.lua:166: Problem running pdflatex -halt-on-error -output-directory /tmp/ pdfout.tex
stack traceback:
	[C]: in ?
	[C]: in function 'error
	...unix/.config/darktable/lua/official/selection_to_pdf.lua:166: in function <...unix/.config/darktable/lua/official/selection_to_pdf.lua:120>

In the message I can see that a file is missing. This file is actually not present.

[/tmp]$ ls _D*
'_DSF3484-0021 Citiyscape - Frankfurt.pdf' '_DSF3488-0025 Citiyscape - Frankfurt_99.pdf'
[/tmp]$ 

If I select only one image in the lighttable and start the export with the same settings it works. A PDF is created with a thumbnail, but in portrait format and not in landscape format as specified in the export.

Probably I just don’t understand how to use the module correctly. Maybe one of you has a hint for me? Is the version of pdflatex wrong?

Greetings,
majobu

I tried the script and it works for me.

Looking at the output I’m wondering if it is a problem with spaces in the filenames, since you’re on linux and pdflatex is executing from a shell. Can you try running the script against a set of images that dont have spaces in the filename?

(La)tex in all its flavours, including pdfTex, doesn’t like spaces in filenames… A solution seems to be (untested) to put the filename between double quotes: "filename with spaces.jpg". This shouldn’t hurt for filenames not containing spaces.

There are traces of its age in LaTeX :wink:

@wpferguson & @rvietor
Thank you guys for the tips. I tried it without spaces in the filenames. Unfortunately without success. The output messages remain as described…

I will now try shorter file names. Maybe LaTeX has a problem with that?

Have also tried it with shortened filenames… That does not work either.

Try to set the file format (your 3rd red frame) to JPG instead of PDF.

1 Like

@pass712 thank you :+1:
That’s great. With the setting to .jpeg it works and a PDF is created for me as an overview. But now I have an image with several versions and only the first version is used in the overview (PDF).