Html 以降价显示pdf图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39777166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Display pdf image in markdown
提问by Andrew Kim
Is this possible? Everything I'm google leads me to converting markdown to PDF. But I want to display a PDF image in a markdown file. This is my example:
这可能吗?我是谷歌的一切都引导我将 Markdown 转换为 PDF。但我想在降价文件中显示 PDF 图像。这是我的例子:

If i use a regular image, it works just fine. Also I'm aware of converting PDF to image.
如果我使用常规图像,它工作得很好。我也知道将 PDF 转换为图像。
回答by Waylan
Markdown itself doesn't have a mechanism for embedding a PDF. However, Markdown accepts raw HTMLin its input and passes it through unaltered. So the question you want to ask is: How would you embed a PDF in HTML? In order words, what HTML would one use to have a browser display a PDF embedded in an HTML page? You would just include that HTML in your Markdown document.
Markdown 本身没有嵌入 PDF 的机制。然而,Markdown在其输入中接受原始 HTML并通过它原样传递。所以您想问的问题是:您将如何在 HTML 中嵌入 PDF?换句话说,浏览器会使用什么 HTML 来显示嵌入在 HTML 页面中的 PDF?您只需在 Markdown 文档中包含该 HTML。
You can find lots of suggestions in answers to the question: Recommended way to embed PDF in HTML?. For example, this answerprovides a nice solution with a fallback for older browsers (all credit goes to Suneel Omrey):
您可以在以下问题的答案中找到很多建议:在 HTML 中嵌入 PDF 的推荐方法?. 例如,这个答案为旧浏览器提供了一个很好的解决方案(所有功劳都归功于Suneel Omrey):
<object data="http://yoursite.com/the.pdf" type="application/pdf" width="700px" height="700px">
<embed src="http://yoursite.com/the.pdf">
<p>This browser does not support PDFs. Please download the PDF to view it: <a href="http://yoursite.com/the.pdf">Download PDF</a>.</p>
</embed>
</object>