[dba-VB] Open PDF file

David Emerson newsgrps at dalyn.co.nz
Mon Nov 26 11:27:25 CST 2007

Thanks all for the responses - I will start looking at them today.

Sorry about the confusion - The users open the PDF files on their own 
computers, not the server.

James, to answer your question below, another developer has written 
the web pages (as part of a larger application) which take a list of 
records from a table and produces a page which has all the reports 
available with check boxes beside them.  Most of the reports are 
created from Active Reports (a report add on to Dot Net - it has a 
very similar graphic interface for developing to Access).  When the 
user has selected the reports they want then a list of ID's is sent 
to my web application which loops through the ID's, gets the report 
details (file location, type etc) and merges them together into one 
PDF for the users to save etc (the Active Report report files can be 
merged together and exported as PDF's).  Because several reports are 
merged  together (and this depends on the user selection) hyperlinks 
would not work in this case.

However, some "reports" are already PDF's and they would be opened as 
separate files (not merged in with the other reports).  These are the 
ones I am wanting to show in a different browser window.



At 27/11/2007, you wrote:
>How are you displaying the list of files? I do something similar using an
>ASP.Net table and adding the filenames as cells with a hyperlink to the
>appropiate file on the server. It is the client that needs to have Adobe
>installed, not the server since it is the client that renders the file.
>Below is the code. It loops through all the files in a specified directory.
>For each file you create a new row in the table, create a new cell, set the
>cell text to a clickable hyperlink to the appropriate file and add the row
>to the ASP.net table. The directories are all relative to the root directory
>of the website. The pfd files open in a new browser window. If the client
>does not have Adobe installed, they should get the option of saving the file
>Hope this helps.
>James Barash
>Dim root As String = Server.MapPath(".") & "/" & strDir
>Dim files() As String
>files = System.IO.Directory.GetFiles(root, "*")
>Dim strFilename As String, f as String
>For Each f In files
>strFilename = System.IO.Path.GetFileName(f)
>row = New Web.UI.WebControls.TableRow
>cell = New Web.UI.WebControls.TableCell
>cell.Text = "<a href=""" & "./" & strDir & "/" & strFilename & """
>target=""_blank"" >" & strFilename & "</a>"
>Next f
>-----Original Message-----
>From: dba-vb-bounces at databaseadvisors.com
>[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of David Emerson
>Sent: Monday, November 26, 2007 12:15 AM
>To: dba-vb at databaseadvisors.com
>Subject: [dba-VB] Open PDF file
>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
>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?
>David Emerson
>Dalyn Software Ltd
>Wellington, New Zealand
>dba-VB mailing list
>dba-VB at databaseadvisors.com
>dba-VB mailing list
>dba-VB at databaseadvisors.com

More information about the dba-VB mailing list