PDF: автоматически удалять страницы 2 + 4, а затем склеивать обратно?

624
AP257

У меня есть несколько PDF-файлов, и для каждого из них я хотел бы удалить страницы 2 и 4, а затем снова склеить PDF. Есть ли умный способ сделать это с помощью утилиты командной строки?

3

3 ответа на вопрос

2
Werner

The PDF Toolkit can do this from the command line:

pdftk input.pdf cat 1 3 output output.pdf 

cat 1 3 extracts pages 1 and 3 from input.pdf and outputs it to output.pdf. To cycle through all on Windows, use

for %f in (*.pdf) do pdftk %f cat 1 3 output %~nfo.pdf 

%~nf returns an extension-less version of %f as extracted from the list *.pdf. Therefore, using %~nfo.pdf produces, as output, a file <input>o.pdf for input <input>.pdf. For using inside a batch file, use %%f and %%~nfo.pdf.

For more information, see the PDF Toolkit man page.

0
Tom Wijsman

PDF Split and Merge и, более конкретно, pdfsam-consoleупомянутые на этой странице, могут это сделать.

Обратите внимание, что это требует JRE. mbrownnyc 11 лет назад 0
0
user74264

Yes, from what you said, I think you can use a PDF Merger. How? You just offer the page range of your pdf file except for page 2 and 4. for example 1,3,5-last page number. Then merge them, thus you will get desired part and delete 2 and 4. Do as what I state! It's very easy to achieve!

you may try PDF Merger:

The PDF Merger is a professional but easy-to-use PDF file Combiner & Joiner designed to merge PDF files for more convenient organizing, archiving and printing in batch. It allows you to merge PDF according to your needs with many different merge modes. With it you are flexible to merge multiple PDF files to create a single one or merge specific pages to a new PDF file, even merge any pages of several different PDF files to one.

Похожие вопросы