?
Solved

Opening pdf in browser

Posted on 2006-10-31
14
Medium Priority
?
413 Views
Last Modified: 2008-02-01
Hi,

How can I open pdf files in browser?

pls. give me vb code?

ayha
0
Comment
Question by:ayha1999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 8

Expert Comment

by:razo
ID: 17840964
can u please provide more details on how u want to open a pdf? is it a link?
0
 
LVL 7

Author Comment

by:ayha1999
ID: 17840969
Hi,

I am storing pdf file names in the table dispaly in the page as links. when user click on the link I want to open in a new browser window?

ayha
0
 
LVL 8

Expert Comment

by:razo
ID: 17840993
just create a regular link for the pdf like u would for any other html page and have the target as _blank and ur pdf will open in a new browser
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 96

Accepted Solution

by:
Bob Learned earned 600 total points
ID: 17841232
Response.Buffer = false; //transmitfile self buffers
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment; filename=myfile.pdf")
Response.TransmitFile(documentPath) //transmitfile keeps entire file from loading into memory
Response.End

Bob


0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17841235
0
 
LVL 7

Author Comment

by:ayha1999
ID: 17849927
Hi bob,

I get an error at the following line

Response.TransmitFile <---- TransmitFile is not a member of HttpResponse

and what is documentPath?

ayha
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17851049
That method is available in 1.1, so are you using 2.0?

Bob
0
 
LVL 7

Author Comment

by:ayha1999
ID: 17851735
No. I am using ver. 1.1.

ayha
0
 
LVL 7

Author Comment

by:ayha1999
ID: 17851807
Here I am just storing pdf filename in the table and original file in a folder. then display the filename as a link.when user clickon the linkIwant to openthe file in a new browser.

ayha
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17851963
If you have 1.1, then you should have Response.TransmitFile.  'documentPath' is the local file name for the .PDF file.

Bob
0
 
LVL 7

Author Comment

by:ayha1999
ID: 17890315
Hi Bob,

My asp.net version is 1.1 but still I get compilation error

Response.TransmitFile <---- TransmitFile is not a member of HttpResponse

what's wrong?

ayha
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17897436
Where are you calling that from?  A web page?  A class?

Bob
0
 
LVL 7

Author Comment

by:ayha1999
ID: 17899108
in a page.  some other solution worked with 'Response.WriteFile method.

ayha
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 20880336
Bob:

Thank you -- your accepted solution above helped me out today.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question