Jeff Duntemann's Contrapositive Diary Rotating Header Image

Print and Ebook from the Same PDF

I’ve been tinkering with a recast of my 1993 book Borland Pascal 7 From Square One since 2008, for the excellent FreePascal compiler. One reason I set the project aside after a year or so is that I wanted to see if the Lazarus IDE would mature a little. I had originally planned to use the text-mode IDE bundled with the compiler, but it had what I considered dealbreaker bugs. Besides, if Lazarus became usable, I could create a tutorial for it as well. Lazarus is now at V1.2.2 and (at least to the limits of my tests so far) works beautifully. I’ve gone back to the FreePascal From Square One project, yanking out all mention of the text-mode IDE, and deliberately tilting it toward a prequel tutorial for a future book on OOP and creating GUI apps in Lazarus, Delphi-style.

One of my goals with the project has been to create a single PDF that can be used as both an ebook and a print image. I’ve experimented with implementing it as an epub, with disastrous results. Layouts containing lots of art just don’t work as reflowable text. On the other hand, PDF images are painful to read and navigate unless the reader device can render a full page legibly. Back in 2008, we didn’t even have iPads yet, and the target display for my PDF ebooks was my 2005-era IBM X41 Tablet PC. You could read the PDF…barely. I spun a couple of page layouts that used smaller pages and larger fonts. They were readable, but looked bizarre (almost like children’s books) when printed to paper.

I left it there for some years. Come 2010 we met the iPad, with the multitude of Android slabs hot on its heels. Displays improved radically. I got an Asus Transformer Prime in 2012, and found the 1280 X 800 display startling. I took the page design that I had originally created for my X41 and tweaked it a little. The page size is A4 rather than letter or standard computer trim, for three reasons:

  • Whereas some POD houses can give you computer trim, sheets aren’t readily available at retail and thus can’t be printed at home.
  • A4 paper is the default paper size in Europe, where I suspect that most of my readers will be. It can be had in the US from the larger office stores, and modern laser printers will take it. Lacking A4 paper, the book can be printed to letter sheets with only a little bit of reduction.
  • A4 paper is taller and narrower than letter, and maps a little better to the wide-format displays that dominate the non-iPad tablet segment.

The layout still looks odd to me. Half a century of reading has made me used to fine print, so the larger type jars a little. However, the layout has plenty of room for technical art and screenshots, and full pages read very well on the Transformer Prime. (This is not true on the much smaller Nook Color.)

With print publishers struggling terribly, I’m guessing that this is one possible future for technical publishing: new layouts that allow the same PDFs to be either printed or rendered as ebooks. More and more specialty books that I buy are POD (I know how to spot them) and the customary high prices on computer books leave plenty of margin to make POD copies profitable.

You can help me out a little. The ebook is far from finished, but I’ve posted the PDF here. I’d be curious to know how legibly it renders on other tablets, particularly those smaller than 10″ but with 1280 X 800 or better resolution. Again, it’s not a complete book and there are plenty of typos and layout glitches in it. What I want to know is whether or not technical readers will find it usable on modern tablets. Thanks in advance for any feedback you can provide.

