Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 11-20-2023, 01:51 AM   #1
bdoors
Junior Member
bdoors began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Nov 2023
Device: none
Calibre can't link to images or pdfs?

This valid code is in my HTML file that I submit as input to Calibre --

<a href="test.pdf">Test PDF</a>
<a href="test.jpg">Test JPG</a>

After I convert my input to EPUB and edit it, I see that Calibre has translated my input lines into this-

<a href="test.pdf" class="pcalibre calibre5 pcalibre1">Test PDF</a>
<a href="test.jpg" class="pcalibre calibre5 pcalibre1">Test JPG</a>

When I'm in the Calibre Reader and try to click on my links, Calibre brings up the browser and gives me these error messages --

https://calibre-internal.invalid/test.pdf
https://calibre-internal.invalid/test.jpg

Is Calibre not capable of displaying a linked image or PDF file?

Or am I doing something wrong?

Thank you.
bdoors is offline   Reply With Quote
Old 11-20-2023, 03:52 AM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,628
Karma: 26960534
Join Date: Mar 2012
Location: Sydney Australia
Device: none
AFAIK those aref clauses are not valid because "test.pdf" is not a well-formed URL.

See [W3School] HTML a href Attribute

BR
BetterRed is offline   Reply With Quote
Old 11-20-2023, 11:05 AM   #3
bdoors
Junior Member
bdoors began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Nov 2023
Device: none
Thank you, BR, for your help.

I see what you're saying -- in the phrase

<a href="subject">link_name</a>

the "subject" must be an html file, not a jpg or pdf file.

I was coding with jpg and pdf as "subjects" because it passes html validation just fine. And works in the two browsers I test with.

But it doesn't work when I generate an EPUB through Calibre.

Through research I found that now html officially does allow jpg and pdf files to act as subjects, just by adding the download keyword --

<a href="test.jpg" download>link_name</a>

But his didn't work in Calibre either.

For now, it looks like my solution for Calibre should be to embed those jpg and pdf files within an html file. Then refer to the html file as the subject in my link.

(PS-- this is no knock on Calibre, it is a fantastic tool I am very grateful for.)
bdoors is offline   Reply With Quote
Old 11-20-2023, 02:54 PM   #4
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,343
Karma: 85874895
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Ebooks use HTML and CSS, but they don't support all the stuff that websites do.
Putting an HTML "wrapper" is best, but a PDF is a terrible thing to put in an ebook.
Quoth is offline   Reply With Quote
Old 11-21-2023, 11:48 AM   #5
bdoors
Junior Member
bdoors began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Nov 2023
Device: none
Thanks for the tip, Quoth. I looked at a few PDFs on my mobile and, like you said, they looked pretty bad. I tried on a bigger phone and got a decent result when turning the phone sideways, but you're right, PDFs seem to range from "a little awkward" to hardly readable.

So I converted my PDFs to html. Looks way better and fits Calibre, too.

I only had a few files, so I converted manually. (If I had more files, I might have tried out the free tool pdf2htmlEX at Github.)

Cheers.
bdoors is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove background images from pdfs? perhaps all images? MarjaE PDF 2 10-17-2018 03:30 PM
cover images for pdfs manicwhale Calibre 1 07-23-2011 12:42 AM
PDFs with images to mobi rcuadro Calibre 2 10-28-2009 11:39 AM
Converting PDFs to images (Linux only) kylecronan Kindle Developer's Corner 1 02-28-2009 02:37 PM
Converting PDFs to Images fargo iRex 9 05-01-2008 11:34 PM


All times are GMT -4. The time now is 11:16 AM.


MobileRead.com is a privately owned, operated and funded community.