[dba-VB] Launch and monitor external programs from .NET (was: Open PDF file)

David Emerson newsgrps at dalyn.co.nz
Thu Dec 6 03:24:10 CST 2007


There are no stupid questions - just stupid answers :-)

Yes the user (who was me) does have adobe reader installed.

Part of my program uses the following code to show pdf's that are 
created from DataDynamic's Active Reports (this was code provided by 
DataDynamics):

         Dim m_stream As New System.IO.MemoryStream()
         Dim rptCombined As New DataDynamics.ActiveReports.ActiveReport3

         ' Other code which creates the rptCombined report

             If Me.PdfExport1 Is Nothing Then
                 Me.PdfExport1 = New 
DataDynamics.ActiveReports.Export.Pdf.PdfExport
             End If
             Me.PdfExport1.Export(rptCombined.Document, m_stream)
             m_stream.Position = 0
             Response.ContentType = "application/pdf"
             Response.AddHeader("content-disposition", "attachment; 
filename=PVPReports.pdf")
             Response.BinaryWrite(m_stream.ToArray())
             Response.End()

It looks like some of this might be able to be used to show the pdf 
files.  What happens is that the user has the option to save or open 
the file.  This is what I want for the pdf's as well.

David

At 6/12/2007, you wrote:
>Hi David
>
>I have not tried your code ... so just a stupid question: Is Adobe 
>Reader (or another pdf-application) installed on the user's machine?
>
>/gustav
>
> >>> newsgrps at dalyn.co.nz 06-12-2007 01:48:36 >>>
>I included Gustav's code in my web application as below:
>
>Dim runPdf As New System.Diagnostics.Process
>runPdf.StartInfo.FileName = HttpContext.Current.Server.MapPath("") +
>"\PDFFiles\" + strReportFile + ".pdf"
>runPdf.StartInfo.WindowStyle = ProcessWindowStyle.Normal
>runPdf.Start()
>
>However, when it is run by a user I get the following error: No
>application is associated with the specified file for this
>operation.  It seems to be wanting to open the file on the server.
>
>Do I need to install Adobe Acrobat on the server?  I would have
>thought that it would use the local machines copy.
>
>David
>
>At 27/11/2007, you wrote:
> >Hi David et al
> >
> >A lot of useful things can be done with the Process class.
> >Some examples here:
> >
> >   http://www.thescarms.com/dotnet/Process.aspx
> >
> >/gustav
> >
> > >>> newsgrps at dalyn.co.nz 26-11-2007 06:14 >>>
> >I am using VS 2005 and VB.Net for a web site.
> >
> >I have a number of PDF files that are stored in a static folder on 
> the server.
> >
> >Users select from a list on files on a web page and I want to open
> >the files in Adobe.  Adobe reader is installed on the server.
> >
> >Can anyone give me a pointer to how I can take a string with path and
> >file name, and open it?
> >
> >Regards
> >
> >David Emerson
> >Dalyn Software Ltd
> >Wellington, New Zealand
>
>
>_______________________________________________
>dba-VB mailing list
>dba-VB at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-vb
>http://www.databaseadvisors.com



More information about the dba-VB mailing list