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
449 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
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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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 …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now