PDA

Click to See Complete Forum and Search --> : Acrobat Files - Open/Close?


JohnSavage
May 16th, 2007, 05:42 AM
I have installed Acrobat on my device and then placed some acrobat files which I intend to use as help files in my program files directory of the device.

Now I want to display one of the 3 files if certain conditions exist so I thought simple enough use an if then else statement and display the correct file for the conditions.

File.Open("\program files\ax3\help1")

Does not work, so what is the correct syntax please :confused:

Also how do you close the other files that are not being displayed rather than leaving them running and using up resources

petevick
May 16th, 2007, 06:35 AM
Hi,
you will need to run the acrobat reader using 'process.start' and send it the name of the file as a command line parameter I think.

Pete

JohnSavage
May 16th, 2007, 09:00 AM
Pete, thanks as ever for your help:

Well I am making progress I think :confused:

this is now the code

File.Open("\program files\ax3\help1")Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe ", "\My Documents\help1")
And it now generates this error when MenuItem2 is clicked

ErrorCode=-2147467259
Message="Win32Exception"
StackTrace:
at System.Diagnostics.Process.StartWithShellExecuteEx()
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start()
at M2_5.Form1.MenuItem2_Click_1()
at System.Windows.Forms.MenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at M2_5.Form1.Main()


Any thoughts?

petevick
May 16th, 2007, 10:51 AM
Hi,
drop the file.open - you just need the process.start

Pete

JohnSavage
May 16th, 2007, 06:21 PM
Pete

Thanks again,

The code now is

Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe", "\My Documents\help1.pdf")


This opens Acrobat Reader but then fails with an error message saying file not found.

The file is definatly at the location and is named as in the code, but reader for some reason does not find it :eek2:

petevick
May 17th, 2007, 10:03 AM
Hi,
I am assuming you can send it a parameter of the file to open, but I don't know as I have never used Acrobat on the PPC.

What about trying

Process.Start( "\My Documents\help1.pdf")

It may work like shell

Pete

JohnSavage
May 17th, 2007, 01:28 PM
Pete

No tried that one sometime ago, it fires an error:

Value of type 'String' cannot be converted to 'System.Diagnostics.ProcessStartInfo'.

This explains it

http://msdn2.microsoft.com/en-us/library/h6ak8zt5(VS.80).aspx

But it only seems to confirm what I am doing should work:eek2:

