Mobileread
How to embed fonts in ePub after Calibre
#11  fiery 11-22-2009, 04:24 PM
@padman,
Instead of editing files directly in the epub file, you can change its extension from .epub to .zip and then extract the files. On Windows XP and later you can do this very easily through the explorer contextual menu command "Extract All". After file editing, zip first the mimetype file (use the explorer "Send to" -> "Compressed (zipped) folder" command). Then add all other files in the zip (just drag and drop them over the zip file). Finally, change the .zip extension to .epub.

The epub format requires that mimetype file should be put first without compression (don't worry Windows will not compress it due to its size) in the epub file. However, ADE as well as my device read epub files even if the mimetype file is not first. In fact, if you do direct editing through the 7-zip utility, it will put edited files above mimetype file and an epub verification would complain about this. So, if you want to produce a strict epub file you should unzip it, edit files and zip it again as explained above.
Reply 

#12  JSWolf 11-22-2009, 04:38 PM
Quote pdurrant
Yes, you can unzip, edit and then zip again.

When zipping, the mimetype file must be the first file in the zip, and it must be zipped uncompressed. The other files must follow.

I wrote an Applescript for Mac OS X that does this zipping. I'm sure a batch file for Windows could be written too.
What I do is unzip the ePub, and then make the changes and put back just the files that I've changed. Works quite easily.
Reply 

#13  Valloric 11-22-2009, 06:23 PM
Quote JSWolf
What I do is unzip the ePub, and then make the changes and put back just the files that I've changed. Works quite easily.
If the mimetype file is not the first file and/or is not uncompressed, your epub might not work in all epub-supporting software. Calibre, ADE and Sigil can still handle this, but your epub is still non-conformant and may not work elsewhere.
Reply 

#14  JSWolf 11-22-2009, 07:23 PM
Quote Valloric
If the mimetype file is not the first file and/or is not uncompressed, your epub might not work in all epub-supporting software. Calibre, ADE and Sigil can still handle this, but your epub is still non-conformant and may not work elsewhere.
I am using WinRAR to do this. So when I update the changed files, does it changes things enough to be out of spec?
Reply 

#15  pdurrant 11-23-2009, 03:48 AM
I don't know - but a quick run through epubcheck will tell you.

Quote JSWolf
I am using WinRAR to do this. So when I update the changed files, does it changes things enough to be out of spec?
Reply 

#16  JSWolf 11-23-2009, 12:02 PM
I just ran epubcheck on one of the edited ePub files and it did not have any issue with mimetype.
Reply 

#17  padman 11-27-2009, 04:08 AM
Does the compression have to be zip? What if I use another software – eg. 7-zip? And what software do you use for compression on mac?
Reply 

#18  pdurrant 11-27-2009, 05:39 AM
Any zip program that produces a valid zip file should be fine - provided it doesn't add extraneous stuff between filename and file contents.

On the Mac I use the built-in zip command, controlled with an AppleScript to make it a drag&drop operation.

Quote padman
Does the compression have to be zip? What if I use another software – eg. 7-zip? And what software do you use for compression on mac?
Reply 

#19  charleski 11-30-2009, 05:49 AM
Quote JSWolf
What I do is unzip the ePub, and then make the changes and put back just the files that I've changed. Works quite easily.
I use WinRAR, with the external editor set to Notepad++ in the options. This allows me to open an epub in WinRAR, click on a file and have it open in Notepad++. When I save the file after editing, WinRAR automatically asks if I want to insert the changed version back into the archive. This way all the zipping and unzipping is handled behind the scenes.
Reply 

#20  Lloyd Simcoe 11-30-2009, 01:25 PM
Quote charleski
I use WinRAR, with the external editor set to Notepad++ in the options. This allows me to open an epub in WinRAR, click on a file and have it open in Notepad++. When I save the file after editing, WinRAR automatically asks if I want to insert the changed version back into the archive. This way all the zipping and unzipping is handled behind the scenes.
Thanks for the tip. I gave it a go and it worked nicely.
Reply 

 « First  « Prev Next »  Last »  (2/8)
Today's Posts | Search this Thread | Login | Register