Skip to content

Installation

huzpsb edited this page Nov 8, 2026 · 2 revisions

Installation

hspdf is a single static binary built from pure Go. No runtime dependencies, no cgo, no system libraries.

From source

git clone https://github.com/huzpsb/hspdf.git
cd hspdf
go mod vendor   # vendor/ is not committed; regenerate before building
go build ./cmd/hspdf

The resulting hspdf (or hspdf.exe) is fully self-contained: fonts, core PDF resources and the embedded OCR models are compiled in. Cross-compile anywhere Go runs:

GOOS=linux   GOARCH=amd64 go build -o hspdf_linux_amd64       ./cmd/hspdf
GOOS=darwin  GOARCH=arm64 go build -o hspdf_darwin_arm64      ./cmd/hspdf
GOOS=windows GOARCH=amd64 go build -o hspdf_windows_amd64.exe ./cmd/hspdf

Offline build environments need a populated module cache before go mod vendor succeeds.

Using it as a Go library

go get github.com/huzpsb/hspdf
import (
	"github.com/huzpsb/hspdf/pkg/api"
	"github.com/huzpsb/hspdf/pkg/pdfcpu/model"
)

See Go API for the package layout and coding patterns.

Shell completion

hspdf completion bash       # bash
hspdf completion zsh        # zsh
hspdf completion fish       # fish
hspdf completion powershell # PowerShell

Example (bash, persistent):

hspdf completion bash > /etc/bash_completion.d/hspdf

Example (PowerShell, current session):

hspdf completion powershell | Out-String | Invoke-Expression

First run

Most commands work out of the box with zero configuration. On first use hspdf may create a small configuration directory (config.yml, user fonts, trusted certificates) — see Configuration to control, relocate or disable that.

hspdf validate in.pdf

To run fully stateless without touching the file system:

hspdf --conf disable validate in.pdf

Verify your build

hspdf version
hspdf paper          # lists supported paper sizes
hspdf fonts list     # lists usable fonts incl. the 14 core fonts

Clone this wiki locally