Viewing a PDF file in a form. For different versions of adobe reader, probably a late binding question.

We are displaying a PDF in a form by using an activeX installed with the Adobe Reader.

Hence we have in the generated form code:-

    Me.AxPdf1 = New AxPdfLib.AxPdf

We then manipulate the pdf object as necessary, for example.

      AxPdf1.LoadFile(scandoc.inwardDirectory(mDb) & "/" & scandoc.filename)
      AxPdf1.setShowToolbar(False)

This all works fine. However we can't guarantee what version of Adobe Reader the pc has on it. Therefore we would normally want to late bind. With something like:-

    dim axpdf as object
    axpdf1 = createObject("x.y")

but I have no idea what x.y should be.

Can anyone tell me how to make the pdf document appear in the form using this or another method.

Thanks



readjfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iboutchkineCommented:
You can use web browser control

Dim sPath As String = "c:\temp\test.pdf"
        AxWebBrowser1.Navigate(sPath)


Also check this site
http://www.o2sol.com/public/webui/home.shtml

PDF4NET is a .NET library for embedding pdf documents creation in ANY .NET application. Its simple,
but powerful object model allows to create complex pdf documents with a few lines of code. Written
entirely in C#, it is a 100% .NET component, not just a COM wrapper
0
readjfAuthor Commented:
We attempted to use the webbrowser component. Initially this appeared to operate satifsfactorily although we received the Adobe splash screen on each time the document was changed.

However we get an intermittent problem when loading subsequent files or reloading the original file. We cannot make these appear consistently but it feels like Adobe is not unloading the last document or is still in the process of doing so.

We are trying various ways to trying to identify what is happening.

The suggested component PDF4NET appears to be concerned with creating PDFs rather than viewing them. A search on the internet has so far shown up no PDF viewers apart from Adobe Reader itself.

Any thoughts?

 
0
readjfAuthor Commented:
One of the errors that we get is:-

"One or more PDF documents are open insidea Web Browser. If you exit Adobe REader now, those documents will be closed. Are you sure you want to exit?"

On occasions this warning box cannot be accessed until the .net application is exited.

We also on occasions get a message that the activeX component could not find acrobat.

Johnny
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

iboutchkineCommented:
If you need just to see PDF file you can do

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim proc As New System.Diagnostics.Process()

        proc.StartInfo.FileName = "iexplore.exe"
        proc.StartInfo.Arguments = "c:\temp\Qckstart.pdf"
        proc.Start()

    End Sub
End Class

or



Dim psi As New ProcessStartInfo()
psi.UseShellExecute = True
psi.FileName = "H:\docs\lshort.pdf"
Process.Start(psi)
0
readjfAuthor Commented:
We really want the PDF in a window. The application provides a list of PDF's that have been scanned into a directory and then allows the user to look at them and add a comment into a database.

However the process launch suggested above is similar but neater than something we have used elsewhere so we may use that anyway.

I am now wondering if the problems that we are having are due to problems in Acrobat Reader 6. There seems to be some suggestion that this is the case. We are going to try pausing while AxWebBrowser1.busy is true to see if this helps. And then try using Acrobat 5 as an alternative.

We'll let you know how it goes.

Johnny
0
Bob LearnedCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0
SpazMODicCommented:
PAQed, with points refunded (500)

SpazMODic
EE Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
readjfAuthor Commented:
In the end we used the WebBrowser component suggested above. However we found that it didnt work reliably with Adobe version 6.0 so we have backtracked to version 5.

So I'd like to have awarded the points to iboutchkine however the system seems to have defeated me, sorry
0
iboutchkineCommented:
You can create a new post "Points for iboutchkine"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.