Chrome Plug-in to Convert Web Page to EPUB

Forum for volunteer developers working on Baka-Tsuki related applications (Baka-Reader, BTprince, etc).

Moderators: thelastguardian, Fringe Security Bureau, Senior Editors, Senior Translators, Alt. Language Translator/Editor, Executive Council, Project Translators, Project Editors

dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

Hi,

If anyone is interested, I've created a Plug-in extension for the Chrome web browser that converts a Baka-Tsuki web page into an EPUB.

To install the plug-in on Chrome: To install the plug-in on Firefox:
  • Warning: The Firefox build has a couple of limitations
    • It's using the Firefox WebExtensions to allow Firefox to run a Chrome extension. (i.e. The Firefox extension is the same as the Chrome extension.)
    • WebExtensions are still under development in Firefox, so you'll need to run either the Developer or Nightly builds of Firefox. And there may be bugs.
    • The Firefox builds need to be manually reviewed by Mozilla, so, so the official Firefox build is going to lag the Chrome build.
  • Got to https://addons.mozilla.org/addon/webtoe ... aka-tsuki/
  • Click "Add to Firefox" button.
To use the plug-in once installed:
  • Go to web page you want to convert. (Go to a "Full Text" page, e.g. http://www.baka-tsuki.org/project/index ... us:Volume2)
  • Check that the story details on the popup are correct.
  • Press "Fetch Images" button and wait for them to load. The Pack EPUB button should now enable.
  • Click on the "Set cover" button for the image you want to use as the cover page.
  • Click on the "Pack EPUB" button.
More details on the plug-in can be found at http://www.codeproject.com/Articles/106 ... for-Chrome

To report bugs or request features: https://github.com/dteviot/WebToEpub/issues

Notes:
  • The extension is written in javascript, so should be possible for others to fix/adapt/improve.
  • I haven't tested it with all pages on Baka-Tsuki, so it may break for some.
  • I'm new to JavaScript, so my code may be somewhat clumsy.
  • Plug-in runs on Windows version of Chrome and an earlier version of it ran on Chrome on a MacBook.
  • I haven't confirmed the EPUB will run on all EPUB readers. It works fine with the Firefox EPUBReader addon. (http://www.epubread.com) and I'm told it works with iBooks.
  • Reader also works for FanFiction.net and ArchiveOfOurOwn.
Last edited by dteviot on Sun Jul 03, 2016 12:00 pm, edited 2 times in total.
User avatar
wayvern33
Kyonist
Posts: 10
Joined: Wed Sep 10, 2014 4:40 pm
Favourite Light Novel: Ahouka!

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by wayvern33 »

Thank you, I use this frequently, btw will you continue to develop it?
dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

wayvern33 wrote:Thank you, I use this frequently, btw will you continue to develop it?
Firstly, sorry for the large delay in responding to you. For some reason, I never got notified that you’d responded to the thread.
Second, I appreciate the thanks.
Third, Yes, I will continue to develop it. It’s just that at the moment, I’m not sure what else to do. I was hoping for some feedback from users.
If anyone has any suggestions, feel free to e-mail me at [email protected].
Or if you're a programmer, the source code is at https://github.com/dteviot/WebToEpub, so feel free to push me any changes.
dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

Extension is now available from the Chrome Web Store.
To install.
User avatar
R~S
Project Editor
Posts: 131
Joined: Sun Oct 01, 2006 9:57 am
Favourite Light Novel: Index!
Location: France

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by R~S »

Any chances this could also get a firefox extension?
Baka-Tsuki discord server
User avatar
ontoone
Astral Realm

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by ontoone »

I don't understand why the epub site was removed why not just keep it up and along with the new plug in.
dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

R~S wrote:Any chances this could also get a firefox extension?
That will be on my list of things to do shortly.
Issue (as always) is finding the time.
User avatar
ken_arata
Literature Club Member
Posts: 39
Joined: Sat Sep 27, 2014 12:38 pm
Favourite Light Novel: Kamachi Projects, Clockwork Planet, Campione, Fate Zero and many others
Contact:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by ken_arata »

Thank you for making this tool. As a previous poster mentioned, a Firefox version would be greatly appreciated. Although at this point, improving the tool comes first, I think.
I tried to use it on Zashiki Warashi volume 1. I'm fairly new at making epubs so please point out if I'm making any mistakes.

Issue 1: It seems that only small sized preview images were added to the book. While the small sized epub is good for reading on phone, it would be great if full sized images can be added. Can you make it so that we have the option to use either the current setting or full sized images?

Issue 2: Errors in opf

Code: Select all

<meta content="images/image_0000.jpg" name="cover"/>
The actual id for cover is "image0000" not "images/image_0000.jpg" so I think there's a bug there.
There is an error in manifest as well,

Code: Select all

  <item href="cover.xhtml" id="cover.xhtml" media-type="application/x-dtbncx+xml"/>
the mimetype should be "application/xhtml+xml".

Issue 3: All the images are put at the top of the epub. Can you make it so images that appears later on in the book are not included?

Minor issue 1: Please use a stylesheet.
Very Minor Issue: Headings are not centered.
Here's the styling rules for headings and lists I use on epubs:

Code: Select all

h1, h2 {
  text-align: center;
  page-break-before: always;
  margin-bottom: 10%;
  margin-top: 10%;
}
h3, h4, h5, h6 {
  text-align: center;
  margin-bottom: 15%;
  margin-top: 10%;
}
ol, ul {
  padding-left: 8%;
}
Page I used:
https://www.baka-tsuki.org/project/inde ... ge:Volume1
dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

ken_arata wrote:Issue 1: It seems that only small sized preview images were added to the book. While the small sized epub is good for reading on phone, it would be great if full sized images can be added. Can you make it so that we have the option to use either the current setting or full sized images?
Just so I'm clear, please confirm you are asking:
1. You'd prefer the biggest image available is fetched and added to the epub.
2. Add option to select either full size or scaled down images.

Item 1 is currently being worked on. Thanks to https://github.com/belldandu
If you can suggest a UI that makes 2 easy for a user to understand and select, I'd be willing to do this.
ken_arata wrote: Issue 2: Errors in opf

Code: Select all

<meta content="images/image_0000.jpg" name="cover"/>
The actual id for cover is "image0000" not "images/image_0000.jpg" so I think there's a bug there.
There is an error in manifest as well,

Code: Select all

  <item href="cover.xhtml" id="cover.xhtml" media-type="application/x-dtbncx+xml"/>
the mimetype should be "application/xhtml+xml".
Thanks, I'll look into that.
ken_arata wrote: Issue 3: All the images are put at the top of the epub. Can you make it so images that appears later on in the book are not included?
That's a matter of personal taste. I like having all images at the start as well as in the text.
Obviously, looks like another setting is required.
ken_arata wrote: Minor issue 1: Please use a stylesheet.
Very Minor Issue: Headings are not centered.
Here's the styling rules for headings and lists I use on epubs:

Code: Select all

h1, h2 {
  text-align: center;
  page-break-before: always;
  margin-bottom: 10%;
  margin-top: 10%;
}
h3, h4, h5, h6 {
  text-align: center;
  margin-bottom: 15%;
  margin-top: 10%;
}
ol, ul {
  padding-left: 8%;
}
Yup, that's going to have to be another optional setting another optional setting.
I think might be easiest to have a text field, then you can add whatever you like as the style sheet.
User avatar
Artastic
VOID UNDEAD SPECTOR
Posts: 2
Joined: Fri Oct 23, 2015 12:40 am
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by Artastic »

Thanks for the extension, just thought I'd give my opinion about the images.

With the ones that usually occur at specific pages, I think it would be nice to not have them appear at the beginning as some may contain spoilers which you would rather not see before you even start reading.
Dragoonity
Reader
Posts: 3
Joined: Sun Jun 19, 2016 2:42 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by Dragoonity »

I love what you are doing with this chrome extension especially since BT-E is now gone for good or until someone pick it back up again.

When I use the extension for the LNs in BT, I found that the cover page image does not show up for me(before clicking or opening up the book). I was wondering if this could be fixed and I'm reading the LNs on my Macbook using the ibooks app on it. This is the only problem I have with it so far and would love to see how far you take this extension for those that need it.
dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

OK, I just want to point out that this EPUB generator is very much a Beta release.
So, if you have problems, please go to https://github.com/dteviot/WebToEpub/issues and check it's not an already reported problem.
If it's not, please create a new issue.

Thank you.

P.S.
Fix so it downloads highest resolution images should be available in a couple of days.
dteviot
Literature Club Member
Posts: 31
Joined: Fri Sep 19, 2014 10:02 pm
Favourite Light Novel:

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by dteviot »

Dragoonity wrote:When I use the extension for the LNs in BT, I found that the cover page image does not show up for me(before clicking or opening up the book). I was wondering if this could be fixed and I'm reading the LNs on my Macbook using the ibooks app on it. This is the only problem I have with it so far and would love to see how far you take this extension for those that need it.
You're the second (third?) person to report this. There's a bug in the opf metadata for the cover image. Updated release will be on the Chrome store in a day or two.
Or you can grab the sonako branch and install from source. https://github.com/dteviot/WebToEpub/tree/sonako
User avatar
DannySeca
Astral Realm

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by DannySeca »

hi dteviot!
this is a very nice plugin chrome extension where you can convert web page to epub in baka tsuki which replace the ln.m-chan.org.

i have a question about the plugin chrome extension., i have already added the chrome extension to my chrome and have read the forum where you said "There's a bug in the opf metadata for the cover image. Updated release will be on the Chrome store in a day or two.
Or you can grab the sonako branch and install from source. https://github.com/dteviot/WebToEpub/tree/sonako"
that this will be updated in chrome store , but i have already added chrome extension before the update, will the chrome extension that i added get updated automatically or do i need to delete it and add it again
User avatar
Guest
Astral Realm

Re: Chrome Plug-in to Convert Web Page to EPUB

Post by Guest »

First of all, thanks for your work on the Chrome extension, it's been a godsend since BTE-GEN started acting up after the server move.

Could I make a couple of suggestions that would introduce more parity with the design EPUBs created by BTE-GEN?

Firstly, as far as I see using the extension creates a EPUB wherein all the images are renamed to image(number).jpg, would it be at all possible to preserve the Baka-Tsuki filenames instead?

Secondly, the way the old generator was set up, the color illustrations sections would have illustrations set up like so

Code: Select all

<div class="svg_outer svg_inner">
    <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 x y" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink">
      <image height="y" width="x" xlink:href="../Images/filename.jpg"></image>
    </svg>
</div>
This creates a nice clean page with just an illustration.

The extension on the other hand packs in the whole gallery's HTML for the Illustrations section, wherein all the illustrations are part of an unordered list:

Code: Select all

<ul class="gallery mw-gallery-traditional">
			<div class="gallerytext">
<p><b>(caption)</b>
</p>
			</div>
		</div></li>
		<li class="gallerybox"><div>
			<div class="svg_outer svg_inner"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="100%" width="100%" version="1.1" preserveAspectRatio="xMidYMid meet" viewBox="0 0 x y"><image xlink:href="../Images/filename.jpg" height="y" width="x"></image></svg>
</div>
<!--And so on and so forth with the rest of the illustrations-->
</ul>
This results in some unsightly bullet points attached to each and every one of the images when viewed in an epub viewer, which for those images that lack captions are simply bullet points with nothing attached to them making them look even more out of place.

If there was any way for the extension to strip out the list code and just leave the images in that would go a long way to making a more aesthetically pleasing outcome.
Post Reply

Return to “Developers and Code”