Solved

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

Posted on 2003-11-06
9
481 Views
Last Modified: 2012-05-04
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



0
Comment
Question by:readjf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 28

Expert Comment

by:iboutchkine
ID: 9697110
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
 

Author Comment

by:readjf
ID: 9721433
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
 

Author Comment

by:readjf
ID: 9721659
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 28

Expert Comment

by:iboutchkine
ID: 9721811
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
 

Author Comment

by:readjf
ID: 9722539
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 10256141
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
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 10314759
PAQed, with points refunded (500)

SpazMODic
EE Moderator
0
 

Author Comment

by:readjf
ID: 10320567
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
 
LVL 28

Expert Comment

by:iboutchkine
ID: 10321731
You can create a new post "Points for iboutchkine"
0

Featured Post

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question