|
-
Apr 29th, 2005, 02:05 AM
#1
Thread Starter
Addicted Member
Show PDF [Resolved]
Hi,
How can I show a PDF from vb.net form?
Last edited by haihems; May 2nd, 2005 at 11:22 PM.
Think Before Ink
Visual Studio .NET 2002/.NET Framework 1.0
-
Apr 29th, 2005, 08:34 AM
#2
Member
Re: Show PDF
Code:
Process.Start("H:\Jetway Manual.pdf")
This form of code assumes that there is the standard file association between Adobe Acrobat and .pdf file extensions and will fire up Acrobat and show the named file.
Last edited by XTab; Apr 29th, 2005 at 08:39 AM.
-
Apr 29th, 2005, 11:30 PM
#3
Re: Show PDF
if you have the full version of adobe acrobat installed, then you will be able to use the PDF ActiveX control that comes with it.
-
Apr 29th, 2005, 11:35 PM
#4
Re: Show PDF
 Originally Posted by tr333
if you have the full version of adobe acrobat installed, then you will be able to use the PDF ActiveX control that comes with it.
Not quite true, if you have Acrobat Reader you can use the pdf.ocx to display a pdf on a form, etc. depending on
how much control you want over it you may still have to use the full version though.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2005, 10:49 PM
#5
Thread Starter
Addicted Member
Re: Show PDF
Hi,
Thanks for your response. i did the following and it works.
VB Code:
Dim pdfProcess As Process
pdfProcess = pdfProcess.Start("AcroRd32.exe", "c:\temp\a.pdf")
I've one more doubt. I hope the exe names for Acrobat will change like 'AcroRd32.exe' , 'Acro32.exe' etc., for different windows version. So how can I know the name of Acrobat's exe file in client' machine?
Or straightly can i give
pdfProcess= pdfProcess.Start("c:\temp\a.pdf")
to open the pdf straightly.
If there is no acrobat reader in clinet's machine , how can i track it???
Regards,
Hems.
Think Before Ink
Visual Studio .NET 2002/.NET Framework 1.0
-
May 2nd, 2005, 10:58 PM
#6
Re: Show PDF
Here is a way to get the associated program with the .pdf extension. Note, if the users system has another
program instead of Acrobat to open .pdf files then it will get that program and not Arobat.
VB Code:
Option Explicit On
Imports System.IO
Public Module Module1
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, _
ByVal lpDirectory As String, ByVal lpResult As String) As Integer
Public Sub FindAcrobat(ByVal strRunMe As String)
Try
'CREATE SOME VARIABLES
Dim PDFExec As String = New String(" "c, 255)
Dim strFileName As String
Dim lRet As Long
Dim SWriter As StreamWriter
'CREATE A TEMP PDF FILE SO WE CAN FIND OUT WHERE THE LOCATION IS ONE ON THE SYSTEM
strFileName = Application.StartupPath & "\temp.pdf"
SWriter = File.CreateText(strFileName)
SWriter.Write("1")
SWriter.Close()
'CALL THE API TO FIND THE EXE ASSOCIATED WITH MOV FILES
lRet = FindExecutable(strFileName, vbNullString, PDFExec)
PDFExec = PDFExec.Trim
'IF WE GET ONE, LAUNCH THE PDF IN A NEW INSTANCE OF ACROBAT
If lRet <= 32 Or PDFExec = String.Empty Then
MessageBox.Show("Could not find Acrobat")
Else
Process.Start(PDFExec, strRunMe)
End If
'DELETE THAT PESKY TEMP FILE
File.Delete(strFileName)
Catch ex As Exception
'IF ANYTHING GOES WRONG, LET PEOPLE KNOW WHO'S FAULT IT IS
MessageBox.Show("An error has occured!" & ControlChars.CrLf & ex.Message)
End Try
End Sub
End Module
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2005, 11:03 PM
#7
Thread Starter
Addicted Member
Re: Show PDF
Thanks RobDog !!
Sure, this is helpful for me !!!
Think Before Ink
Visual Studio .NET 2002/.NET Framework 1.0
-
May 2nd, 2005, 11:08 PM
#8
Re: Show PDF
I hope so, but I just modified a class klienma gave me to work for IE and made it work for Acrobat.
So, I can only take partial credit.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|