Display pdf image in markdown

前端 未结 1 651
醉话见心
醉话见心 2020-12-13 17:37

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:

![         


        
相关标签:
1条回答
  • 2020-12-13 18:18

    Markdown itself doesn't have a mechanism for embedding a PDF. However, Markdown accepts raw HTML in 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.

    You can find lots of suggestions in answers to the question: Recommended way to embed PDF in HTML?. For example, this answer provides a nice solution with a fallback for older browsers (all credit goes to 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>
    
    0 讨论(0)
提交回复
热议问题