Git Product home page Git Product logo

cssprint-sample's Introduction

HTML+CSS 图书排版示例

这里的示例代码节选自本人的译作《物理是什么》简体中文版,朝永振一郎著,人民邮电出版社2017年6月出版。

这本书是我自己用HTML+CSS排版输出的,在国内出版领域属于小众案例,因此我正在写一篇文章分享这次经历和其中的一些技术话题(文章链接等发布后补充),为了让大家更好地理解HTML+CSS图书排版,我将这本书的部分源代码共享出来,欢迎各种讨论和交流。

环境依赖

要将本示例中的代码渲染输出成PDF,需要安装以下软件:

其中Prince为商业软件,但提供全功能免费版本,只是输出的PDF文件第一页右上角会加上水印,本示例中预先渲染的PDF文件也包含该水印。

此外,本示例中还引用了方正的若干商业字体,这些字体已由出版社(人民邮电出版社)获得授权,但该授权仅用于出版图书使用,因此我无法将这些字体一起提供出来,大家可以自行安装这些字体,或者在src\css\styles.css样式文件中替换掉这些字体。

如何渲染PDF

示例中提供了渲染脚本build_pdf,这个脚本会先运行PhantomJS调用MathJax来渲染文章中的数学公式,然后再运行Prince渲染输出PDF,请确保系统中已安装上述软件。

示例中也提供了我预先渲染好的PDF文件(build/book.pdf)供大家参考。注意:PDF正文中遇到如“第0页”的显示是正常的,因为示例节选了源代码的一部分,导致一些交叉引用会失效。

版权声明

本示例中的代码为已正式出版的图书的一部分,该书的版权属人民邮电出版社所有。本示例中的代码仅供学习交流使用,如利用本示例中的代码对版权方造成侵权后果,则需承担相应的法律责任。

致谢

本示例中使用了以下开源项目的代码,在此表示感谢:

cssprint-sample's People

Contributors

shyujikou avatar

Watchers

 avatar

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.