Giter Site home page Giter Site logo

md2pdf's Introduction

md2pdf: A Python Markdown to PDF Converter

Convert Markdown to PDF using markdown2 and wkhtmltopdf.

Install

Archlinux

Use the provided AUR package

Other Linux Systems

Install the wkhtmltopdf package first

  • Debian/Ubuntu
    sudo apt install wkhtmltopdf
    
  • Others
    sudo pip install wkhtmltopdf
    

And then install md2pdf to your Python environment:

pip install .

or:

python setup.py install

Usage

You can run md2pdf using

  • the entry-script md2pdf
  • calling the module python -m md2pdf
md2pdf <markdown-file.md>
md2pdf <markdown-file.md> -o <pdf-file.pdf>

Please run md2pdf --help to find more usage.

Options:
  --keep-html / --delete-html  Keep or delete intermediate html file
  -o, --output PATH            Specify output file. Default: <md_file>.pdf
  -c, --css PATH               Path to CSS file
  -w, --wkarg TEXT             Additional wkhtml2pdf arguments specified as
                               --wkargs="--margin-top=0". This option can be
                               specified multiple times.
  --version                    Show the version and exit.
  --help                       Show this message and exit.

License

MIT licensed as found in the LICENSE file.

md2pdf's People

Contributors

walwe avatar zhangkaizhao avatar

Stargazers

 avatar Edwin Siebel avatar  avatar Akitae avatar André Marcelo Alvarenga avatar hossein s. borhani avatar  avatar Lubomir Anastasov avatar Sim avatar  avatar Eric Moynihan avatar  avatar Axel avatar Slavik Svyrydiuk avatar Michael Dodis avatar Michael Komodromos avatar  avatar Alberto Labarga avatar  avatar Andy DeVane avatar Alessandro Re avatar Brian Guerrero avatar  avatar  avatar Lucas Bourneuf avatar

Watchers

Jan Georgens avatar James Cloos avatar  avatar Michael Dodis avatar

md2pdf's Issues

Not working with python3.8

Error:

Traceback (most recent call last):
  File "/usr/bin/md2pdf", line 5, in <module>
    from markdown2pdf import main
  File "/usr/lib/python3.8/site-packages/markdown2pdf/__init__.py", line 20
    print css_file
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(css_file)?

Failed to load about:blank

I get the following when running md2pdf [1].
It also does not include an image specified in the md [2].

[1]
$ md2pdf -c documents/stylesheets/markdown.css --keep-html -o out.pdf in.md
Loading page (1/2)
Warning: Blocked access to file
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Printing pages (2/2)
Done
Exit with code 1 due to network error: ProtocolUnknownError

[2]
<div width="100%" style="background-color:#EE0000;padding:25px;"><img src="image/logo.svg" height="80px"></div>

md2pdf can't convert tables

When I convert this text (using the command python -m md2pdf Mattenheter.md):

| Produkt | 1dl, ca gram | 1msk, ca gram | 1 tsk, ca gram | 1 liter, ca gram |
|---|---|---|---|---|
| Vetemjöl | 60 gram | 9 gram | 3 gram | 575-625 gram | 
| Smör (fast) | 95 gram | 15 gram | 5 gram | - |

I get this:

| Produkt | 1dl, ca gram | 1msk, ca gram | 1 tsk, ca gram | 1 liter, ca gram | |---|---|---|---|---| | Vetemjöl | 60 gram | 9 gram | 3 gram | 575-625 gram | | Smör (fast) | 95 gram | 15 gram | 5 gram | - |

I'm running version 0.0.2.r0.g9631443 on Arch Linux.

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.