Documentation
¶
Overview ¶
Package pdf provides operations for PDF file manipulation including merging, splitting, encryption, text extraction, watermarking, and validation.
Index ¶
- func AddImageWatermark(input, output, imagePath string, pages []int, password string) error
- func AddWatermark(input, output, text string, pages []int, password string) error
- func Compress(input, output, password string) error
- func ConvertToPDFA(input, output, _, password string) error
- func CreatePDFFromImages(images []string, output, pageSize string) error
- func Decrypt(input, output, password string) error
- func Encrypt(input, output, userPW, ownerPW string) error
- func ExtractImages(input, outputDir string, pages []int, password string) error
- func ExtractPages(input, output string, pages []int, password string) error
- func ExtractText(input string, pages []int, password string) (string, error)
- func ExtractTextWithProgress(input string, pages []int, password string, showProgress bool) (string, error)
- func Merge(inputs []string, output, password string) error
- func MergeWithProgress(inputs []string, output, password string, showProgress bool) error
- func NewConfig(password string) *model.Configuration
- func PageCount(path, password string) (int, error)
- func Rotate(input, output string, angle int, pages []int, password string) error
- func SetMetadata(input, output string, meta *Metadata, password string) error
- func Split(input, outputDir, password string) error
- func SplitByPageCount(input, outputDir string, pageCount int, password string) error
- func SplitWithProgress(input, outputDir string, pageCount int, password string, showProgress bool) error
- func Validate(path, password string) error
- func ValidateToBuffer(data []byte) error
- type Info
- type Metadata
- type PDFAValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddImageWatermark ¶
AddImageWatermark adds an image watermark to a PDF
func AddWatermark ¶
AddWatermark adds a text watermark to a PDF
func ConvertToPDFA ¶ added in v1.3.1
ConvertToPDFA attempts to convert a PDF to PDF/A format. Note: pdfcpu has limited PDF/A conversion capabilities. This performs optimization which may help with some PDF/A requirements, but full conversion requires specialized tools like Ghostscript or Adobe Acrobat.
func CreatePDFFromImages ¶ added in v1.3.2
CreatePDFFromImages creates a PDF from multiple image files. Each image becomes one page in the output PDF.
func ExtractImages ¶
ExtractImages extracts images from a PDF
func ExtractPages ¶
ExtractPages extracts specific pages from a PDF into a new file
func ExtractText ¶
ExtractText extracts text content from a PDF
func ExtractTextWithProgress ¶ added in v1.3.1
func ExtractTextWithProgress(input string, pages []int, password string, showProgress bool) (string, error)
ExtractTextWithProgress extracts text content from a PDF with optional progress bar
func MergeWithProgress ¶ added in v1.3.1
MergeWithProgress combines multiple PDF files into one with optional progress bar
func NewConfig ¶ added in v1.4.0
func NewConfig(password string) *model.Configuration
NewConfig creates a pdfcpu configuration with optional password.
func SetMetadata ¶
SetMetadata sets metadata on a PDF
func SplitByPageCount ¶
SplitByPageCount splits a PDF into chunks of n pages
func SplitWithProgress ¶ added in v1.3.1
func SplitWithProgress(input, outputDir string, pageCount int, password string, showProgress bool) error
SplitWithProgress splits a PDF with optional progress bar
func ValidateToBuffer ¶
ValidateToBuffer validates a PDF from bytes
Types ¶
type Info ¶
type Info struct {
FilePath string
FileSize int64
Pages int
Version string
Title string
Author string
Subject string
Keywords string
Creator string
Producer string
CreatedDate string
ModDate string
Encrypted bool
}
Info holds PDF document information
type Metadata ¶
type Metadata struct {
Title string
Author string
Subject string
Keywords string
Creator string
Producer string
CreatedDate string
ModDate string
}
Metadata holds PDF metadata fields
func GetMetadata ¶
GetMetadata returns the metadata of a PDF
type PDFAValidationResult ¶ added in v1.3.1
PDFAValidationResult contains the result of PDF/A validation.
func ValidatePDFA ¶ added in v1.3.1
func ValidatePDFA(path, level, password string) (*PDFAValidationResult, error)
ValidatePDFA validates a PDF for PDF/A compliance. Note: pdfcpu provides basic validation; full PDF/A validation requires specialized tools.