Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 01-15-2019, 05:02 PM   #1
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Looking at the html of a Kindle Create (kpf) file

I'm playing about with Kindle Create, and I'd love to see the html I am,um, Creating. Is there any way to do that, short of actually publishing the book and then Unpacking it?

The book is a short one, about 20K words I think, and I was impressed that the published size is promised to be 0.3 MB with a download fee of 5 cents. That suggests that the html is not monstrous, doesn't it?
Notjohn is offline   Reply With Quote
Old 01-15-2019, 06:43 PM   #2
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,496
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
A KPF file is composed of Amazon's proprietary Ion data format contained in an SQLite database. There is no HTML code there. This Ion data is repackaged in a KFX container to make the KFX (enhanced typesetting) format of the book. As a fallback for older devices that do not support KFX, Amazon converts the Ion data to a MOBI equivalent that has a limited subset of the formatting of the original document.

So if you look at the MOBI file you will not see the actual coding used in the book. You can dump the contents of the KPF file into readable Ion-text format using my KFX Input plugin for calibre, but you will probably find that to be not very comprehensible.

As an example I created a book composed of a single paragraph with some simple formatting. The equivalent KPF Ion data is shown in the spoiler.

Spoiler:
Code:
$ion_1_0

format_capabilities:: [
  {
    key: "db.schema",
    version: 1,
  },
]

$ion_symbol_table:: {
  max_id: 777,
  imports: [
    {
      name: "YJ_symbols",
      version: 10,
      max_id: 744,
    },
  ],
  symbols: ["yj.semantics.page_number_begin", "yj.semantics.book_theme_metadata", "yj.semantics.modern_theme", "yj.semantics.book_theme_name", "yj.semantics.book_theme_styles", "yj.semantics.book_subtitle", "yj.semantics.author", "yj.semantics.part_title", "yj.semantics.part_subtitle", "yj.semantics.chapter_title", "yj.semantics.chapter_subtitle", "yj.semantics.first_para", "yj.semantics.block_quote", "yj.semantics.copyright", "yj.semantics.dedication", "yj.semantics.book_epigraph", "yj.semantics.book_epigraph_attribution", "yj.semantics.poem", "yj.semantics.separator", "yj.semantics.other_page_title", "yj.semantics.other_first_para", "yj.semantics.bodytext", "yj.semantics.book_title", "yj.semantics.book_theme_content_semantics"],
}

uAs_WcpQTsG26QhmxKKmkA1:: section:: {
  section_name: uAs_WcpQTsG26QhmxKKmkA1,
  page_templates: [
    structure:: {
      kfx_id: uAs_WcpQTsG26QhmxKKmkA4,
      story_name: uAs_WcpQTsG26QhmxKKmkA5,
      type: text,
    },
  ],
}

content_features:: {
  kfx_id: content_features,
  features: [
    {
      namespace: "com.amazon.yjconversion",
      key: "reflow-style",
      version_info: {
        version: {
          major_version: 1,
          minor_version: 0,
        },
      },
    },
  ],
}

uAs_WcpQTsG26QhmxKKmkA5:: storyline:: {
  story_name: uAs_WcpQTsG26QhmxKKmkA5,
  content_list: [uAs_WcpQTsG26QhmxKKmkA6],
}

uAs_WcpQTsG26QhmxKKmkA8:: auxiliary_data:: {
  kfx_id: uAs_WcpQTsG26QhmxKKmkA8,
  metadata: [
    {
      key: "most-common-computed-style",
      value: "ComputedStyle [{FONT_SIZE=decimal:1.0 em}{MARGIN_LEFT=decimal:0.0 percent}{MARGIN_RIGHT=decimal:0.0 percent}{hasBackgroundColor:false}{hasBackgroundImage:false}{hasBorder:false}]",
    },
    {
      key: "filename.opf",
      value: "misc/resource_0_1_82312ff879470c63_1_filename_opf",
    },
    {
      key: "SourceIdContentInfo",
      value: "..\\misc\\sourceIdInfo.json",
    },
  ],
}

uAs_WcpQTsG26QhmxKKmkA6:: structure:: {
  kfx_id: uAs_WcpQTsG26QhmxKKmkA6,
  dropcap_lines: 3,
  dropcap_chars: 1,
  type: text,
  style_events: [
    {
      offset: 123,
      length: 108,
      font_weight: bold,
    },
    {
      offset: 334,
      length: 111,
      font_style: italic,
    },
  ],
  content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
}

'uAs_WcpQTsG26QhmxKKmkA1-spm':: section_position_id_map:: {
  section_name: uAs_WcpQTsG26QhmxKKmkA1,
  contains: [[1, uAs_WcpQTsG26QhmxKKmkA4], [2, uAs_WcpQTsG26QhmxKKmkA6]],
}

'yj.section_pid_count_map':: {
  contains: [
    {
      section_name: uAs_WcpQTsG26QhmxKKmkA1,
      length: 446,
    },
  ],
}

eidbucket_29:: 'yj.eidhash_eid_section_map':: {
  block: 29,
  contains: [
    {
      eid: uAs_WcpQTsG26QhmxKKmkA1,
      section_name: uAs_WcpQTsG26QhmxKKmkA1,
    },
  ],
}

