Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-28-2015, 11:43 PM   #1
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
Creating local file links

Hi,

this' just a general html question, more about OS file structures (using Windows7) but not sure the best place to ask other than here, and the only relevant info i found doesnt work

I wanto add local file links to ebooks and use relative (root folder) paths, eg if the main books saved in

C:\\Users\Me\Documents\EXAMPLE\goodbook.epub

and the book being linked to is saved in

C:\\Users\Me\Documents\EXAMPLE\REFERENCE\anotherbo ok.pdf

Calibre's E-book viewer will open the pdf (with its default program) using the following

<a href="file:///C://Users/Me/Documents/EXAMPLE/REFERENCE/anotherbook.pdf">another book</a>

but the advice (here) to shorten it to the following doesnt work

<a href="../REFERENCE/anotherbook.pdf">another book</a>

fwiw also tried it with OpenOffice with no luck either, so not a Calibre specific problem, maybe someone could point me to another forum as an alternative. Cheers

Last edited by ni_c; 08-28-2015 at 11:59 PM.
ni_c is offline   Reply With Quote
Old 08-29-2015, 12:50 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: 21,660
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@ni_c - here's what I'd do (indirect answer)

I assume you're wanting to put the links into the Comments column or a Long Text custom column

Drag the file from my file manager to the comments editor (Normal View), that will create the HTML. Adjust the descriptor in the HTML View (probably to just the file name), make it pretty (Bold, Italics whatever) back in Normal View.

I'd use a custom column rather than Comments - a) because I might want to download Comments which would clobber the link, and b) because I can edit a long text custom column (in a 'dedicated editor') from the Book List by using F2 on the cell.

Need to add the custom column to Book Details in Preferences->Look and Feel.

I also cloak long text columns with column icons, I make the icon conditional on the column not being empty.

BR
BetterRed is offline   Reply With Quote
Advert
Old 08-29-2015, 01:20 AM   #3
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
Hey BetterRed,

im confused so not being rude, but dk what any of that means, i dont see any references in the Calibre 'Edit Book' interface to a Comments column or Long Text custom colum or 'my file manager' or comments editor.

and going to the main Calibre window preferences > look and feel, there are two tabs for Column Colors and Column Icons with add/remove options, and there is in the Book Details tab, a checkbox for Comments (which is ticked) but thats obviously doesnt refer to the main interface as the checkbox for Title is unticked there, so no clue what Book Details refers to

---

in practical terms, i want to link to other locally saved files from an ebook, instead of using online urls, and also be able to upload all of it to share with others as a single package that'll work regardless of where its saved at their end.

Last edited by ni_c; 08-29-2015 at 01:46 AM.
ni_c is offline   Reply With Quote
Old 08-29-2015, 02:30 AM   #4
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: 21,660
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by ni_c View Post
Hey BetterRed,

im confused so not being rude, but dk what any of that means, i dont see any references in the Calibre 'Edit Book' interface to a Comments column or Long Text custom colum or 'my file manager' or comments editor.

and going to the main Calibre window preferences > look and feel, there are two tabs for Column Colors and Column Icons with add/remove options, and there is in the Book Details tab, a checkbox for Comments (which is ticked) but thats obviously doesnt refer to the main interface as the checkbox for Title is unticked there, so no clue what Book Details refers to

---

in practical terms, i want to link to other locally saved files from an ebook, instead of using online urls, and also be able to upload all of it to share with others as a single package that'll work regardless of where its saved at their end.
@ni_c somehow I missed the fact that your post was in the Editor subforum (its a fairly common subject in other contexts) - so scratch what I wrote - sorry.

For the record : long text columns (like Comments) are held as HTML, hence my assumption. If you look at the Comments input area in Metadata Edit you'll see the Normal and HTML tabs I mentioned, they're at bottom.

But... if you put a link to a file on your computer into the text of a book, then do you expect the link to work if the book is on a reader or some another computer - I suspect it wont, because it will be unreachable. You'd need to put the file inside the epub - wouldn't you???

Unless of course it's for your use only, on your computer. BTW if you move or rename a file that's referenced by a file:\\\... link then you will break the link.

BR

Last edited by BetterRed; 08-29-2015 at 03:02 AM.
BetterRed is offline   Reply With Quote
Old 08-29-2015, 03:48 AM   #5
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
Oh ok, didnt look closer at the edit metadata tab, see what you were talking about now

Idk the file structure of readers, but all thats needed is a folder with stuff in it saved to the same place the ebooks saved, so if thats possible with readers, then the only limitation would be file type support

as mentioned the point of wanting relative path links, is so as long as theyre saved together anywhere, itll work just like web urls. The only workaround i can think of would be adding instructions in the ebook itself to move the folder with linked files to a specific generic location, but the most generic being the root C:/ itself requires admin priviledge so not advisable, the next most generics probably C:/Users/Public/Documents/ (at least in Win7) but assuming that excludes mac and linux users & dk Win8 & 10.

