Results 1 to 33 of 33

Thread: Acrobat Files - Open/Close?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Acrobat Files - Open/Close?

    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

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

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Pete, thanks as ever for your help:

    Well I am making progress I think

    this is now the code

    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?

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    Hi,
    drop the file.open - you just need the process.start

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Pete

    Thanks again,

    The code now is

    Code:
    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

  6. #6
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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/lib...t5(VS.80).aspx

    But it only seems to confirm what I am doing should work
    Last edited by JohnSavage; May 17th, 2007 at 01:39 PM.

  8. #8
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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

  10. #10
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    What about trying
    "\My Documents\help1.pdf"
    complete with quotes - does that help?

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Pete

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

  12. #12
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Pete,

    The line of code

    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

  14. #14
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    What does
    Process.Start(chr(34) & "\My Documents\help1.pdf" & chr(34))
    do?
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Pete

    It gets me an error that says

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

  16. #16
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Good Morning Pete,

    Code:
    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.
    Last edited by JohnSavage; May 20th, 2007 at 06:33 AM.

  18. #18
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    Hi,
    sorry - mistyped it
    Should be
    process.start("My Documents\help1.pdf","")
    or
    process.start("\windows\infbeg.wav","")


    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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.

  20. #20
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Resolved Re: Acrobat Files - Open/Close?

    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
    Last edited by petevick; May 20th, 2007 at 12:26 PM.
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  21. #21

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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.

  22. #22
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  23. #23

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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?

  24. #24
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    Hi,
    yep - sure can.
    I did a review of fasthelp here and I am pretty sure MSDN has some step by step examples

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  25. #25

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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


    Code:
    Process.Start("\Program Files\Max3\help1.mhtml", "")
    To open it I get the message that there is no application assoiated with this file

  26. #26
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  27. #27

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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.

  28. #28

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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?

  29. #29
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  30. #30

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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.

  31. #31

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    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

    Code:
    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

  32. #32
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Acrobat Files - Open/Close?

    Hi,
    glad it is working - I will refrain from making any disparaging remarks about Acrobat Reader on a PDA

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  33. #33

    Thread Starter
    Fanatic Member
    Join Date
    May 2006
    Posts
    612

    Re: Acrobat Files - Open/Close?

    Cheers Pete, however it looks like your remarks would be justified in this case

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width