gitbook icon indicating copy to clipboard operation
gitbook copied to clipboard

<a href><img> Doesn't work in pdf

Open johnlindquist opened this issue 11 years ago • 7 comments

2.0.0 alpha 6

Using basic 'a' and 'img' tags works fine using 'gitbook serve', but links are disabled in pdfs.

<a href="http://google.com"><img src="images/download_library.png" width="50%" style="float:right; padding-left:10px"/></a>

johnlindquist avatar Feb 08 '15 04:02 johnlindquist

Can you try: gitbook build --format=ebook and let me now if the file contains the link or not (the format ebook generates the html used before the transformation to ebook).

SamyPesse avatar Feb 08 '15 10:02 SamyPesse

I ran that command, but don't see an ebook output anywhere. It looks like it's just rebuilding the site... Do I need to add something to book.json?

johnlindquist avatar Feb 09 '15 19:02 johnlindquist

The "ebook" format doesn't generate an ebook file, it build a version of the website that can be convert as an ebook file (basically some very simple html files).

The process for building a pdf is:

input book -> [parsing] -> [generation website format "ebook"]  -> html files -> [ebook_convert] -> pdf file

So run this command and take a look at the files in the _book folder, then paste me the output of the html file where are the links.

SamyPesse avatar Feb 10 '15 14:02 SamyPesse

Sorry, I confused ebook with epub.

Here's the output:

before

<a href="http://google.com"><img src="images/download_library.png" width="50%" style="float:right; padding-left:10px"/></a>

after

<a href="http://google.com" target="_blank"><img src="images/download_library.png" width="50%" style="float:right; padding-left:10px"></a>

johnlindquist avatar Feb 10 '15 15:02 johnlindquist

What do you mean by "disabled in pdf" ?

SamyPesse avatar Feb 10 '15 15:02 SamyPesse

Nothing happens if I click on the image.

johnlindquist avatar Feb 10 '15 15:02 johnlindquist

I am having same issues. When adding a link to an image, there is no link in the pdf output. I am using this code structure:

[![](banner.jpg)](http://www.site.com)

bronestly avatar Oct 10 '16 06:10 bronestly