Solved

browser issue

Posted on 2009-07-16
15
172 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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