I realize this is old question but I want to share my solution which I figured after having started using PDFXchangeEditor (successor to PDFXchangeViewer) then bumped into issue to make it accepts multiple input files from host os. First of all, the accepted answer and all other answers which have been posted assume that the program will only handle a single file. You can actually throw multiple file args at once to it and it will open them all fine, with a little trick.
The trick is using %F
code expansion in Exec
field in the app's .desktop launcher and preceed all the expanded local file args in the field with Z:
which can be done with the following script
Call it wine-env
. This goes in /usr/local/bin
and be sure to give it chmod +x
#!/bin/bash
allargs=("$@")
fixpath=0
for idx in "${!allargs[@]}"; do
arg="${allargs[$idx]}"
if [[ $fixpath -eq 0 ]]; then
# fix file paths only after the first executable is found in arg
if [[ "$arg" == *.exe ]]; then
fixpath=1
fi
continue
elif [[ $fixpath -eq 1 ]]; then
# if arg starts with '/' and it's a path that exists on host
# precede the path with drive 'Z:'
if [[ "${arg:0:1}" == '/' && -e "$arg" ]]; then
allargs[$idx]="Z:$arg"
fi
fi
done
exec env "${allargs[@]}"
And for the app's .desktop file, call it pdfxce.desktop
and put it in ~/.local/share/applications/
and its content should look like this
[Desktop Entry]
Name=PDF-XChange Editor
Type=Application
Terminal=false
Exec=wine-env WINEDEBUG=-all WINEPREFIX=/home/<user>/.local/share/bottles/pdfxce wine PDFXEdit.exe %F
Icon=/home/<user>/.local/share/icons/bottles/pdfxce-pdfxedit.png
Path=/home/<user>/.local/share/bottles/pdfxce/drive_c/Program Files/Tracker Software/PDF Editor
StartupNotify=true
StartupWMClass=PDFXEdit.exe
You need to change the part with your own username. I keep all of my wineprefixes dirs in a folder called "bottles". You may have your own way to organize your wineprefixes so change all the parts that contain "bottles" accordingly
And last step, assign PDF files to the app as per normal (Right click on pdf -> Properties
-> Open With
tab)
Reference: Freedesktop's desktop entry specification
"c:/Program\ Files/Tracker\ Software/PDF\ Viewer/PDFXCview.exe"