[NTLK] Converting NewtonBooks to ePub

J Caffiney caffiney at gmail.com
Wed Feb 25 05:28:52 PST 2026


Matthias,

Thanks, this is exactly the kind of detail I was hoping someone had. Your
breakdown of the style run structure matches what I've been able to piece
together.

The style runs were the main puzzle (figuring out that the numbers are
character counts and not byte offsets into the text string), with each
count/style pair applied sequentially. Once that clicked, most of the
formatting came through.

Good point about the more complex features. I've been focused on the common
case — text, styles, chapters, basic metadata. Haven't run into embedded
scripts or forms yet, but I'd guess those are edge cases in the UNNA
library.

I'll let the community weigh in on the interest question. I'm going to try
to finish it for my own books either way.

-J

On Wed, Feb 25, 2026 at 8:11 AM Matthias Melcher <m.melcher at robowerk.de>
wrote:

>
> Just to give a little technical overview. The file header looks like this:
>
>   signature: 'package0,
>   id: "xxxx",
>   flags: {},
>   version: 1,
>   copyright: "\uFFA9\u1995 Cortland Publishing. All rights reserved.",
>   name: "Midsummer Night:JonC",
>   size: 242188,
>   creationdate: -1411759343,
>   modifyDate: -1411759343,
>   reserved3: 0,
>   directorySize: 284,
>   info: "Newton\u2122\u ToolKit Package \u00A9\u 1992-1994, Apple
> Computer, Inc.\u0000\u",
>   part: [
>     {
>       offset: 0,
>       size: 241904,
>       type: "book",
>       flags: {type: 'nos, Notify: true},
>       info: "book",
>       data: {
>         book: {
>           version: 1,
>           isbn: "Co9505122133",
>           title: "A Midsummer Night's Dream",
>           shortTitle: "MND",
>           copyright: "\u00A9\u 1995 Cortland Publishing",
>           author: "William Shakespeare",
>           publisher: "Cortland Publishing",
>           data: {},
>           contents: [
>             Ref_23,
>             Ref_25,
>             :
>             : ... and many more
>
> where Ref_23 for example is
>
> {data: "Title Page", layout: 2048}
>
> and Ref_25 is
>
> {
>   data: "\n\nA Midsummer Night's Dream\nby William Shakespeare\n\n1596\n",
>   styles: [
>     2, {family: 'espy, face: 0, size: 10},
>     25, {family: 'newyork, face: 0, size: 18},
>     24, {family: 'espy, face: 0, size: 10},
>     1, {family: 'newyork, face: 0, size: 12},
>     4, {family: 'espy, face: 0, size: 10},
>     2, {family: 'newyork, face: 0, size: 12}
>   ],
>   layout: 4,
>   viewJustify: 2
> }
>
>
> So there is a lot of plain text, and the formatting is defined by the
> "style" tag. Here in the title, we have two characters in the Epsy font
> with 10 pixel height ('\n\n' are two "carriage return/new line" characters,
> just like on the type writer.
>
> Then we have 25 characters in NewYaork forny an 18 pixels high: "A
> Midsummer Night's Dream", and so on.
>
> "viewJustify: 2" means centered on the page. This information can be found
> in the Newton Programmers Guide.
>
> So all in all, this is a pretty readable format. No compression, no
> encryption - at least not in the files that I looked at.
>
> Newton Books can in theory become quite complex. The format allows
> embedding scripts and entire applications. You can have forms for the user
> to fill out, and so much more. But I doubt that this has been used very
> often. Extracting pure text, attributes, and maybe embedded images is not
> too complicated. How big is the interest by the commuity to have a
> book-to-ePub converter?
>
>  - Matthias
>
>
>
> ----------------------------------------------------------------------
>
> https://newtontalk.net
> https://bitbang.social/@newtontalk
> https://twitter.com/newtontalk
>


More information about the NewtonTalk mailing list