Solved

Opening pdf in browser

Posted on 2006-10-31
14
410 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 96

Accepted Solution

by:
Bob Learned earned 200 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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