![]() |
#346 |
The Grand Mouse 高貴的老鼠
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 74,010
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
|
The posted 'HTML' clearly sets a fixed page width, but I suspect that's just a way to give a number for all the other measurements to be calculated against. I'm sure that when displayed that fixed width gets scaled according to the device and the font size.
|
![]() |
![]() |
![]() |
#347 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,807
Karma: 6000000
Join Date: Nov 2009
Device: many
|
In case anyone is interested "procyon" (a good java decompiler) exists and is a free download.
It is available here: https://bitbucket.org/mstrobel/procyon/downloads See that site's wiki page for info on how to run it. From a quick glance at things and the class names alone it appears that there is an internal copy of gson (google's java object to json and back serializer/deserializer) being used. There is also a large list of common (all?) html tags terms. Perhaps all of the html elements have been replaced with offsets into a table/map of html elements? Again this is just based on a quick glance before heading off to work this morning. Given gson is used (we can see its source code online since it is open source), perhaps the kdf sqlite3 fragment "blobs" are in fact serialized java objects (serialized to json?). KevinH Last edited by KevinH; 02-17-2016 at 10:46 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#348 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
I am going to hold off on doing that. I lot of what I have is speculation, subject to change. I would rather spend my available time investigating at this point.
Most of what I have found out has already been posted in this thread. If someone else wants to take a stab at organizing it for the wiki that is fine with me. |
![]() |
![]() |
![]() |
#349 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
|
Apart from decompiled java, a good source of information about ION format is library enigmatically called libshared
![]() I am attaching mapping of ids to names for ION types and properties. May be useful, if you don't have it yet (I've seen some of it used in kfx.py). |
![]() |
![]() |
![]() |
#350 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,807
Karma: 6000000
Join Date: Nov 2009
Device: many
|
baf,
Nicely done! This is a huge help towards allowing something else to read/write this format. Thank you. KevinH Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#351 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,807
Karma: 6000000
Join Date: Nov 2009
Device: many
|
baf,
Are you sure about your last Ion symbol Datagram value? The reason I ask is that on the java side these are just a straight enum with DATAGRAM being last which would give it a value of 13, and tid_none and tid_eof are not part of the enum at all. BTW: anyone playing with procyon needs to use a case-sensitive file system. Many of the classes are given the same name with the only difference being case (ie. A.class and a.class) in the same directory. These unpack over themselves and you lose the information. So if you are using Windows or Mac to play with procyon and any jar you need to be aware of that. On a Mac, you can of course take any usb key or spare drive and use DiskUtilities.app to erase and format it as a Mac OS X Journaled Case-Senstive filesystem if you want to play around with procyon. Linux is case-sensitive normally. Not sure what you can do on Windows. KevinH |
![]() |
![]() |
![]() |
#352 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
I suspect that the enumeration with names that start 'hn' will be the most useful.
Last edited by jhowell; 02-18-2016 at 09:52 AM. |
![]() |
![]() |
![]() |
#353 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
|
This is not a typo, but treat it with caution, as I don't know what the purpose of this data is. Also note that not all "tids" match "types" in my table. On the other hand my "tids" fit hn_ enumeration scheme, mentioned by jhowell.
Quote:
|
|
![]() |
![]() |
![]() |
#354 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
You can save the book.kdf file created by the previewer for later use. You need to also save the 'res' directory associated with it, if any. It holds the images and fonts of the book.
You can open the KDF book with the previewer using the control-O command, at least under Windows. You need to navigate to the directory where you saved it and manually enter the name book.kdf in the open dialog. This works even though .kdf isn't shown as a supported format. To re-open properly the file name must remain book.kdf. This file name seems to be hard coded into the previewer. Last edited by jhowell; 02-21-2016 at 07:07 PM. |
![]() |
![]() |
![]() |
#355 |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Curiously, my most recent book (an omnibus of five previously published e-books) does NOT have Enhanced Typesetting enabled, though the included books all do. I wonder, then, if KFX is not being added in the publishing workflow but in some later operation? (I bought the book, as I did the earlier ones, though the earlier ones were all published before KFX was introduced.)
And for what it's worth, I commented on KFX on the KDP forum this morning, only to have the post sent to moderation. I wonder if "KFX" has been added to the list of forbidden words, like "description"? Later: Oh my goodness (as Donald Rumsfeld said in another connection), I just republished the book (yes, I found a typo), and I see that Enhanced Typesetting is now enabled. That was fast. Last edited by Notjohn; 02-21-2016 at 11:50 AM. |
![]() |
![]() |
![]() |
#356 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Quote:
Quote:
I have found no way to discover why a book was rejected. The conversion process produces some logs, which are immediately deleted. Even when I have been able to capture them I have yet to find an indication of what went wrong. Amazon has really failed to be helpful here. This leaves only trial and error to solve enhanced typesetting problems. (At least trial and error is easier with the previewer.) Last edited by jhowell; 02-23-2016 at 07:46 PM. |
||
![]() |
![]() |
![]() |
#357 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 2330752
Join Date: May 2012
Device: kt
|
Quote:
Creating kdf file is a very complicated, multi-staged process. Input html files are cleaned, parsed, individual tags, styles are extracted, images are optimised, mobi files are created and then parsed again. The process involves multiple applications, many temporary files and directories are created and deleted. If any of the stages fails kdf file is not produced and previewer renders mobi file without enhanced features. I suppose most of the errors are due to conservative approach – if there is a chance that parsing might break original layout of the document, the process fails. I didn't have time to test many documents. Some of the errors were as simple as: "The Language given is not supported currently", other more cryptical: "Not exact match - YJ=ContentFormat:YJCANONICAL, ContentType:IMAGE, TextChar:null at md pos 3,Mobi=ContentFormat:MOBI8, ContentType:TEXT, TextChar:T at 283" |
|
![]() |
![]() |
![]() |
#358 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Quote:
The KDF generation process is complicated! (Rube Goldberg comes to mind.) Last edited by jhowell; 02-22-2016 at 10:37 PM. |
|
![]() |
![]() |
![]() |
#359 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
Amazon has another tool, the Kindle Textbook Creator, that can create interactive multi-media textbooks starting with a PDF file. It packages books for uploading to Amazon in Kindle Package Format (KPF) and these .kpf files can also be opened by the new Previewer 3.0 beta.
After trying the Textbook Creator out I examined a KPF file and found that it is just a zip file containing a KDF book, similar to what the Previewer beta creates for enhanced typesetting. I'm guessing that once the KPF is uploaded to Amazon it will be delivered to customers as a KFX book. I experimented a bit and discovered that you can turn an enhanced typesetting book created by the Previewer beta into a KPF file that you can re-open later using just a few steps:
Last edited by jhowell; 02-25-2016 at 09:16 PM. |
![]() |
![]() |
![]() |
#360 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,086
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
KFX Overview
Core to KFX is the ion data representation. It is a means of encoding a complex data structure into a compact binary format. It includes representations for numbers, strings, symbols, and various types of structured data.
The separate ion data structures that make up a book are called fragments or entities. In KDF files produced by Kindle Previewer 3 they are placed in an SQLite database. In KDF the fragments form a hierarchy containing the book content:
Last edited by jhowell; 02-19-2017 at 07:41 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using Kindle format vs ePub format is like using a compiler vs winzip? | Julius Caesar | Workshop | 1 | 09-01-2013 07:34 PM |
iPhone Convert epub format to kindle for iPhone format. Is it possible? | thecyberphotog | Apple Devices | 16 | 03-14-2013 01:04 AM |
No 'epub' format shown in Plugboards Format dropdown list | kakkalla | Library Management | 3 | 06-16-2012 04:23 AM |
Ebook in PRC format will not convert to any other format | Katelyn | Calibre | 0 | 10-01-2010 07:02 PM |
Master Format for multi-format eBook Generation? | cerement | Workshop | 43 | 04-01-2009 12:00 PM |