Skip to content

Page Layout

huzpsb edited this page Nov 8, 2026 · 2 revisions

Page Layout

Control how viewers lay out pages when the document is opened.

Values:

Value Meaning
SinglePage one page at a time (default)
OneColumn continuous column
TwoColumnLeft two columns, odd pages left
TwoColumnRight two columns, odd pages right
TwoPageLeft two pages at a time, odd left
TwoPageRight two pages at a time, odd right

Command line

hspdf pagelayout list in.pdf
hspdf pagelayout set in.pdf TwoPageLeft
hspdf pagelayout reset in.pdf
cat ebook.pdf | hspdf pagelayout set - TwoPageLeft - > ebook-spreads.pdf

Go API

package main

import (
	"context"

	"github.com/huzpsb/hspdf/pkg/api"
	"github.com/huzpsb/hspdf/pkg/pdfcpu/model"
)

func main() {
	ctx := context.Background()
	conf := model.NewDefaultConfiguration()

	err := api.SetPageLayoutFile(ctx, "in.pdf", "out.pdf", model.PageLayoutTwoPageLeft, conf)
	if err != nil {
		panic(err)
	}

	ss, _ := api.ListPageLayoutFile(ctx, "in.pdf", conf)
	_ = ss

	_ = api.ResetPageLayoutFile(ctx, "in.pdf", "out2.pdf", conf)
}

Related: Page Mode, Viewer Preferences.

Clone this wiki locally