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

Posted on 2003-11-06
Medium Priority
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)

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.


Question by:readjf
LVL 28

Expert Comment

ID: 9697110
You can use web browser control

Dim sPath As String = "c:\temp\test.pdf"

Also check this site

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

Author Comment

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?


Author Comment

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.

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

LVL 28

Expert Comment

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"

    End Sub
End Class


Dim psi As New ProcessStartInfo()
psi.UseShellExecute = True
psi.FileName = "H:\docs\lshort.pdf"

Author Comment

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.

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.

EE Cleanup Volunteer

Accepted Solution

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

EE Moderator

Author Comment

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
LVL 28

Expert Comment

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

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

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.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Native ability to set a user account password via AD GPO was removed because the passwords can be easily decrypted by any authenticated user in the domain. Microsoft recommends LAPS as a replacement and I have written an article that does something …
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…

597 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