?
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
Medium Priority
?
491 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
Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

 
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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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