viewing a pdf on linux

I am using the following xojo code on windows and it works great. On Ubuntu Linux, it fails with error 2. What am I doing wrong? Please not I had to use a forward slash on Linux.

Dim sh As New Shell
Dim cmd As String
cmd = Str(SpecialFolder.Documents.nativepath) + “Sugar\SugarUserManual.pdf”

If Keyboard.AsynckeyDown(&h7A) Then 'F1 key

'Shell to a specific file. You have to pass it the filename arg in quotes.



MsgBox("Could not find " + cmd)
End Try

ElseIf Keyboard.AsynckeyDown(&h35) Then 'Esc
End If

What I am trying to do is schedule a pdf viewer to see the pdf file I used in my cmd. Windows works, Linux does not.
Can you help?

Have you looked at cmd ? Could it be that on Linux it does not do what you expect ?

shouldnt you be using

SpecialFolder.Documents.child ("Sugar").child("SugarUserManual.pdf").launch  

alternative way: Use MBS Xojo DynaPDF Plugin and add a PDF viewer window to your app.

With Linux you have to specify the PDF reader program and then give it the file path as a parameter.

On Ubuntu that would be something like: xdg-open File

You shouldn’t need the Str() in your code either. So try:

cmd = "xdg-open " + SpecialFolder.Documents.nativepath + "Sugar\\SugarUserManual.pdf"

MBS Xojo DynaPDF is good if you need to control the PDF yourself

That’s it! Thank you so much. Thank you to ALL who responded.