Ubuntu – Thunar – Custom actions: select pdf extract pages as images

convert-commandpdfthunarthunar-custom-actions

I like this command to convert pdf pages to png images:

pdftoppm -png *.pdf prefix

(my source is this answer)

I would like to add a command to Thunar custom actions that would convert the selected pdf's pages to separate images.


When I use the option "Open terminal here" in the folder containing the pdf, and then add the above command, it works fine.

So, what I would like is a Thunar custom action with a command that (1): opens a terminal window in that folder, AND (2): runs that command in the terminal window

If I create a custom action with the command xfce4-terminal, Appearance conditions: Directories, that will open the terminal in that folder.

If I replace the command with xfce4-terminal -e "pdftoppm -png *.pdf prefix", nothing seems to happen. To see clearer it is useful to keep that terminal window open after the command was run, but I do not know how to do that with the Xfce terminal.

Using gnome-terminal I create a profile called new1 with the setting "When command exits: Hold the terminal open" then add to custom action this command:

gnome-terminal --window-with-profile=new1 -e "pdftoppm -png *.pdf prefix"

But this gives an error;

I/O Error: Couldn't open file '*.pdf': No such file or directory.

Best Answer

Test this:

Converting PDF to PNGs

Name: To PNG
Command: pdftoppm %f -png %f.png
File pattern: *.pdf
Appears if selection contains: Image Files