bigskysoftware/hypermedia-systems-old

Entire book in one page, when saved as PDF, crops code that has horizontal scrollbar

Closed this issue · 2 comments

I saved the book as PDF so that I can underline or highlight
A few code snippets in part II have horizontal scroll bar

These code blocks are cropped when printed to pdf

the part of the line that goes beyond right edge is not printed.

1cg commented

Hi @metaforte sorry about that, but not much we can do about it at this point.

Not savvy with AsciiDoc, but using asciidoctor-pdf (to convert ADOC files to PDF) and pdftk (to concatenate individual PDF files) solved this issue for me:

  1. Clone this repo and get into the book directory

    git clone https://github.com/bigskysoftware/hypermedia-systems.git
    cd hypermedia-systems/book
    
  2. Copy the contents of the images directory into book

    cp -r ../images/* .
    
  3. Install asciidoctor-pdf and pdftk

    (The easiest way to do this is with Nix:
    nix-shell -p asciidoctor-with-extensions pdftk
    )

  4. Convert ADOC files to PDF

    asciidoctor-pdf --verbose --section-numbers *adoc
    
  5. Concatenate the resulting PDF files in the right order

    pdftk COPYRIGHT-ACKNOWLEDGMENTS.pdf DEDICATION.pdf Foreword.pdf CH*pdf cat output hypermedia_systems.pdf
    

The result (hypermedia_systems.pdf) looks a bit rough, but each code section is intact and there is a Table of Contents too. (Sort of; couldn't figure out how to number the chapters, and only the sub-sections are numbered...)