Giter Club home page Giter Club logo

blog-css-book-demo's Introduction

Printing a book with HTML and CSS: demo

This repository shows advanced CSS features for printing a book from an HTML page:

  • Transform links to footnotes.
  • Table of contents.
  • Cover page.
  • Page parameters.
  • Page numbers.
  • Blank pages.
  • etc.

Blog article related to this repository: http://blog.michaelperrin.fr/2019/11/04/printing-the-web-part-2-html-and-css-for-printing-books/ .

The build/book.pdf is the file generated from from the book.html file of this repository.

Generating the PDF file

I have created a Docker image for Prince XML.

Make sure Docker is installed and run:

docker run --rm \
    -v "`pwd`":/data \
    michaelperrin/prince:latest \
    -o /data/build/book.pdf \
    /data/book.html

blog-css-book-demo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

blog-css-book-demo's Issues

no license specified

could you please set a license for the repo, so that I know if I can reuse your code?

Why the book can't be printed from Chrome 88?..

Hey @michaelperrin,

thanks for putting up the article and the example.

It's (probably) not an issue with the repo, but... I don't quite understand is why in the year 2021 we still need Prince to print printer-friendly web pages. Namely, https://caniuse.com/css-paged-media claims CSS Paged Media is supported in Chrome since version 15, but the layout is completely off when I hit ctrl-p in Chrome 88. No picture on the first page, some text being cropped on the second...

Screenshot 2021-02-04 at 01 06 40

I tried styling for printing around 5 years ago, didn't succeed much but hoped the browser vendors had some progress in the meantime. Seems like they had none... :/

What's your experience and thoughts about browser compatibility?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.