Skip to content

Page Layout

huzpsb edited this page Oct 25, 2026 · 1 revision

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

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

Go API

package main

import (
	"context"

	"github.com/huzpsb/pdfcpu2/pkg/api"
	"github.com/huzpsb/pdfcpu2/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