ps

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ps opens PostScript and EPS files.

A document gives its pages: an interpreter of PostScript Level 2, with the parts of Level 3 that files use, runs the program and draws each page onto the display list (D29). A PostScript file gives one page for each showpage. An EPS file gives one page, the size of its bounding box.

A document also gives the previews that an EPS file carries (D11): the TIFF image of the binary header of a DOS EPS file, and the bitmap of an EPSI file, between %%BeginPreview and %%EndPreview. A document also says its title, its author, its creator and its date, from its DSC comments.

Index

Constants

This section is empty.

Variables

View Source
var Format = ivy.Format{
	Name: "ps",
	Mimes: []string{
		"application/postscript",
		"application/eps",
		"application/x-eps",
		"image/eps",
		"image/x-eps",
	},
	Exts: []string{"ps", "eps", "epsi", "epsf", "ept"},
	Open: func(ctx context.Context, src ivy.Source, cfg ivy.Config) (ivy.Document, error) {
		return Open(ctx, src, WithConfig(cfg))
	},
}

Format describes the package for the registry of a program.

Functions

This section is empty.

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document is an open PostScript or EPS file.

func Open

func Open(ctx context.Context, src ivy.Source, opts ...Option) (*Document, error)

Open opens a PostScript or an EPS file. It returns an error that wraps ivy.ErrFormat if src is neither.

func (*Document) Close

func (d *Document) Close() error

Close satisfies the ivy.Document interface.

func (*Document) Describe

func (d *Document) Describe(context.Context) (ivy.Info, error)

Describe satisfies the ivy.Describer interface. It gives the title, the author, the creator and the date of the DSC comments.

func (*Document) Page

func (d *Document) Page(ctx context.Context, n int) (ivy.Page, error)

Page satisfies the ivy.Pager interface.

func (*Document) PageCount

func (d *Document) PageCount(ctx context.Context) (int, error)

PageCount satisfies the ivy.Pager interface. It runs the whole program on its first call.

func (*Document) Previews

func (d *Document) Previews(context.Context) iter.Seq2[ivy.Preview, error]

Previews satisfies the ivy.Previewer interface. It lists the TIFF preview and the EPSI preview, where the file holds them.

type Option

type Option func(*options)

Option is an option of Open.

func WithConfig

func WithConfig(cfg ivy.Config) Option

WithConfig sets the configuration that every format shares.

Directories

Path Synopsis
internal
graphics
Package graphics is the imaging model of PostScript (D29): the graphics state, the paths, the painting, the colors, the images, the patterns, the shadings, the fonts and the pages.
Package graphics is the imaging model of PostScript (D29): the graphics state, the paths, the painting, the colors, the images, the patterns, the shadings, the fonts and the pages.
interp
Package interp is the language of PostScript: the scanner, the objects, the stacks, the virtual memory, and the operators that do not draw (D29).
Package interp is the language of PostScript: the scanner, the objects, the stacks, the virtual memory, and the operators that do not draw (D29).

Jump to

Keyboard shortcuts

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