Display message when pdf not installed
we are generating a pdf file on the fly, and displaying it using asp.net
Response.ContentType = "application/pdf";
Response.开发者_运维百科BinaryWrite(pdfMemoryStream);
but if pdf is not installed, then we get an ugly error message. How can we change what we're doing so that when the user does not have pdf installed, we instead show a friendly message?
If you can embed this on a page with an object tag, you can include an error message:
<object width="100%" height="100%" data="pdf_server.ashx?id=123" type="application/pdf" codetype="application/pdf">
Sorry - your browser can't display Acrobat files
</object>
Of course, the "pdf_server.ashx?id=123" would actually be whatever url you need to call your pdf generator code.
精彩评论