How to elegantly embed pdf image into markdown

Posted by Yuling Yao on Aug 05, 2019.       Tag: zombie  
No you cannot

So I am using markdown for this site. Most of the time it works smoothly but the process of image always seems a little painful. Indeed it is more painful than I initially anticipated: per jekyll documents, I use

![some discription](/blog/images/something.pdf "some discription")

which indeed convert into

<image src="/blog/images/something.pdf"/>

in the html.

It displays the pdf as image on safari. And it would always work if it is any image format other than pdf. But I just realize the syntax is not compatible with chrome and Firefox. They do not recognize pdf in the image tag, and they do not have any plan to change it.

I did some search and I think the state-of-the-art solution(granted, state-of-the-art is a very low bar in this regard) is to use <embed> or <object> tag. Simply use

<embed src="/blog/images/xxx.pdf" type="application/pdf">


<object data="/blog/images/xxx.pdf" type="application/pdf" width="100%"> 

Well it works almost fine except I do not want that scrollbar like this:

or this:

It appears you don't have a PDF plugin for this browser. No biggie... you can click here to download the PDF file.

It is too ugly. And it seems to only work on PC.

The ultimate solution is to convert all pdf into png. It turns out that in mac OS 10.14 the built-in batch-pdf-to-png conversation has been removed so I have to use apple’s automator– but I think I spent more time learning how to use automator than if I had converted all pdf one by one.

Anyway it is good to know that chrome has some problem with pdf embedding, and apple has some problem with batch conversation. It will be a more pessimistic world if all existing technologies are perfect– thankful they are not even close.