pdf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFiles

func DeleteFiles(paths []string) error

Deletes files at the given paths

func Exists

func Exists(path string) (bool, error)

Exists returns whether the given file or directory exists

func FlattenPDF

func FlattenPDF(opts FlattenPDFOptions) ([]string, error)

FlattenPDF takes a slice of PDF file paths, validates them and flattens them to make them read-only. It returns the paths of the flattened PDF files.

func ImagesToPdf

func ImagesToPdf(imagePaths []string, outputPath string, pdfName string, pageSize string) (flattenedPath string, err error)

Check pdfcpu for valid pageSize strings

func PdfToImages

func PdfToImages(filePath string, tempDir string, opts FlattenPDFOptions) (imagePaths []string, err error)

Renders a pdf file into images

func ValidatePDFPaths

func ValidatePDFPaths(paths []string) error

ValidatePDFPaths validates the given paths to ensure they are valid PDF paths

Types

type FlattenPDFOptions

type FlattenPDFOptions struct {
	InputFiles         []string // list of pdf files to process
	OutputDir          string   // optional directory to save processed files.
	ImageDensity       int      // recommended: 200-300 (low) or 600 (medium) or 1200 (high)
	ImageQuality       int      // recommended: 80-100, only for jpg encoding
	RequiresFlatSuffix bool     // whether to add _flat suffix to the output file name
}

Jump to

Keyboard shortcuts

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