Documentation
¶
Overview ¶
Package pdftk implements gotenberg.PdfEngine using the PDFtk command-line tool. Merges and splits PDF files.
Requires the PDFTK_BIN_PATH environment variable.
Index ¶
- type PdfTk
- func (engine *PdfTk) Convert(ctx context.Context, logger *slog.Logger, formats gotenberg.PdfFormats, ...) error
- func (engine *PdfTk) Debug() map[string]any
- func (engine *PdfTk) Descriptor() gotenberg.ModuleDescriptor
- func (engine *PdfTk) EmbedFiles(ctx context.Context, logger *slog.Logger, filePaths []string, inputPath string) error
- func (engine *PdfTk) EmbedFilesMetadata(ctx context.Context, logger *slog.Logger, ...) error
- func (engine *PdfTk) Encrypt(ctx context.Context, logger *slog.Logger, ...) error
- func (engine *PdfTk) Flatten(ctx context.Context, logger *slog.Logger, inputPath string) error
- func (engine *PdfTk) Merge(ctx context.Context, logger *slog.Logger, inputPaths []string, ...) error
- func (engine *PdfTk) PageCount(ctx context.Context, logger *slog.Logger, inputPath string) (int, error)
- func (engine *PdfTk) Provision(ctx *gotenberg.Context) error
- func (engine *PdfTk) ReadBookmarks(ctx context.Context, logger *slog.Logger, inputPath string) ([]gotenberg.Bookmark, error)
- func (engine *PdfTk) ReadMetadata(ctx context.Context, logger *slog.Logger, inputPath string) (map[string]any, error)
- func (engine *PdfTk) Rotate(ctx context.Context, logger *slog.Logger, inputPath string, angle int, ...) error
- func (engine *PdfTk) Split(ctx context.Context, logger *slog.Logger, mode gotenberg.SplitMode, ...) ([]string, error)
- func (engine *PdfTk) Stamp(ctx context.Context, logger *slog.Logger, inputPath string, ...) error
- func (engine *PdfTk) Validate() error
- func (engine *PdfTk) Watermark(ctx context.Context, logger *slog.Logger, inputPath string, ...) error
- func (engine *PdfTk) WriteBookmarks(ctx context.Context, logger *slog.Logger, inputPath string, ...) error
- func (engine *PdfTk) WriteMetadata(ctx context.Context, logger *slog.Logger, metadata map[string]any, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PdfTk ¶
type PdfTk struct {
// contains filtered or unexported fields
}
PdfTk abstracts the CLI tool PDFtk and implements the gotenberg.PdfEngine interface.
func (*PdfTk) Convert ¶
func (engine *PdfTk) Convert(ctx context.Context, logger *slog.Logger, formats gotenberg.PdfFormats, inputPath, outputPath string) error
Convert is not available in this implementation.
func (*PdfTk) Descriptor ¶
func (engine *PdfTk) Descriptor() gotenberg.ModuleDescriptor
Descriptor returns a PdfTk's module descriptor.
func (*PdfTk) EmbedFiles ¶ added in v8.25.0
func (engine *PdfTk) EmbedFiles(ctx context.Context, logger *slog.Logger, filePaths []string, inputPath string) error
EmbedFiles is not available in this implementation.
func (*PdfTk) EmbedFilesMetadata ¶ added in v8.31.0
func (engine *PdfTk) EmbedFilesMetadata(ctx context.Context, logger *slog.Logger, metadata map[string]map[string]string, inputPath string) error
EmbedFilesMetadata is not available in this implementation.
func (*PdfTk) Encrypt ¶ added in v8.23.1
func (engine *PdfTk) Encrypt(ctx context.Context, logger *slog.Logger, inputPath, userPassword, ownerPassword string) error
Encrypt adds password protection to a PDF file using PDFtk.
func (*PdfTk) Merge ¶
func (engine *PdfTk) Merge(ctx context.Context, logger *slog.Logger, inputPaths []string, outputPath string) error
Merge combines multiple PDFs into a single PDF.
func (*PdfTk) PageCount ¶ added in v8.28.0
func (engine *PdfTk) PageCount(ctx context.Context, logger *slog.Logger, inputPath string) (int, error)
PageCount is not available in this implementation.
func (*PdfTk) ReadBookmarks ¶ added in v8.28.0
func (engine *PdfTk) ReadBookmarks(ctx context.Context, logger *slog.Logger, inputPath string) ([]gotenberg.Bookmark, error)
ReadBookmarks is not available in this implementation.
func (*PdfTk) ReadMetadata ¶ added in v8.3.0
func (engine *PdfTk) ReadMetadata(ctx context.Context, logger *slog.Logger, inputPath string) (map[string]any, error)
ReadMetadata is not available in this implementation.
func (*PdfTk) Rotate ¶ added in v8.28.0
func (engine *PdfTk) Rotate(ctx context.Context, logger *slog.Logger, inputPath string, angle int, pages string) error
Rotate rotates all pages of a PDF file by the given angle using PDFtk. Page-specific rotation is not supported; if pages is non-empty, ErrPdfEngineMethodNotSupported is returned.
func (*PdfTk) Split ¶ added in v8.15.0
func (engine *PdfTk) Split(ctx context.Context, logger *slog.Logger, mode gotenberg.SplitMode, inputPath, outputDirPath string) ([]string, error)
Split splits a given PDF file.
func (*PdfTk) Stamp ¶ added in v8.28.0
func (engine *PdfTk) Stamp(ctx context.Context, logger *slog.Logger, inputPath string, stamp gotenberg.Stamp) error
Stamp applies a stamp (on top of page content) to a PDF file using PDFtk. Only PDF source is supported.
func (*PdfTk) Watermark ¶ added in v8.28.0
func (engine *PdfTk) Watermark(ctx context.Context, logger *slog.Logger, inputPath string, stamp gotenberg.Stamp) error
Watermark applies a watermark (behind page content) to a PDF file using PDFtk. Only PDF source is supported.