You have 2 options to still use your control without enabling it in a web browser, both requires you to change your app to interact with the control though, not sure if this an available option to you -
1) In your Visual Studio project, right-click on the project in Solution Explorer.
Choose "Add" -> "Reference..."
Go to the "COM" tab, and look for "Adobe PDF Reader" or similar.
Add the reference 'AXAcroPDFLib' to your project.
Open your WinForms designer.
Find the 'AxAcroPDFLib.AxAcroPDF' control in your toolbox.
Drag and drop it onto your form.
In your form's code, initialize the control.
You might do this in your form's constructor or load event, code will look similar to -
Imports AxAcroPDFLib
Public Class YourForm
Private pdfViewer As AxAcroPDFLib.AxAcroPDF
Public Sub New()
InitializeComponent()
InitializePdfViewer()
End Sub
Private Sub InitializePdfViewer()
pdfViewer = New AxAcroPDFLib.AxAcroPDF()
CType((pdfViewer), System.ComponentModel.ISupportInitialize).BeginInit()
pdfViewer.Enabled = True
pdfViewer.Location = New System.Drawing.Point(10, 10)
pdfViewer.Name = "pdfViewer"
pdfViewer.OcxState = Nothing
pdfViewer.Size = New System.Drawing.Size(800, 600)
pdfViewer.TabIndex = 0
Me.Controls.Add(pdfViewer)
CType((pdfViewer), System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Private Sub LoadPdf(filePath As String)
If System.IO.File.Exists(filePath) Then
pdfViewer.LoadFile(filePath)
Else
MessageBox.Show("File not found.")
End If
End Sub
End Class
2) To use the 'Adobe AXAcroPDFLib' control in a web browser, you will have to embed it within an HTML page. You must utilize an 'object' tag with the appropriate 'classid' for the Acrobat Reader control -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Open the PDF in my browser</title>
</head>
<body>
<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"
id="pdfViewer"
width="800"
height="600">
<param name="src" value="your_pdf_file.pdf"> <!--
<param name="type" value="application/pdf">
<embed src="your_pdf_file.pdf" type="application/pdf" width="800" height="600">
<!--
<p>PDF viewer not supported. Download the PDF to view it.</p>
</embed>
</object>
</body>
</html>
HTML code will embed the Adobe Acrobat Reader control into a users browser and attempt to display the specified PDF file. Users without the Acrobat Reader plugin may see an alternative content.
Keep in mind that embedding specific plugins in a users web page can have compatibility and security implications and issues. Maybe think about using alternative approaches such as using a 'PDF.js' library for a more browser-neutral solution -
A general-purpose, web standards-based platform for parsing and rendering PDFs[
^]