Solved

browser issue

Posted on 2009-07-16
15
168 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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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 500 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now