今年我想出了一种使用pdftk' and
make' 将 PDF 文件合并在一起的方法。这是生成文件的最新和最完善的迭代。请注意,这是针对特定文件的,但在我工作时,一些名称和目录已更改。
我发现这很好用,但我的问题是有没有其他人使用过这个,你对这种方法有什么问题吗?
这是一个示例生成文件。
# Makefile to create Build Methods Report, merging all the input source files
# into one big PDF.
INFILE := Reusable_Component_Library_-_Evaulation_of_Build_Methods.odt
OUTFILE := Report.pdf
# PDF Files to assemble.
HANDLES := A B C D E F G H I J
FILE_A := Reusable_Component_Library_-_Evaulation_of_Build_Methods.pdf
FILE_B := Makefile.recurse.pdf
FILE_C := Makefile.recurse_module.pdf
FILE_D := Makefile.nonrecurse.pdf
FILE_E := user.mak.pdf
FILE_F := Makefile.semirecurse.pdf
FILE_G := project.mk.pdf
FILE_H := targets.mk.pdf
FILE_I := module.mk.pdf
FILE_J := modcomp.mk.pdf
# Page Merge Ranges.
FILE_MERGE_RANGES := A1-13 B A14 C A15 D A16 E A17 F A18 G A19 H A20 I A21 J
# Computed file lists and file dependency lists.
FILES := $(foreach a,$(HANDLES),$(FILE_$(a)))
FILE_HANDLES := $(foreach a,$(HANDLES),$(a)=$(FILE_$(a)))
# PDF Assembler
PDFTK := pdftk
.PHONY: all
all: $(OUTFILE)
#File A
Reusable_Component_Library_-_Evaulation_of_Build_Methods.pdf: Reusable_Component_Library_-_Evaulation_of_Build_Methods.odt
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File B
Makefile.recurse.pdf: ~/workspace/ncu_procedural_approach/Makefile.recurse
$(error File $@ does not exist or is older than prerequisite(s) $^)
Makefile.recurse_module.pdf: ~/workspace/ncu_procedural_approach/application/ate/Makefile.recurse
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File C
Makefile.nonrecurse.pdf: ~/workspace/ncu_procedural_approach/Makefile.nonrecurse
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File D
Makefile.semirecurse.pdf: ~/workspace/ncu_procedural_approach/Makefile.semirecurse
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File E
modcomp.mk.pdf: ~/workspace/ncu_procedural_approach/modcomp.mk
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File F
project.mk.pdf: ~/workspace/ncu_procedural_approach/project.mk
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File G
user.mak.pdf: ~/workspace/ncu_procedural_approach/user.mak
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File H
targets.mk.pdf: ~/workspace/ncu_procedural_approach/targets.mk
$(error File $@ does not exist or is older than prerequisite(s) $^)
# File I
module.mk.pdf: ~/workspace/ncu_procedural_approach/application/ate/module.mk
$(error File $@ does not exist or is older than prerequisite(s) $^)
$(OUTFILE): $(FILES) $(MAKEFILE_LIST)
$(PDFTK) $(FILE_HANDLES) cat $(FILE_MERGE_RANGES) output $(OUTFILE)
##### END OF FILE #####
如您所见,该文档有大量附录。$( 错误字符串在那里,因为我没有使用命令行来生成 PDF。
提前致谢