browser issue

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!
1jawsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mohan_sekarCommented:
What's the content-type/encoding you used? What reader software you use? Adobe?
0
1jawsAuthor Commented:
yes Adobe, it is ok with IE
0
mohan_sekarCommented:
What's the content-type/encoding you used?
0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

1jawsAuthor Commented:
how can I check tha I am not sure..
0
mohan_sekarCommented:
how do you push the PDF to the browser? Is it a link on your page? Do you do response.writefile?
0
1jawsAuthor Commented:
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
1jawsAuthor Commented:
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
mohan_sekarCommented:
Just add these two statements before calling BinaryWrite

Response.AddHeader("content-disposition", "attachment;")
Response.AddHeader("Content-Type", "application/pdf")
0
1jawsAuthor Commented:
ok, let me try it..
0
1jawsAuthor Commented:
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
1jawsAuthor Commented:

do i need to put something else to instead of this (createPDFfromthislocation)
byte[] byteArray = File.ReadAllBytes(createPDFromthislocation);
                Response.BinaryWrite(byteArray);
0
1jawsAuthor Commented:
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
mohan_sekarCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
1jawsAuthor Commented:
thank you sooo much!!
0
mohan_sekarCommented:
Glad I could help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.