pdf

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pdf provides an pdf bubble which can render pdf files as strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadPdf

func ReadPdf(name string) (string, error)

ReadPdf reads a PDF file given a name.

Types

type Model

type Model struct {
	Viewport    viewport.Model
	BorderColor lipgloss.AdaptiveColor
	Active      bool
	Borderless  bool
	FileName    string
}

Model represents the properties of a pdf bubble.

func New

func New(active, borderless bool, borderColor lipgloss.AdaptiveColor) Model

New creates a new instance of a PDF.

func (*Model) GotoTop

func (m *Model) GotoTop()

GotoTop jumps to the top of the viewport.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the PDF bubble.

func (*Model) SetBorderColor

func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)

SetBorderColor sets the current color of the border.

func (*Model) SetBorderless

func (m *Model) SetBorderless(borderless bool)

SetBorderless sets weather or not to show the border.

func (*Model) SetFileName

func (m *Model) SetFileName(filename string) tea.Cmd

SetFileName sets current file to render, this returns a cmd which will render the pdf.

func (*Model) SetIsActive

func (m *Model) SetIsActive(active bool)

SetIsActive sets if the bubble is currently active.

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

SetSize sets the size of the bubble.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles updating the UI of a code bubble.

func (Model) View

func (m Model) View() string

View returns a string representation of the markdown bubble.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL