Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adobe reader control delays load
Message
From
16/08/2010 12:55:25
 
 
To
12/08/2010 18:34:25
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01476404
Message ID:
01476656
Views:
28
Well, it seems that this is a know issue with adobe - the reader grabs the focus after a load. I have not found a fix for this.

So, I looked at an alternative to the Adobe reader and I found the FoxItReader.

That one works in regards to the setting of the focus.

However, now I got the problem that I need to move the pdf file after processing and the error thrown then is an access error (because the reader still has it open).

I could not find a close command on that reader and just loading another blank pdf does not work either. So I thought of destroying the control and recreating it - but I got some issues with this since I am not that familiar with VB (I am realy a VFP guy :-) ).

Here is what I have so far, I would appreaciate any help you could give me:
Public Sub DestroyAndAddReader()
        Dim n_Left, n_Top, n_Width, n_Height

        n_Left = DocProcess_Main.AxAcroPDF1.Left
        n_Top = DocProcess_Main.AxAcroPDF1.Top
        n_Width = DocProcess_Main.AxAcroPDF1.Width
        n_Height = DocProcess_Main.AxAcroPDF1.Height

        DocProcess_Main.Controls.Remove(DocProcess_Main.AxAcroPDF1)


        Dim o_PDFReader As New FoxitReaderOCX
        'Dim f As System.Reflection.FieldInfo
        'f = GetType(AxHost).GetField("licenseKey", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
        'f.SetValue(o_PDFReader, "gnvlslnjskvlmlgnnimh")

        DocProcess_Main.Controls.Add(o_PDFReader)                           ' throughs error as described below
        o_PDFReader.Name = "AxAcroPDF1"
        o_PDFReader.Location = New Point(n_Left, n_Top)
        o_PDFReader.Size = New Size(n_Width, n_Height)
        o_PDFReader.Show()


        'o_PDFReader = New FoxitReaderOCX
        'DocProcess_Main.Controls.Add(FoxitReaderOCX)
        'DocProcess_Main.AxAcroPDF1.Name = "AxAcroPDF1"

        'DocProcess_Main.AxAcroPDF1.Location = New(Point(n_Left, n_Top))
        'DocProcess_Main.AxAcroPDF1.Size = New Size(n_Width, n_Height)
        'DocProcess_Main.AxAcroPDF1.Visible = True

        'o_PDFReader = New FoxitReaderOCX
        'o_PDFReader.Name = "AxAcroPDF1"
        'o_PDFReader.Location = New Point(n_Left, n_Top)
        'o_PDFReader.Size = New Size(n_Width, n_Height)
        'DocProcess_Main.Controls.Add(o_PDFReader)
        'DocProcess_Main.AxAcroPDF1.Visible = True
    End Sub
The error thrown is:
Unable to cast COM object of type 'FOXITREADEROCXLib.FoxitReaderOCXClass' to class type
'System.Windows.Forms.Control'. Instances of types that represent COM components cannot be
cast to types that do not represent COM components; however they can be cast to interfaces as
long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform