none
AxAcroPDF1.src is not showing pdf-file content RRS feed

  • Question

  • Hi,

    I need to display a pdf-file is my application (user manual). For a single form trial case I use the Adobe PDF Reader and drag a box on the form.

    With the command

    AxAcroPDF1.src = Fln

    the file is displayed. So far so good; but doing the same where the form is part of a larger project, but as simple as the single form case, the content is not shown. No error message or warning (the file exists and is found). So, there must be something wrong in the program itselve. However, commenting out the statement the program runs as should, with validatable results.

    I searched internet, but didn't find a clue. I even redo the added form: no effect.

    Any suggestion is highly appreciated.

    With best regards,

    GerritV2

    AxAcroPDF1.src = Fln

    Tuesday, July 25, 2017 7:44 PM

Answers

  • Hi Cherry, thanks for your reply.

    Option Strict On
    Imports System
    Imports System.Drawing
    Imports System.IO
    Imports System.Drawing.Printing
    Imports System.Windows.Forms
    Imports System.Runtime.InteropServices
    Imports System.ComponentModel
    
    Public Class Form1
        Inherits System.Windows.Forms.Form
    
        Private Sub Form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Dim Pad As String
            Dim Fln As String
    
            Pad = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
            Pad = Mid(Pad, InStr(Pad, "\") + 1)
    
            Fln = Pad & "\TMD.pdf"
            AxAcroPDF1.src = Fln
    
        End Sub
    
    End Class


    I add the code of the dummy program to check the working of the

    AxAcroPDF1.src = Fln statement.

    It works fine (I left out the form with the pdf window).

    Adding a form with the same code in my real application opens the window, but remains black. (I added a check that the file was found).

    I compared the properties, they are the same.

    A mistory for me.

    Regards,

    GerritV2

    I solved the problem by replacing the above by :

    Process.Start (Fln) Fln with extention PDF and let the external pdf-reader do its job.

    Wednesday, July 26, 2017 8:44 AM

All replies

  • but doing the same where the form is part of a larger project, but as simple as the single form case, the content is not shown. No error message or warning (the file exists and is found). So, there must be something wrong in the program itselve. However, commenting out the statement the program runs as should, with validatable results.

    Hi GerritV2,

    I am not particularly aware of this part of the content, do you mean that you have some problem about AxAcroPDF1 and the content will not show when your project is very larger?

    If yes, I think the larger or small of the project should have no effect on the functionality of AxAcroPDF1.

    Dim ofd As New OpenFileDialog()
            ofd.Filter = "PDF Files(*.pdf)|*.pdf|WORD Files(*.doc;*.docx)|*.doc;*.docx|EXCEL Files(*.xlsx;*.xlsm;*.xlsb;*.xltx;*.xltm;*.xls;*.xlt)|*.xlsx;*.xlsm;*.xlsb;*.xltx;*.xltm;*.xls;*.xlt|Image Files(*.jpg;*.gif;*.bmp;*.png;*.jpeg)|*.jpg;*.gif;*.bmp;*.png;*.jpeg|All Files|*.*"
            If ofd.ShowDialog() = DialogResult.OK Then
                Dim path As String = ofd.FileName.ToString()
                TextBox1.Text = path
                AxAcroPDF1.src = TextBox1.Text
            End If

    The above code work fine.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, July 26, 2017 6:44 AM
    Moderator
  • Hi Cherry, thanks for your reply.

    Option Strict On
    Imports System
    Imports System.Drawing
    Imports System.IO
    Imports System.Drawing.Printing
    Imports System.Windows.Forms
    Imports System.Runtime.InteropServices
    Imports System.ComponentModel
    
    Public Class Form1
        Inherits System.Windows.Forms.Form
    
        Private Sub Form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Dim Pad As String
            Dim Fln As String
    
            Pad = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
            Pad = Mid(Pad, InStr(Pad, "\") + 1)
    
            Fln = Pad & "\TMD.pdf"
            AxAcroPDF1.src = Fln
    
        End Sub
    
    End Class


    I add the code of the dummy program to check the working of the

    AxAcroPDF1.src = Fln statement.

    It works fine (I left out the form with the pdf window).

    Adding a form with the same code in my real application opens the window, but remains black. (I added a check that the file was found).

    I compared the properties, they are the same.

    A mistory for me.

    Regards,

    GerritV2

    I solved the problem by replacing the above by :

    Process.Start (Fln) Fln with extention PDF and let the external pdf-reader do its job.

    Wednesday, July 26, 2017 8:44 AM
  • Hi GerritV2,

    Glad to hear this issue has been solved by yourself. Thanks for your sharing, I will introduce this
    experience to other forum users who face the same condition. Please mark your reply to close this case.

    Thanks for your understanding and support.

    Best Regards,

    Cherry



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 31, 2017 8:51 AM
    Moderator