Update tech_docs/pdf_creation.md
This commit is contained in:
@@ -1,3 +1,116 @@
|
||||
In addition to Pandoc and LaTeX, there are several other CLI tools that can help you create, convert, and customize PDFs with similar capabilities. Here are some notable alternatives:
|
||||
|
||||
### 1. **wkhtmltopdf**
|
||||
`wkhtmltopdf` is a command-line tool that converts HTML and CSS documents to PDF using the Webkit rendering engine. It’s useful for generating PDFs from web pages or HTML content.
|
||||
|
||||
**Installation:**
|
||||
```sh
|
||||
sudo apt-get install wkhtmltopdf
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
wkhtmltopdf input.html output.pdf
|
||||
```
|
||||
|
||||
### 2. **Prince**
|
||||
Prince is a powerful tool for converting HTML and CSS to PDF with a high degree of accuracy and customization options. It’s particularly useful for producing print-quality documents.
|
||||
|
||||
**Installation and Usage:**
|
||||
You need to download and install Prince from its [official website](https://www.princexml.com/), as it’s not typically available via package managers.
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
prince input.html -o output.pdf
|
||||
```
|
||||
|
||||
### 3. **WeasyPrint**
|
||||
WeasyPrint is a visual rendering engine for HTML and CSS that can output to PDF. It’s written in Python and can be installed via pip.
|
||||
|
||||
**Installation:**
|
||||
```sh
|
||||
pip install weasyprint
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
weasyprint input.html output.pdf
|
||||
```
|
||||
|
||||
### 4. **TeXShop**
|
||||
TeXShop is a TeX editor and previewer for macOS, useful for creating LaTeX documents. While it’s more of an editor than a CLI tool, it’s helpful for LaTeX-based workflows.
|
||||
|
||||
**Installation:**
|
||||
Download from the [official website](http://pages.uoregon.edu/koch/texshop/texshop.html).
|
||||
|
||||
### 5. **PDFtk (PDF Toolkit)**
|
||||
PDFtk is a versatile tool for manipulating PDF documents. It can merge, split, encrypt, decrypt, and watermark PDFs.
|
||||
|
||||
**Installation:**
|
||||
```sh
|
||||
sudo apt-get install pdftk
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
pdftk input1.pdf input2.pdf cat output output.pdf
|
||||
```
|
||||
|
||||
### 6. **Ghostscript**
|
||||
Ghostscript is an interpreter for PostScript and PDF files. It’s very powerful for converting and manipulating PDF files.
|
||||
|
||||
**Installation:**
|
||||
```sh
|
||||
sudo apt-get install ghostscript
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input.ps
|
||||
```
|
||||
|
||||
### 7. **Apache FOP (Formatting Objects Processor)**
|
||||
Apache FOP is a print formatter driven by XSL formatting objects (XSL-FO). It can convert XML data to PDF and other formats.
|
||||
|
||||
**Installation and Usage:**
|
||||
Download from the [official website](https://xmlgraphics.apache.org/fop/).
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
fop input.fo output.pdf
|
||||
```
|
||||
|
||||
### 8. **PDFjam**
|
||||
PDFjam is a small collection of shell scripts that provide a simple interface to some of the functionality of the `pdfpages` package for PDF document merging, splitting, and more.
|
||||
|
||||
**Installation:**
|
||||
```sh
|
||||
sudo apt-get install pdfjam
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```sh
|
||||
pdfjam input.pdf --outfile output.pdf
|
||||
```
|
||||
|
||||
### Comparison of Tools
|
||||
|
||||
| Tool | Input Formats | Output Formats | Key Features |
|
||||
|-----------------|------------------------|----------------------|---------------------------------------------|
|
||||
| Pandoc | Markdown, HTML, LaTeX | PDF, DOCX, HTML, etc | Versatile document converter |
|
||||
| wkhtmltopdf | HTML, CSS | PDF | HTML to PDF conversion using Webkit engine |
|
||||
| Prince | HTML, CSS | PDF | High-quality PDF rendering from HTML/CSS |
|
||||
| WeasyPrint | HTML, CSS | PDF | Python-based HTML to PDF conversion |
|
||||
| TeXShop | LaTeX | PDF | LaTeX editor for macOS |
|
||||
| PDFtk | PDF | PDF | PDF manipulation (merge, split, etc.) |
|
||||
| Ghostscript | PostScript, PDF | PDF | Powerful PDF processing |
|
||||
| Apache FOP | XML (XSL-FO) | PDF, PS | XML to PDF conversion using XSL-FO |
|
||||
| PDFjam | PDF | PDF | Simple PDF manipulation |
|
||||
|
||||
Each tool has its strengths and use cases. Depending on your specific needs, you may choose one or more of these tools to create, convert, and manipulate PDFs effectively.
|
||||
|
||||
---
|
||||
|
||||
Certainly! Here’s a more detailed guide to creating a visually appealing PDF using CLI tools on Linux, with a focus on using Markdown, LaTeX, and Pandoc.
|
||||
|
||||
### Step-by-Step Guide to Creating a Visually Appealing PDF
|
||||
|
||||
Reference in New Issue
Block a user