Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to open PDF using PDF-XChange Viewer through WINE. How should I specify the pdf file name in the "custom command" line so that I can open a PDF file using PDF-XChange Viewer by double clicking it? I tried to use the \"z:%f\" following the suggestion here for using Foxit reader. But my PDF-XChange Viewer only starts with an empty window.

wine "c:/Program Files/Tracker Software/PDF Viewer/PDFXCview.exe" \"z:%f\"

I use Ubuntu 10.04 and WINE 1.2.2. PDF-XChange Viewer version 2.5.

share|improve this question
    
I suspect you need "c:/Program\ Files/Tracker\ Software/PDF\ Viewer/PDFXCview.exe" –  hbdgaf Apr 18 '12 at 10:14
    
No, he does not, the "" are used for that... –  Bruno Pereira Apr 18 '12 at 11:11
    
Bruno Pereira is right, I could actually start PDF-XChange Viewer if I double click on a PDF file. But the file is not opened, only the program is executed. Obviously the file name is not passed successively to the PDF viewer. –  Hongbo Zhu Apr 18 '12 at 11:18
    
Thiy this: wine `"C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe" z:"%f"` –  lukasz Apr 18 '12 at 11:38
    
@lukasz: the backticks cause the PDF viewer fail to even start. –  Hongbo Zhu Apr 18 '12 at 11:47

4 Answers 4

up vote 2 down vote accepted

Found blog entries about the same problem for Foxit reader and for PDF-XChange Viewer. None of them worked for me. So I edited them and got one tailored for my case:

#!/bin/bash  
Filename="z:${1//\//\\}"
wine "C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe" $Filename

Save this bash script and open pdf using this script. Now double click pdf files will open them using PDF-XChange Viewer.

share|improve this answer

If the script works then you should accept that answer even though it was your own.

What has worked here for other apps as far as a custom command was close to what you were trying, some small differences.

wine "C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe" Z:%f

Referenced here for photoshop with add. info on altering the display name if desired for right click use - http://ubuntuforums.org/showpost.php?p=9193687&postcount=9

share|improve this answer

If that program already installed using wine then I dont think it needs absolute path. I think only

 wine pdfxcview filename

will open the file.

Okay may be my reply is stupid. What actually you are trying to do ? are you trying to fix the program launch error ?

share|improve this answer
    
No, I did not have problem starting the pdf viewer. I guess I did not state the question clearly (I have revised the question now). I want to know how to specify input files in "custom command" s.t. when I double click a file it will be opened by pdfxcview. –  Hongbo Zhu Apr 18 '12 at 11:51

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.