Last edited by ni_c; 08-29-2015 at 03:56 AM.
ni_c is offline   Reply With Quote
Advert
Old 08-29-2015, 04:18 AM   #6
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: 21,660
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@ni-c - What you can do within the device file system may be device dependent. They seem to 'fiddlesome' when it comes to what can go where, when it can go there and who can put it there.

Also, it is my impression is that ebooks are expected to be self-contained.

But I'll bow out as device related issues aren't really my forte.

BR
BetterRed is offline   Reply With Quote
Old 08-29-2015, 05:24 AM   #7
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
noworries, not my forte either.

infact just realized local file links don't even work at all with pdf's, only epub and mobi that i tried, and was editing the book mainly to format as a pdf as the main version, so wont bother having just the epub linkable to share, but would still like to know what im doing wrong with relative link urls if anyone reading knows. Cheers
ni_c is offline   Reply With Quote
Old 08-29-2015, 02:53 PM   #8
signum
Zealot
signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.
 
Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
The relative link " <a href="../REFERENCE/anotherbook.pdf">another book</a>" will be relative to the *parent* file path of "goodbook.epub", i.e. "Documents". The link you want should be relative to "goodbook.epub" itself instead of its parent, i.e. " <a href="./REFERENCE/anotherbook.pdf">another book</a>". Notice that there is only one dot at the beginning instead of two. Still don't know if it will work, but at least the link should be correct.
signum is offline   Reply With Quote
Old 08-29-2015, 02:54 PM   #9
signum
Zealot
signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.signum calls his or her ebook reader Vera.
 
Posts: 119
Karma: 64428
Join Date: Aug 2011
Device: none
Try using a single dot instead of two dots in the relative address. This will make it relative to the current text instead of its parent.

Oops, sorry for the double post.
signum is offline   Reply With Quote
Old 08-29-2015, 02:57 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
RMSDK will not permit launching another book from a book
Self contained is the rule

Not all devices have conectivity
Even when they do, it may not (be allowed to) work
theducks is offline   Reply With Quote
Old 08-30-2015, 03:16 AM   #11
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
edit ok just got it working with the single dot rule using OpenOffice, saving as html and renaming the files to have NO blank spaces, for whatever reason, relative links add special character to replace blank spaces (while full path links dont) which botches the urls. Its still not working with epubs unless ive missed something, but htmls fine for now

thanks for the feedback

If anyone wants to know how to batch rename files to remove spaces, can be done with Irfanview's File > Batch Conversion/Rename feature with following parameters

1) browse to files (top right) and below it choose 'add all' or manually choose
2) (top left) click the Batch rename radio button
3) (middle left) click batch rename settings - options
3a) change the name pattern to $F
3b) click on the first column box of "Replace text (1)"
3c) press the spacebar to add an invisible space
3d) click on the second column box and add an underscore _
3e) choose one of the copy move or rename options below that
4) back in the main UI specify an output directory
5) start batch

Last edited by ni_c; 08-30-2015 at 04:27 AM.
ni_c is offline   Reply With Quote
Old 08-30-2015, 03:49 AM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Relative links in an EPUB refer to files inside the *.epub, relative to the currently rendered resource (the (X)HTML file containing the link).

You'd have to embed the PDF or whatever as a Miscellaneous file inside the EPUB, and then I doubt any reader would open it.



file:// links point to locations in the filesystem hierarchy, rather than being interpreted within the renderer's context (context can be anything. A file://page is a filesystem context. a http://website.com/page is a website context. Relative links in either case are relative to the currently rendered file.)
If you use a file:// link, it will escape the EPUB context. There should be some way of munging that to use a relative link...
It *might* work, but I don't guarantee even if it does, that it will everywhere. As far as the specs are concerned, you are most likely a filthy troublemaker. Enough reader applications rewrite the wheel that they might be doing anything.

Last edited by eschwartz; 08-30-2015 at 03:58 AM.
eschwartz is offline   Reply With Quote
Old 08-30-2015, 05:22 AM   #13
ni_c
Enthusiast
ni_c began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2015
Device: none
thanks for the explanation eschwartz,

like to think myself more a dirty fix troubleshooter or eternally optimistic amateur with computers, no MrRobot at any rate cheers
ni_c is offline   Reply With Quote
Old 08-30-2015, 05:53 PM   #14
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
filthy troublemaker vs. dirty fix troubleshooter -- all a matter of opinion.
Besides, if the specs were so good EPUB3 would have been about standardizing current features.
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating symbolic links Backi Calibre 8 12-11-2020 06:27 PM
Creating links in an existing epub-text? Chris_ Editor 3 07-06-2015 06:10 PM
Creating internal links in EPUB from svg image ecojon ePub 1 03-26-2012 12:37 PM
Recipe using a local file? TheRevolutionist Recipes 1 01-10-2012 12:37 PM
local html file with K3 browser Reeeder Kindle Developer's Corner 0 08-28-2011 05:41 AM


All times are GMT -4. The time now is 01:32 PM.


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