Code Monkey home page Code Monkey logo

docker-topdf's Introduction

Usage

  1. Install Docker and start it.
  2. Transfer mycv.md to mycv.pdf with one of the following command:
# without any stylesheet
docker run -i --rm --volume $(pwd):/work --workdir /work yeszao/topdf md2pdf mycv.md

# with topdf comes with stylesheet
docker run -i --rm --volume $(pwd):/work --workdir /work yeszao/topdf md2pdf mycv.md --theme=/css/cv.css

# with completely custom stylesheet
docker run -i --rm --volume $(pwd):/work --workdir /work yeszao/topdf md2pdf mycv.md --theme=style.css

Where,

  • yeszao/topdf is the docker image name.
  • md2pdf is the python plugin md2pdf installed in the docker image, we can use it directly.
  • --theme use custom style sheet. You can:
    • let it blank,
    • using topdf comes with style /css/cv.css,
    • or any other stylesheet placed in a current directory, here is style.css.
  • For convenience, we recommend naming alias for this command.

Set command alias

After naming alias, you can use it like this:

topdf mycv.md
topdf mycv.md --theme=/css/cv.css

Mac OS X or Linux

open ~/.bashrc or ~/.zshrc, add following line:

alias topdf='docker run -i --rm --volume $(pwd):/work --workdir /work yeszao/topdf md2pdf'

Windows

  1. Create a file name alias.bat under %USERPROFILE% folder, content:
@doskey topdf=docker run -i --rm --volume $(pwd):/work --workdir /work yeszao/topdf $*
  1. Create another file name alias.reg, content:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="%USERPROFILE%\\alias.bat"
  1. Double click alias.reg file, you can now use the topdf command on the CMD:

Fonts

Default, topdf image had included following fonts, you can just use it at your css file:

  • Arial (Bold, Italic, Bold Italic)
  • Calibri (Bold, Italic, Bold Italic)
  • Times New Roman (Bold, Italic, Bold Italic)
  • Microsoft YaHei (微软雅黑)
  • Hiragino Sans GB (冬青黑体)
  • FZHei-B01S (方正黑体简体)

Build and Push (Just for maintainers)

First, get an access token from hub.docker.com, then login with this access token:

docker login --username <username>

Build the image and push it to hub.docker.com:

docker build -t yeszao/topdf -t yeszao/topdf:0.2 .
docker push yeszao/topdf --all-tags

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.