View Full Version : How to reduce size of opf file???


karenbryant
07-03-2012, 08:20 PM
Hi,
I'm trying to upload some eBooks to Apple's iBookstore, but I keep receiving rejections due to two my eBooks having opf files with a size over 300k. (one opf is 310k and the other 415k) These are very large books, but they validate fine and are accepted by B&N.

I'm using Atlantis to create the ePubs from my Word files. Can anyone tell me how to get the opf files below 300k so they'll be accepted by Apple?

Thanks!
Karen

JSWolf
07-03-2012, 08:31 PM
Hi,
I'm trying to upload some eBooks to Apple's iBookstore, but I keep receiving rejections due to two my eBooks having opf files with a size over 300k. (one opf is 310k and the other 415k) These are very large books, but they validate fine and are accepted by B&N.

I'm using Atlantis to create the ePubs from my Word files. Can anyone tell me how to get the opf files below 300k so they'll be accepted by Apple?

Thanks!
Karen

The only way we can tell if the OPFs can be reduced in size is to post the OPFs here.

Toxaris
07-04-2012, 03:12 AM
Those are big opf-files. For a text file to be 310k or more, that is a lot of text. The only way I can explain it, if you have a lot (and I mean a lot) of files in your ePUB with long names. Also you could take a look at your metadata.

Jellby
07-04-2012, 05:15 AM
Use short filenames, and short (or no) directory names. Remove unneeded metadata. Use ASCII characters instead of Unicode where possible. Open the OPF in a text editor and remove all unneeded spaces (spaces at the beginning of a line, for example).

karenbryant
07-04-2012, 01:40 PM
Hi,
Here's the opf.

I can't see any spaces or file names to get rid of. Anyone know how I can get this down below 300k? I need the file accepted by Apple, so I'm worried I'll cut some thing that will make them reject it again. Why do they insist on this 300k rule?

karenbryant
07-04-2012, 01:41 PM
Hi, I've upped the OPF. Thanks for looking.

Toxaris
07-04-2012, 01:51 PM
I don't know why Apple has that restriction. I don't understand most things Apple do. It is not about size, since nowadays they want your covers to be large.

Anyway, there is not much you can do directly to minimize the opf-file. But, there are a lot of files. You could try to merge several html files to minimize the number of files. That has no impact (no real) on the filesize, but has impact on the opf file size.

Jellby
07-04-2012, 02:18 PM
Indeed, the OPF is pretty minimalistic already. You can shrink it a bit though, by replacing "id with "a and "img with "b. And, if you can rename files, you could replace .html with .h and move all images to the root directory (thus removing the "images/" part in the file names. These changes make it smaller than 300kB.

AlPe
07-04-2012, 04:22 PM
I think that you can omit the file extensions at all, as I have not been able to find a place in the specs where it says that file extensions are required.

A quick trial EPUB with stripped file extensions passed both FlightCrew and EpubCheck, and it is displayed correctly.

This should save you some more bytes.

JSWolf
07-04-2012, 04:23 PM
Indeed, the OPF is pretty minimalistic already. You can shrink it a bit though, by replacing "id with "a and "img with "b. And, if you can rename files, you could replace .html with .h and move all images to the root directory (thus removing the "images/" part in the file names. These changes make it smaller than 300kB.

One other thing that can be done to reduce the size of the OPF is to remove the guide. It's not needed in ePub.

mmat1
07-04-2012, 04:48 PM
(one opf is 310k and the other 415k)


I tried Jellby's approach of cutting down the id-strings (a bit modified by me :) ) and moving images to the main directory. The result is 297.968 Bytes.

I guess you can toss out the line-breaks as well, which will be another 8k. Removing file-extensions will be some 15k. (I would not do that).

I've still no idea how to squeeze out 115 k from your second *opf without reducing the number of entries.

karenbryant
07-04-2012, 05:00 PM
Thanks to you all for taking the time to help. Using your excellent advice I've managed to shave it down to 285kb - very slim indeed! As for the other eBook, I've had to make cuts to get it accepted. Once again thanks all - greatly appreciated.
Karen
x

Jeff L
07-05-2012, 01:06 AM
Is it necessary to have so many files? You could combine the files to have fewer entries in the OPF. This would help with your other OPF that's 415K in size.

If you need pagination, you could accomplish that with page-breaks, like this:


<br clear="all" style="page-break-before:always"/>



Or put something in your CSS:

.break {
page-break-before: always;
}

Then use <div class="break"></div> where needed.

Rob Lister
07-05-2012, 10:49 AM
Is it necessary to have so many files?

Yea, wow. almost 3000 separate html files. I've never seen an epub with more than 100, and that was a really big book.

AlexBell
07-06-2012, 04:59 AM
Yea, wow. almost 3000 separate html files. I've never seen an epub with more than 100, and that was a really big book.

I agree. You may like to note, Karen, that it's customary (though not obligatory) to have one XHTML file for each chapter. It's hard to visualise any book with nearly 3,000 chapters, or to visualise the ToC that such a book would have.

Would it not be possible to group your XHTML files? I really think that would be more sensible than messing around with the structure of the content.opf file. I wonder what the toc.ncx file looks like.

Could we have a look at one of your XHTML files? I have done ebooks with fewer paragraphs than you have XHTML files.