18 Comments

  1. Jonathan O'Neal says:

    Slightly below the specs you asked for, but I paged through your ebook sample using my cheap Android device that has a display resolution of 1024×600. All text, diagrams, and screenshots were perfectly legible, and I experienced no significant eyestrain when reading a few pages. I viewed it using both my browser’s internal viewer and a separate PDF viewer; both automatically downsized the pages to fit my little display, with no ill effects. Pinch-zooming on screenshots, diagrams, or text increased both size and resolution (e.g. zooming in provided the additional detail I might have been looking for). I did most of my testing in portrait mode; needless to say, the text was sharper in landscape mode, but the viewing window was intolerably short.

    All in all, I’d say it’s quite usable. That said, here’s the caveat: my standards might be lower than the norm. I’ve read many classic novels in PDF format, overlooking the obvious pagination errors, occasional OCR flubs, and inability to effectively resize or reflow the text. I might be far more forgiving than a serious customer. (Of course, the book is free…)

  2. The book is free and will continue to be free, even when it’s finished. (It’s still only about halfway done, and full of layout/ formatting booboos.) You’ve told me something valuable: That the book is useful even on a lower-res device. Now, what’s the diagonal on the display? I’ve begun to get used to the look of the pages when printed to paper, and all in all, I think I’m on the right track. Many thanks for taking the time to do a detailed test.

    1. Jonathan O'Neal says:

      It’s marketed as a 7″ device, and I was surprised when I measured it just now – it’s actually a hair over 7″ diagonal. (Ever measure an old TV CRT and get a number larger than the advertised size?) The dimensions containing actual pixels are 3.54×6.06″, creating a 7.01″ diagonal. When you subtract the Android footer and the reader app’s header, the readable area becomes 3.54×5.47″, creating a 6.54″ diagonal.

      Watching myself type these numbers, they seem rather tiny, but I use the Kindle app on this to read books all the time, without eyestrain or excessive page-flipping. It’s surprising how small usability can become. 7″ seems to be a sweet spot between content and bulk, at least for me.

    2. Jonathan O'Neal says:

      Also: I initially took Figure 2.4 for what you intended – an overview of the environment, not a lot of details that needed to be examined closely. After seeing the comments below, I looked at it again, and discovered that I could read much of it even while it was downsized. A quick pinch-zoom reveals all the details one might want, but if I was reading the book straight through, I’d probably just think, “so that’s what it looks like,” then keep reading (without bothering to zoom in).

  3. Tom Roderick says:

    Was able to download to my Nook HD+ running the N2Acard version of Cyanogenmod and it seems to be perfectly readable. I only got up to page 50, but the DOS command prompt screens could be read easily without pinch-zoom and while Figure 2.4 was clear and sharp at normal zoom, to actually read it required pinch-zoom. Not sure what the resolution on the Nook HD+ is but the diagonal measurement is right at 9 inches of useable screen. I will try to take a longer look tomorrow. So far it looks completely useable and I do intend to read more. Now I need to try for MY 8 hours!

  4. Kevin W. says:

    I had similar results to Tom on a stock 7″ Nook HD (1440×900, 243ppi). I tried two different reader apps and found that figure 2.4 in particular was the most challenging but worked best in the app that used the entire screen width for a single page when I held the tablet horizontally, avoiding the relatively tedious pinch-zoom and scroll process. Overall definitely an acceptable reading experience; I can easily envision having the book open on my tablet as I worked through examples on my laptop, avoiding the need to alt-tab back and forth.

    1. Figure 2.4 may not be a readability issue because it was intended only to give a “big picture” view of the full Lazarus environment. The reader does not need to take any specific information away from the figure. Later on, when there are screenshots that do convey specific information, I’ve made them small enough (by closing unneeded windows and reducing window width) to be easily readable. Thanks to both of you for taking a detailed look and providing a report!

  5. Larry Nelson says:

    My iPad isn’t a small device but the ebook looks good in portrait. Flipping to landscape bumps the font size a bit for easier reading of long blocks of text.

    Thank you for a PDF that is 10 time better looking that what you see from a lot of big time publishing houses. Maybe that is the reason some of them are headed for the small time.

    As always, I learn things about you from your books. You did Forth!?!?!? My first hobby purchase of a computer language was CP/M figForth on an 8″ floppy back in 1981. I appreciated what it taught me about compiler design and extensibility. I didn’t do enough to get your smoldering pile of tires . . . please tell that story some day.

    1. Yup. FigFORTH on an 8″ floppy was the first client-side language I had easy access to, on my 1980 CP/M machine. I had taken a FORTRAN course in high school, and played with minicomputer BASIC and later mainframe APL prior to getting the 8080. I messed with a lot of things back then, most of which have been forgotten, like SAM76, Marty Franz’s Runic, and the Vulcan database, among others. Lee Hart did an RCA CDP1802-based FORTH called 8TH, which took almost no space and was completely brilliant.

      All that said, FORTH code seemed incomprehensible once you’d left it for awhile. A short while. Maybe no while at all, heh. Ditto APL. BASIC got me to Pascal, which was (finally) readable. Once it got its hooks in me, I was never completely comfortable with the multitude of curly-bracket languages, though I have some late-middle-age affection for Python.

  6. Lee Hart says:

    Looks like it will be a great book, Jeff. I’ve always liked your style of writing.

    On languages: I believe that computer languages are tools. You pick the tool to suit the problem. This is diametrically opposed to the modern notion that you should use one tool for everything (C, Java, Python, or whatever). It makes you view every problem into a nail that you must beat upon with your favorite hammer.

    FORTH is a special tool, for special problems. It’s mainly good for I/O intensive work; ordering the computer around right down at the bit level. It’s not good for text processing or number crunching, and it’s *certainly* no good for explaining things to people!

    Pascal was derived from Algol, which was devised specifically to explain algorithms to *people*. So, I see Pascal as a wonderful language to explain what you’re doing to other *people*. This is just about the exact opposite of FORTH.

    I like Pascal. I wish it had become more mainstream, as a way to teach programming. If it had, a lot more people would have learned to program!

    Here’s the thing I don’t understand: Computers have become vastly powerful. They can even translate one human language into another (a very difficult task). So, why must we put up with gobbldygook languages that were designed to make life simpler for the *computer*, at the expense readability and understandability for humans?

    1. “They can even translate one human language into another (a very difficult task)”. True, but their success is limited – e.g., “Eu vi um sapo” is Portuguese for “I saw a toad”, which Google Translate claims to be “I saw a sapo”; the strange bit is that it then shows a correct translation of “sapo” below the text box. The reason these translations actually work is because the recipient is a human, who is able to look at what the computer produced and interpret his way around the mistakes.

      I’d say the issue with programming languages comes from wanting to make life simpler for the human, in the face of ever-growing complexity. And it’s not even the language itself. It’s the myriad of components required to build software, and the need to combine said components to build more complex software.

      If you just develop a few utilities to read a file, process its lines, and write them out, even C++ is simple, especially after C++11.

    2. Tom Roderick says:

      Well Said Lee! My FIRST computer language (other than solder) was Algol and after that I spent some time in PDP-8 assembler, Fortran and some proprietary data retrieval and utility languages back in the days before Relational Databases. When I got Turbo Pascal on my first DOS computer (an AT&T 6300) it was like coming home to an old friend.

      I worked for over 30 years in an organization where all production code was COBOL, which I never wrote a line of, but when something had to be done or fixed in a hurry, I used whatever worked best for the task at hand. PERL, C, Fortran and two or three more in there somewhere.

      I am definitely read Jeff’s book and get FreePascal and Lazarus and relive my past!

  7. Don Doerres says:

    The PDF works great on my Samsung Note II with its 5.5″ , 720×1280 display running Android. I can zoom in 250% on the text and it does not pixelate. The images all look great at the same zoom levels. Impressive piece of work

  8. Jeff, I can’t comment on how it looks on a tablet, since I don’t own one, but I’d like to congratulate you.

    Why?

    I read my PDFs on PDF-XChange Viewer and override the document colours, because a grey background is less tiring for my eyes than a white. I’ve had issues with every book I’ve read, with images and sidebars blacked out. I’m on page 56 of yours, and so far no problems.

    Thanks.

  9. Tony Kyle says:

    I’ll look at home on a newer iPad but on my computer screen it looked pretty good. What I’ve read was easy to read and the not hard on my old’ish eyes.

  10. Mike Bentley says:

    “new layouts that allow the same PDFs to be either printed or rendered as ebooks.” Hm, that sounds like Flipboard, an app for at least iPad and likely many others. Flipboard selects among several hundred predefined webby layouts for automated content presentation in order to real-time integrate content in magazine form based on your surfing inclinations.

  11. Jack Smith says:

    While Pascal remains my programming language of choice, when it’s time to work in an embedded system with a PIC microcontroller, there’s only one Pascal compiler available, from Mikro Elektronika and the last time I tried it (to be fair some years ago) it was too buggy for my liking.

    David Barker, programmer extraordinaire, in the UK has recently released his 2nd PIC compiler, FireWing. http://www.firewing.info/ and I’ve been working with it for a week or so.

    The language as seen by the user is a close replica of Visual Basic, but since it’s running on a PIC, it’s a shadow of the Windows VB.

    However, what seems to be going on under the hood is that the BASIC code is transformed into C and the C is compiled by one of MicroChip’s C compilers to a machine language HEX file that then is loaded into the PIC micro-controller. (MicroChip has multiple versions of their compiler depending on the PIC architecture and whether you go with the free version or an upgraded licensed model.)

    In essence, the BASIC compiler is a front end for a C compiler. I suppose technically these are all ‘cross compilers’ since they run on a different machine (Windows) than the PIC for which the code is generated.

    In any event, the result is a nicely done BASIC implementation with a clean interface. The machine language instruction set seems compact and efficient.

    And, FireWing is free. The development boards are reasonably priced and use a Arduino-compatible ‘shield’ arrangement.

  12. Bill Meyer says:

    Jeff, the link does not work at this writing.

    I’m very curious to see your PDF, as my trusty Kindle 3 has always been miserable as a PDF display. I’m not expecting miracles, but am curious to see what you have achieved.

    I have yet to buy a tablet. The Kindle has been addictive, and two of its many features are of high importance to me: first, that I can read it in sunshine; second, that battery life is measured in weeks.

    That said, I must tell you that I have not yet seen a Kindle book on code which was even tolerable. And ebooks, in general, are badly formatted, and badly (rarely?) proofread. That’s a shame, as I take the Kindle with me almost everywhere. It’s especially wonderful in any sort of waiting room, of which we are these days cursed with far too many.

Leave a Reply

Your email address will not be published. Required fields are marked *