Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

browser issue

Posted on 2009-07-16
15
Medium Priority
?
177 Views
Last Modified: 2012-05-07
I have created pdf using itextsharp and it works good on IE7 but it is displaying weird characters with firefox and google chrome, any idea what can I do? Please help!
0
Comment
Question by:1jaws
  • 9
  • 6
15 Comments
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24871767
What's the content-type/encoding you used? What reader software you use? Adobe?
0
 

Author Comment

by:1jaws
ID: 24871783
yes Adobe, it is ok with IE
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24871865
What's the content-type/encoding you used?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:1jaws
ID: 24871876
how can I check tha I am not sure..
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24871884
how do you push the PDF to the browser? Is it a link on your page? Do you do response.writefile?
0
 

Author Comment

by:1jaws
ID: 24871927
ok, I think I know why this is happening, what I am doing is, I am using template and PDFStamper, and it creates the pdf perfectly on the server, then I add this code to actually for user to get prompt of saving, byte[] byteArray = File.ReadAllBytes(created path);
                Response.BinaryWrite(byteArray);

it is doing good on IE but, obviously not working on the the other browser, I need to see how can I make user the see created pdf from the server..
0
 

Author Comment

by:1jaws
ID: 24871980
with the other browsers it is opening the binary content of the actual file, not showing the prompt to save the pdf.. what can I do?
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24871994
Just add these two statements before calling BinaryWrite

Response.AddHeader("content-disposition", "attachment;")
Response.AddHeader("Content-Type", "application/pdf")
0
 

Author Comment

by:1jaws
ID: 24871998
ok, let me try it..
0
 

Author Comment

by:1jaws
ID: 24872186
yes, it did worked! when user asked to save it is saving as a name of the my aspx page, but actually I  string createPDFonthislocation = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + @"pdf\mypdf\" + id + "_test.pdf";      

so it saves to server as a 44_test.pdf but when it prompts to user to save it is saying pdfcreation.aspx  which is my name of the application..      
0
 

Author Comment

by:1jaws
ID: 24872210

do i need to put something else to instead of this (createPDFfromthislocation)
byte[] byteArray = File.ReadAllBytes(createPDFromthislocation);
                Response.BinaryWrite(byteArray);
0
 

Author Comment

by:1jaws
ID: 24872344
is this something to do with Response.AddHeader("Content-Type", "application/pdf");   because it is application that's why it is giving the name of the pdf as a application name? I want is the my createdpdf name from server, not applicaiton name because I use number at the begining of the each pdf
0
 
LVL 15

Accepted Solution

by:
mohan_sekar earned 2000 total points
ID: 24872390
Response.AddHeader("content-disposition", "attachment;filename=" + id + "_test.pdf")


Note: for different browsers you may need to try different formats - check this for more info  http://classicasp.aspfaq.com/files/directories-fso/how-do-i-send-the-correct-filename-with-binarywrite.html
0
 

Author Closing Comment

by:1jaws
ID: 31604341
thank you sooo much!!
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24873300
Glad I could help
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline
Suggested Courses

783 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