petevick
May 18th, 2007, 01:27 AM
OK,
try and run the command manually and see what happens. To get to the run command, go to the today screen, hold down the action button, and then, depending on the OS tap and hold the time (PPC 2003) or tap and hold the battery icon (WM5), then release the button. This should show a popup menu with Clock and Run. Click on Run and the run command box appears.(http://www.pocketpcdn.com/articles/run.html)

You can then type or paste in your command line from process start, and see what happens, as this should do the sames as process.start

HTH

Pete

JohnSavage
May 18th, 2007, 05:01 AM
Pete

Thanks again, this time real progress:


Using your method I appear to have some sort of a path issue. Let me explain, if I copy the help file to the root and then use the run command “\help1.pdf” it opens OK.

If I type in \My Documents\help1.pdf (with a copy of the file in that location)then I get “Cannot find ‘My’ or one of its components. Make sure the path and filename are correct and all the required libraries are available

If I type in \MyDocuments\help1.pdf then, Reader opens and then stops with the error message “There was an error opening this document. The path does not exist. Which is I suppose correct :eek2:

petevick
May 18th, 2007, 07:23 AM
What about trying
"\My Documents\help1.pdf"
complete with quotes - does that help?

Pete

JohnSavage
May 18th, 2007, 08:37 AM
Pete

YES that works, but forgive me what has this achieved?

petevick
May 18th, 2007, 09:27 AM
that if you so a process.start with
chr(34) & \My Documents\help1.pdf & chr(34) that may work,
or
Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe", chr(34) & "\My Documents\help1.pdf" & chr(34))

Pete

JohnSavage
May 18th, 2007, 10:43 AM
Pete,

The line of code

Process.Start("\Program Files\Adobe\Acrobat 2.0\Reader\acroRD32.exe", chr(34) & "\My Documents\help1.pdf" & chr(34))

Causes A.Reader to run and then close going back to my app with no errors reported, but it never displays the file. When I close the app A.Reader is not running in the background :confused:

petevick
May 18th, 2007, 10:49 AM
What does
Process.Start(chr(34) & "\My Documents\help1.pdf" & chr(34))
do?

JohnSavage
May 18th, 2007, 01:46 PM
Pete

It gets me an error that says

Value of type 'String' cannot be converted to 'System.Diagnostics.ProcessStartInfo'

petevick
May 20th, 2007, 03:01 AM
OK,
process.start("My Documents\help1.pdf,"")
should do it, provided pdf is associated with adobe reader.
if you do
process.start("\Windows\infbeg.wav") it should play the wave file, as .wav is associated with sound player

Pete

JohnSavage
May 20th, 2007, 04:23 AM
Good Morning Pete,

process.start("My Documents\help1.pdf,"")

That gets two errors

Error 1 String constants must end with a double quote.

Error 2 Value of type 'String' cannot be converted to 'System.Diagnostics.ProcessStartInfo'.



On the file association issue, I think it is associated as the file has an acrobat icon. Having gone through the active sync process to get into my device.

petevick
May 20th, 2007, 08:35 AM
Hi,
sorry - mistyped it :(
Should be
process.start("My Documents\help1.pdf","")
or
process.start("\windows\infbeg.wav","")


Pete

JohnSavage
May 20th, 2007, 10:02 AM
Pete,

process.start("My Documents\help1.pdf","")

or

process.start("\My Documents\help1.pdf","")


Both cause Acrobat Reader to run (splash screen shows) and then help1.pdf is displayed at the top of the screen in the Start position and then it closes and goes back to my application. With no errors reported.

When I later check if Acrobat is running in memory it is not.

It appears that it opens the file and then immediately closes it and the Acrobat Reader application. :confused:

petevick
May 20th, 2007, 11:30 AM
Hi,
there are other ways to process.start - if you check, you can wait until the application you started terminates.

Dim wordProc As Process = Process.Start("\My Documents\help1.pdf", "")

wordProc.WaitForExit()

Pete

JohnSavage
May 20th, 2007, 01:23 PM
Pete

I am not to sure I understand what you are saying.

This file help1.pdf is just one of 3 help files I intended to use with this app, I am trying to let the user press help while using the app and then hopefully after reading the file go back to using the app. As I said earlier in this thread the intension is to use these help files in a context sensitive way using an if, then else statement.

petevick
May 21st, 2007, 01:12 AM
Hi,
it should keep it running until you close it, unless it is an acrobat thing. Frankly, for help files, I would stick with HTML, they are more lightweight than acrobat. I use the excellent FastHelp for creating help files - creates PPC format plus web, pdf, word, chm and hlp

Pete

JohnSavage
May 21st, 2007, 04:11 AM
Pete

The reason I was going for Acrobat is I want to use pictures in the help file can this be done with HTML format?

petevick
May 21st, 2007, 05:04 AM
Hi,
yep - sure can.
I did a review of fasthelp here (http://www.devbuzz.com/content/sw_pocketpc_help_pg1.asp) and I am pretty sure MSDN has some step by step examples

Pete

JohnSavage
May 21st, 2007, 07:09 AM
Pete,

Fast Help is a little too rich for me.

I have saved a word file as an HTML file and on the desktop the picture are lost and are replaced with an empty box with a red X in the top left.

If I save the word file as an MHTML file then the pictures are OK, but if I then move it to my device and use the code


Process.Start("\Program Files\Max3\help1.mhtml", "")

To open it I get the message that there is no application assoiated with this file :confused:

petevick
May 21st, 2007, 07:42 AM
Hi,
look at http://msdn2.microsoft.com/en-us/library/ms839648.aspx or http://msdn2.microsoft.com/en-us/library/aa458838.aspx

Pete

JohnSavage
May 21st, 2007, 08:10 AM
Pete,

I have looked at these Help systems but it appears that Pocket PC likes to have all the help files separate from the applications so the user can either use the application or go look at the help file.

This is not what I am trying to create I want an application that has context sensitive help integrated with it. Which is why I have been taking up your time to date (sorry).

If I can simply display a file when I want to as a result of the user pressing a button in my application then I can control which file is displayed.

In the past I have used Acrobat files to great effect in this way Acrobat also gave me the ability to stop the user printing the help files which again suited my purposes in some cases but as we have found it appears not to easy too get it to work on the Pocket Platform.

So at your suggestion we have moved to HTML format files which again appear to do the job but will not display a picture the mhtml appears to display a picture but is not associated with pocket internet explorer and therefore I cannot use it.

JohnSavage
May 21st, 2007, 08:26 AM
Pete,

I have just tried

Process.Start("\Windows\iexplore.exe", "\Program Files\Max3\ICE.mhtml")

And it appears that Pocket Internet Exployer will not open this file type but the desktop version does. So I am left with html format but as I said when I save this file as an html I get no pictures as these are replaced by empty boxes with a red “X” in the top left corner can I fix this or is it not posible?

petevick
May 21st, 2007, 11:37 AM
Hi,
just use HTML files - not mhtml, as you can embed pictures in them. The pictures need to be in the windows folder, as does the html file.

Pete

JohnSavage
May 21st, 2007, 01:57 PM
Pete,

Ok thanks for all of your time amd effort to date, I will leave this thread open if you don't mind as I would really like to know why the Acrobat solution does not work.

JohnSavage
May 23rd, 2007, 06:41 AM
Pete,

I have just found something that’s real strange.

I have installed my application on my phone and now the PDF’s work with no problems at all using the code below

If Label44.Visible = True Then

Process.Start("\My Documents\Help1.pdf", "")
ElseIf Label47.Visible = True Then
Process.Start("\My Documents\Help2.pdf", "")
Else
Process.Start("\My Documents\Help3.pdf", "")
End If

But and here’s the catch, my phone does not have acrobat installed, but does have Clear Vue PDF installed. So it would appear that a third party software package in this case works when the original does not :eek2:

petevick
May 23rd, 2007, 07:54 AM
Hi,
glad it is working - I will refrain from making any disparaging remarks about Acrobat Reader on a PDA :)

Pete

JohnSavage
May 23rd, 2007, 08:19 AM
Cheers Pete, however it looks like your remarks would be justified in this case :cry: