开发者

Display message when pdf not installed

开发者 https://www.devze.com 2022-12-19 20:50 出处:网络
we are generating a pdf file on the fly, and displaying it using asp.net Response.ContentType = \"application/pdf\";

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.

0

精彩评论

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

关注公众号