Merging Pdfs

hi i have a few thousand single paged pdf files in one folder and one single paged pdf(its file name is 2.pdf). I want to merge all the pdfs in the folder with the 2.pdf file. at the end should have all the pdfs in the folder with 2pages and the second page being the contents of 2.pdf. Please assist on this. thanks


So for all PDF files of the current directory, except 2.pdf , we merge x.pdf with 2.pdf as a new file called new-x.pdf . So we can use the command given in merge / convert multiple pdf files into one pdf to do this:

cover="2.pdf";
outputDir="output-pdfs/";

mkdir "$outputDir";

for f in *.pdf; do
    [[ "$f" == "$cover" ]] && continue # skip the cover PDF
    pdfunite "$f" "$cover" output-pdfs/new-"$f".pdf;
done
链接地址: http://www.djcxy.com/p/46956.html

上一篇: 来自不同文件和使用pdftk的linux脚本变量

下一篇: 合并Pdfs