Skip to content

gelaechter/pdf-kitten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

PDF-Kitten is an extension for the kitty terminal 🐱 that allows you to export uniform PDFs of your terminal output. I made it specifically to embed colored terminals with selectable text in LaTeX

Here is what one of these PDFs looks like (though this is just an image):

PDF exported by PDF-Kitten

You can view the demo in my accompanying blog post. It also goes a little more into detail about the why and how.

Installation

The installation process consists of three steps

  1. Cloning this repository

     # Change directory to your kitty config dir 
     cd ~/.config/kitty
     # Clone this repository
     git clone https://github.com/gelaechter/pdf-kitten
  2. Installing the python dependencies

    cd pdf-kitten
    # This installs the depencies into a vendor directory
    ./install_python_deps.sh

    Always blindly trust shell-scripts you receive from strangers

  3. Installing weasyprint (system dependencies)

    This script uses weasyprint to produce the PDF. Installing it on your system is the easiest way to ensure that its dependencies are also installed (mainly pango).

    The installation is explained here.

Usage

To use pdf-kitten you have to bind it to a key in your kitty config inside your kitty config directory (~/.config/kitty/kitty.conf).

# Converts only selected text
map f11 kitten pdf-kitten/pdf-kitten.py
# Converts what's currently visible
map ctrl+f11 kitten pdf-kitten/pdf-kitten.py screen
# Converts visible and scrollback
map ctrl+shift+f11 kitten pdf-kitten/pdf-kitten.py all

This way you can use the key combinations as follows:

Key Function
F11 print the current selection
Ctlr + F11 print everything on screen
Ctlr + Shift + F11 print the screen and scrollback

The keyword that I am passing to pdf-kitten (screen or all) is the extent of the output. You can find an explanation here. The default is selection.

Configuration

The exported PDF mimics your kitty configuration. This means colors and font are what you configured in your kitty.conf.

The editor used to make changes to the terminal is configured through your $EDITOR env-variable or the kitty editor configuration.
If you need to edit large portions of your terminal I can recommend setting VSCode as your editor (editor code --wait) and installing the ANSI Colors extension. It applies the highlighting set through the ANSI codes and lets you preview your changes.

About

PDF-Kitten is an extension for the kitty terminal 🐱 that allows you to export uniform PDFs of your terminal output. I made it specifically to embed colored terminals with selectable text in LaTeX

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors