-2

is there a way to filter out all pds in a folder that have more than 30 pages like qpdf --pages *.pdf and when a documant have more than 30 pages, then extract only the first and last page and generate a new pdf with the first and last site of bevore created pdfs? thx

4

1 回答 1

0

根据手册--show-npages用于计算页数,应该只输出数字。使用for /f循环将其捕获到变量中。换一个for来处理每个 PDF:

@echo off
for %%F in (*.pdf) do (
  for /f %%A in ('qpdf --show-npages "%%f"`) do (
    if %%A gtr 30 (
       qpdf "%%F" --pages 1,r1 -- "%%~dpnF-firstlast.%%~xF"
    )
  )
)

(完全未经测试,因为我只知道qpdf手册,我刚刚找到)

于 2019-01-25T11:24:41.433 回答