• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

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!
0
1jaws
Asked:
1jaws
  • 9
  • 6
1 Solution
 
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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
 
1jawsAuthor Commented:
thank you sooo much!!
0
 
mohan_sekarCommented:
Glad I could help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now