HomeUniDoc
...

Package render

Overview ▾

type ImageDevice

ImageDevice is used to render PDF pages to image targets.

type ImageDevice struct {

    // OutputWidth represents the width of the rendered images in pixels.
    // The heights of the output images are calculated based on the selected
    // width and the original height of each rendered page.
    OutputWidth int
    // contains filtered or unexported fields
}

func NewImageDevice

func NewImageDevice() *ImageDevice

NewImageDevice returns a new image device.

func (*ImageDevice) Render

func (d *ImageDevice) Render(page *model.PdfPage) (image.Image, error)

Render converts the specified PDF page into an image, flattens annotations by default and returns the result.

func (*ImageDevice) RenderToPath

func (d *ImageDevice) RenderToPath(page *model.PdfPage, outputPath string) error

RenderToPath converts the specified PDF page into an image and saves the result at the specified location.

func (*ImageDevice) RenderWithOpts

func (d *ImageDevice) RenderWithOpts(page *model.PdfPage, skipFlattening bool) (image.Image, error)

RenderWithOpts converts the specified PDF page into an image, optionally flattens annotations and returns the result.

type PdfShadingType

PdfShadingType defines PDF shading types. Source: PDF32000_2008.pdf. Chapter 8.7.4.5

type PdfShadingType int64
const (
    ShadingTypeFunctionBased PdfShadingType = 1
    ShadingTypeAxial         PdfShadingType = 2
    ShadingTypeRadial        PdfShadingType = 3
    ShadingTypeFreeForm      PdfShadingType = 4
    ShadingTypeLatticeForm   PdfShadingType = 5
    ShadingTypeCoons         PdfShadingType = 6
    ShadingTypeTensorProduct PdfShadingType = 7
)

Subdirectories

Name Synopsis
..