Documentation ¶
Index ¶
- Variables
- func ExtractImagesFile(inFile, outDir string, selectedPages []string, conf *model.Configuration) error
- func MergeAppendFile(inFiles []string, outFile string, dividerPage bool, conf *model.Configuration) error
- func MergeCreateFile(inFiles []string, outFile string, dividerPage bool, conf *model.Configuration) error
- func SplitByPageNrFile(inFile, outDir string, pageNrs []int, conf *model.Configuration) error
- func SplitFile(inFile, outDir string, span int, conf *model.Configuration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Optimize func(rs io.ReadSeeker, w io.Writer, conf *model.Configuration) error = api.Optimize OptimizeContext func(ctx *model.Context) error = api.OptimizeContext OptimizeFile func(inFile, outFile string, conf *model.Configuration) error = api.OptimizeFile )
View Source
var ( // Split 推荐使用 SplitFile,是对本函数的封装. Split func(rs io.ReadSeeker, outDir, fileName string, span int, conf *model.Configuration) error = api.Split // SplitByPageNr 推荐使用 SplitByPageNrFile,是对本函数的封装. SplitByPageNr func(rs io.ReadSeeker, outDir, fileName string, pageNrs []int, conf *model.Configuration) error = api.SplitByPageNr )
Functions ¶
func ExtractImagesFile ¶ added in v3.0.106
func ExtractImagesFile(inFile, outDir string, selectedPages []string, conf *model.Configuration) error
ExtractImagesFile 导出pdf文件中的图片.
!!!: pdfcpu 库仅支持提取原始嵌入的图像(如果图像经过压缩或编码,则可能无法提取).
@param outDir 输出目录 @param selectedPages 可以为nil,即该pdf文件的所有页
e.g. 第1页和第2页 []string{"1", "2"}
@param conf 可以为nil
func MergeAppendFile ¶
func MergeAppendFile(inFiles []string, outFile string, dividerPage bool, conf *model.Configuration) error
MergeAppendFile 合并pdf(如果outFile已经存在且是个文件,会"在最后追加"内容).
@param inFiles 要合并的pdf文件(复数) @param outFile 合并后的pdf文件 @param dividerPage true: 在每个pdf文件之间插入一个空白页 @param conf 可以为nil,将使用默认值
func MergeCreateFile ¶
func MergeCreateFile(inFiles []string, outFile string, dividerPage bool, conf *model.Configuration) error
MergeCreateFile 合并pdf(如果outFile已经存在且是个文件,会"覆盖"内容).
func SplitByPageNrFile ¶ added in v3.0.106
func SplitByPageNrFile(inFile, outDir string, pageNrs []int, conf *model.Configuration) error
SplitByPageNrFile
@param pageNrs 拆分的页数s(其中元素应该>=2) @param conf 可以为nil
e.g. 34页的pdf文件,传参pageNrs为[]int{2},结果: 拆分为2个pdf文件,第一个pdf文件有 1 页,第二个pdf文件有 33页
inputPDF := "/Users/richelieu/Desktop/34页(1).pdf" outputDir := "_tmp" if err := pdfKit.SplitByPageNrFile(inputPDF, outputDir, []int{2}, nil); err != nil { panic(err) }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.