Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Mar 26, 2024. It is now read-only.
/kMD2PDFPublic archive

Markdown to PDF conversion library written in Kotlin

License

NotificationsYou must be signed in to change notification settings

omnius-project/kMD2PDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusGitHub licenseWebsite shields.ioMaven Central

Simple and highly customizable markdown to PDF conversion library

Note: Version 0.2.x has been released! Check out thechangelog to see what's new!

Jump To

  1. Installation Guide
  2. Quick Start Guide
  3. Previews

Installation Guide

The repository is hosted onMaven Central. You canadd it to your project using the following code based on your build tool:

Maven

<dependency>  <groupId>com.github.woojiahao</groupId>  <artifactId>kMD2PDF</artifactId>  <version>0.2.2</version></dependency>

Gradle

implementation'com.github.woojiahao:kMD2PDF:0.2.2'

If you encounter errors with loading the library, visit the troubleshooting guidehere.

Quick Start Guide

All examples are taken from theexamples repository.

val document   get()=MarkdownDocument("resources/markdown-all-in-one.md")

Default styling

Examplehere.

funmain() {val converter= markdownConverter {    document(document)  }  converter.convert()}

Specifying PDF location

Examplehere.

funmain() {val converter= markdownConverter {    document(document)    targetLocation("${System.getProperty("user.home")}/Desktop/exported.pdf")  }  converter.convert()}

Conversion success

Examplehere.

funmain() {val converter= markdownConverter {    document(document)  }val conversionResult= converter.convert()  conversionResult.success {if (Desktop.isDesktopSupported())Desktop.getDesktop().open(it)  }}

Conversion failure

Examplehere.

funmain() {val converter= markdownConverter {    document(document)  }val conversionStatus= converter.convert()  conversionStatus.failure {if (itisFileNotFoundException)println("File is currently already open")  }}

Custom styling using style DSL

Examplehere.

More on this subject can be found on the documentation sitehere.

funmain() {val converter= markdownConverter {    document(document)    settings {      fontSize=16.0.px      font=FontFamily("Roboto","Lato")      monospaceFont=FontFamily("Fira Code")    }    style {      p {        textColor= c("455A64")      }      ul {        listStyleType=SQUARE      }      selector("tr:nth-child(even)") {"background-color" to"#f2f2f2"      }    }  }  converter.convert()}

Exporting to HTML

Examplehere.

More on the subjecthere.

funmain() {val converter= markdownConverter {    document(document)    conversionTarget(MarkdownConverter.ConversionTarget.HTML)  }  converter.convert()}

Previews

Sample document

Dark theme

Auto-generated table of contents


[8]ページ先頭

©2009-2025 Movatter.jp