eidbucket_32:: 'yj.eidhash_eid_section_map':: {
  block: 32,
  contains: [
    {
      eid: uAs_WcpQTsG26QhmxKKmkA4,
      section_name: uAs_WcpQTsG26QhmxKKmkA1,
    },
  ],
}

eidbucket_34:: 'yj.eidhash_eid_section_map':: {
  block: 34,
  contains: [
    {
      eid: uAs_WcpQTsG26QhmxKKmkA6,
      section_name: uAs_WcpQTsG26QhmxKKmkA1,
    },
  ],
}

metadata:: {
  reading_orders: [
    {
      reading_order_name: default,
      sections: [uAs_WcpQTsG26QhmxKKmkA1],
    },
  ],
}

book_metadata:: {
  categorised_metadata: [
    {
      category: "kindle_title_metadata",
      metadata: [
        {
          key: "book_id",
          value: "KjzAroqdSrS7DV2Kt_ZwVQ1",
        },
        {
          key: "publisher",
          value: "",
        },
        {
          key: "author",
          value: "John Howell",
        },
        {
          key: "language",
          value: "en",
        },
        {
          key: "title",
          value: "Test Book",
        },
      ],
    },
    {
      category: "kindle_audit_metadata",
      metadata: [
        {
          key: "creator_version",
          value: "1.20.1.0",
        },
        {
          key: "file_creator",
          value: "KC",
        },
      ],
    },
    {
      category: "kindle_ebook_metadata",
      metadata: [
        {
          key: "selection",
          value: "enabled",
        },
      ],
    },
  ],
}

document_data:: {
  column_count: auto,
  direction: ltr,
  writing_mode: horizontal_tb,
  font_size: {
    value: 1e0,
    unit: em,
  },
  'yj.semantics.page_number_begin': uAs_WcpQTsG26QhmxKKmkA1,
  selection: enabled,
  auxiliary_data: {
    'yj.conversion': uAs_WcpQTsG26QhmxKKmkA8,
  },
  line_height: {
    value: 1.2e0,
    unit: em,
  },
  'yj.semantics.book_theme_metadata': {
    'yj.semantics.book_theme_name': 'yj.semantics.modern_theme',
    'yj.semantics.book_theme_styles': {
      'yj.semantics.book_subtitle': YxlATNbCQzCcg6wXkeYWmQ129,
      'yj.semantics.author': YxlATNbCQzCcg6wXkeYWmQ130,
      'yj.semantics.part_title': YxlATNbCQzCcg6wXkeYWmQ131,
      'yj.semantics.part_subtitle': YxlATNbCQzCcg6wXkeYWmQ132,
      'yj.semantics.chapter_title': YxlATNbCQzCcg6wXkeYWmQ133,
      'yj.semantics.chapter_subtitle': YxlATNbCQzCcg6wXkeYWmQ134,
      'yj.semantics.first_para': YxlATNbCQzCcg6wXkeYWmQ135,
      'yj.semantics.block_quote': YxlATNbCQzCcg6wXkeYWmQ127,
      'yj.semantics.copyright': YxlATNbCQzCcg6wXkeYWmQ136,
      'yj.semantics.dedication': YxlATNbCQzCcg6wXkeYWmQ137,
      'yj.semantics.book_epigraph': YxlATNbCQzCcg6wXkeYWmQ138,
      'yj.semantics.book_epigraph_attribution': YxlATNbCQzCcg6wXkeYWmQ139,
      'yj.semantics.poem': YxlATNbCQzCcg6wXkeYWmQ140,
      'yj.semantics.separator': YxlATNbCQzCcg6wXkeYWmQ141,
      'yj.semantics.other_page_title': YxlATNbCQzCcg6wXkeYWmQ142,
      'yj.semantics.other_first_para': YxlATNbCQzCcg6wXkeYWmQ143,
      'yj.semantics.bodytext': YxlATNbCQzCcg6wXkeYWmQ144,
      'yj.semantics.book_title': YxlATNbCQzCcg6wXkeYWmQ128,
    },
    'yj.semantics.book_theme_content_semantics': {
      'yj.semantics.separator': "\u25c6\u25c6\u25c6",
    },
  },
  spacing_percent_base: width,
  reading_orders: [
    {
      reading_order_name: default,
      sections: [uAs_WcpQTsG26QhmxKKmkA1],
    },
  ],
}
Attached Thumbnails
Click image for larger version

Name:	test-book.jpg
Views:	374
Size:	92.1 KB
ID:	169123  

Last edited by jhowell; 01-15-2019 at 06:58 PM.
jhowell is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Kindle dictionary from html files(or chm) Ricsie Workshop 3 02-28-2015 08:53 AM
mktoc.pl: create table of contents in HTML file Pranananda Workshop 4 03-04-2013 11:57 PM
Create HTML File? Harry Voss Sigil 5 05-23-2012 01:14 PM
Convert HTML file to MOBI for Kindle IMFletch Calibre 5 04-16-2010 01:06 PM
Open HTML from Kindle file system w/browser tomsem Kindle Developer's Corner 2 05-03-2009 01:21 PM


All times are GMT -4. The time now is 12:04 AM.


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