Python markdown to pdf

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Python based markdown to PDF converter, specially designed for paginated documents

License

werner-duvaud/openleaf-markdown-pdf

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Openleaf: Markdown editor for generating PDF

This is a Python based markdown to PDF converter, specially designed for paginated documents. It can be used as a standalone markdown to PDF converter but a minimalist web editor is available.

I did this project for myself because I needed to produce carefully designed reports while remaining productive and focused on the content. PDF is the most popular format for reports and no markdown editor offers a table of contents with page numbers and a header with the current title. I found LaTex old, complicated, not very hackable and heavy to install, that’s why I tried to make this project:

  • Customizable: preprocessed in Python, designed with HTML and CSS
  • Predefined, hackable and fully customizable CSS styles
  • Table of content with page numbers
  • First page with metadata integration
  • Header & Footer
  • Maths and code rendering with KaTex and Pygments
  • Admonition note blocks
  • Dynamic replacing (ex: \today is replaced by the current date)
  • Page break and disable header for specific pages
Читайте также:  Class error find fix java

website-preview

git clone https://github.com/werner-duvaud/openleaf-markdown-pdf.git cd openleaf/backend python markdown_to_pdf.py --markdown_path my_markdown.md --pdf_path my_pdf.pdf
git clone https://github.com/werner-duvaud/openleaf-markdown-pdf.git
cd openleaf-markdown-pdf/backend pip install -r requirements.txt python backend.py
cd openleaf-markdown-pdf/frontend npm install ng serve

Styles are in pur CSS, they are easily customizable, you can use the default style to get started.

material-style

About

Python based markdown to PDF converter, specially designed for paginated documents

Источник

mdpdf 0.0.18

Python command line application to convert Markdown to PDF.

Ссылки проекта

Статистика

Метаданные

Лицензия: MIT License (MIT)

Требует: Python >=3.8

Сопровождающие

Классификаторы

Описание проекта

mdpdf

Python command line application to convert Markdown to PDF.

Project Features

  • Bare-bones: Only supports basic CommonMark
  • «One-size-fits-all» style: Left-aligned, PDF-base14 fonts. Reasonably pretty, but if you want more control, see alternatives below.
  • Headings are transformed to PDF bookmarks.
  • File links are transformed into attachments with PDF links.
  • Images links are transformed into embedded images with optional captions and width specifier.
  • Minimal requirements
    • commonmark
    • PyMuMDF
    • click

    Alternatives

    There are several projects that can be considered if you need something with more features. Of note:

    Installation

    Usage

    Options:

    • -o, —output FILE Destination for file output. [required]
    • -h, —header Sets the header template.
    • -f, —footer Footer template.
    • -t, —title TEXT PDF title.
    • -s, —subject TEXT PDF subject.
    • -a, —author TEXT PDF author.
    • -k, —keywords TEXT PDF keywords.
    • -p, —paper [letter|A4] Paper size (default letter).
    • —version Show the version and exit.
    • —help Show this message and exit.

    Templates:

    The is a quoted, comma- delimited string, containing the left, centre, and right, fields for the header/footer. Format is «[left],[middle],[right]» .

    Possible values to put here are:

    • Empty string
    • Arbitrary text
    • Special variables:
      • current page number
      • current top-level body text heading
      • current date
      $ mdpdf -o article.pdf article.md $ mdpdf -o article.pdf --footer ",," article.md 

      Источник

      Saved searches

      Use saved searches to filter your results more quickly

      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

      Python Markdown to PDF converter

      License

      walwe/md2pdf

      This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

      Name already in use

      A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

      Sign In Required

      Please sign in to use Codespaces.

      Launching GitHub Desktop

      If nothing happens, download GitHub Desktop and try again.

      Launching GitHub Desktop

      If nothing happens, download GitHub Desktop and try again.

      Launching Xcode

      If nothing happens, download Xcode and try again.

      Launching Visual Studio Code

      Your codespace will open once ready.

      There was a problem preparing your codespace, please try again.

      Latest commit

      Update changed AUR package link md2pdf-git

      Git stats

      Files

      Failed to load latest commit information.

      README.md

      md2pdf: A Python Markdown to PDF Converter

      Convert Markdown to PDF using markdown2 and wkhtmltopdf.

      Install the wkhtmltopdf package first

      sudo apt install wkhtmltopdf 
      sudo pip install wkhtmltopdf 

      And then install md2pdf to your Python environment:

      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: .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. 

      MIT licensed as found in the LICENSE file.

      Источник

      Convert Markdown to PDF in Python

      Markdown to PDF Conversion Python

      PDF allows sharing documents in a read-only format without compromising their style or layout. We can easily convert Markdown documents into PDF format before they are printed or shared. In this article, we will learn how to convert Markdown to PDF in Python.

      The following topics shall be covered in this article:

      What is Markdown#

      Markdown is a lightweight markup language. It enables us to create formatted text using a plain-text editor. Markdown is normally used to generate technical documentation. It can also be used to create websites, documents, notes, books, presentations, and email messages. Markdown files are saved with .md or .markdown file extension.

      Python Markdown to PDF Converter API#

      For converting Markdown documents to PDF format, we will be using the Aspose.Words for Python API. It is a feature-rich Python library to read and manipulate documents of the supported formats programmatically. Moreover, it allows converting Markdown and other formats to PDF format with high fidelity.

      Please install the API from PyPI using the following pip command in the console:

      Convert Markdown to PDF using Python#

      We can convert a Markdown document to PDF by following the steps given below:

      1. Load the Markdown document using the Document class.
      2. Convert Markdown document to PDF using the save() method.

      The following code sample shows how to convert a Markdown file to PDF in Python.

      Convert Markdown to PDF using Python.

      Python Markdown to PDF with a Particular Standard#

      We can also convert the Markdown document to a particular PDF standard such as PDF/A. We can specify the particular standard for the PDF document while converting Markdown to PDF by following the steps given below:

      1. Firstly, load the Markdown document using the Document class.
      2. Next, create an instance of the PdfSaveOptions class.
      3. After that, set the PDF standard using the compliance property.
      4. Finally, convert the Markdown document to PDF using the save() method.

      The following code sample shows how to convert Markdown to a particular standard PDF document.

      Convert Range of Pages from MD to PDF in Python#

      We can convert a range of pages from Markdown to PDF by following the steps given below:

      1. Firstly, load the Markdown document using the Document class.
      2. Next, create an instance of the PdfSaveOptions class.
      3. After that, set the start and end page number using the page_set property.
      4. Finally, convert the Markdown document to PDF using the save() method.

      The following code sample shows how to convert a range of pages from Markdown to PDF in Python.

      Get a Free API License#

      You can get a free temporary license to try the library without evaluation limitations.

      Conclusion#

      In this article, we have learned how to convert Markdown files to PDF in Python. Moreover, we have seen different options to customize the Markdown to PDF conversion programmatically. You can learn more about Aspose.Words for Python using documentation. In case of any ambiguity, please feel free to contact us on our forum.

      See Also#

      Источник

Оцените статью