开发者

How to identify whether the client machine supports PDF File format

Hii,

My requirment is to show a dynamically created pdf file directly to my web page. It works fine for the system which is having pdf reader software. But for the system which does not have the pdf software it is showing error like below

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


An invalid character was found in text content. Error processing resource 'http://localhost:4252/OmanePos开发者_运维百科t/Customer/EBox/PD... I need to handle this situation bit differently.i.e In this situation the file should be save to the physical location of the system for that i need to identify whether the client machine has pdf software or not then i can manage properly

I m using ASP.NET 2.0 version


It looks to me that you are serving your PDF with an XML mime/content-type. Make sure you set your content-type to application/pdf and you'll probably get a more suitable browser response.


In this case the browser should ask the user to open the file in an external application.

Please verify that you are sending the correct Content-Type: application/pdf header. Certain versions of Microsoft's browser ignore the content-type header, so you need to specify a filename ending in .pdf in the content disposition header: Content-Disposition: inline; filename=filename.pdf;

Note: I have not verified that it works with "inline" instead of "attachment", but I think it is worth a try.


My requirment is to show a dynamically created pdf file directly to my web page.

Try online ZohoViewer that takes a PDF file link and displays in the browser without requiring PDF reader on the client machine. As such there's no way to check if the client machine has a pdf reader or not.


You can not identify that client system has pdf software using javascript, asp.net, c#.


If the PDF reader software is not there and the PDF is a valid PDF then it should not throw exception. Instead it asks for a software in client machine which can read the file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