【问题标题】:Merge pdf files by timestamp on the file按文件上的时间戳合并pdf文件
【发布时间】:2017-02-16 07:47:44
【问题描述】:

我有一个计划任务,它生成 pdf 文件,其中 employee_id 作为 pdf 的名称。每天都会生成它们,这些文件将根据创建时间合并到一个文件中。

我已经检查了 .txt 文件,同样是通过使用来实现的

for /F "tokens=*" %%i in ('dir /b /OD *.txt') do type "%%i" >> combine.txt

但我无法为 pdf 文件获得此功能。 执行此操作的任何方式或脚本都非常有帮助。提前致谢。

我也用过pdftk

pdftk *pdf cat output.pdf

但这会生成一个随机顺序的 pdf,而不是按创建时间。

【问题讨论】:

  • 我用的是windows机器

标签: batch-file pdf merge pdftk


【解决方案1】:

只要 pdf 的数量和长度不超过命令行长度,这应该可以工作:

@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
Set "EmpPdf="
for /F "tokens=*" %%i in (
  'dir /b /OD *.pdf ^|find /v "combine.pdf'
) do Set "EmpPDF=!EmpPDF! %%i"
pdftk %EmpPDF% cat output combine.pdf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-01
    • 2011-09-27
    • 2011-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-20
    相关资源
    最近更新 更多