Merging PDF skipping corrupted PDF by command line

Question: Currently I am using some application to merge a list of PDF which are downloaded. The issue is if any one of the PDF is corrupted, it stops the merging of the rest of the PDF.Is there any command line application which I can use to skip the corrupted PDF and merge the others? I have also tested with other software but facing the same issue.Or is there any other command line based PDF merging utility that I can use for this? Is there any solution on VeryPDF?

Answer: When you need to merge PDF file by command line and skip corrupted PDF file, maybe you can have a free trial of PDF Split and Merge Command line version. This software either can be used as GUI version or command line. When encountering corrupted PDF file, this software will skip them automatically. When you need to merge file from list in text file, please use HTML Converter Command line by which you can name all the PDF file needed to be merged in a text file, then that software will merge files according to the list. Please check more information of those software on homepage, in the following part I will show you how to use software PDF Split and Merge Command line.

Step 1. Free download PDF Split-Merge Command Line

  • When downloading finishes, there will be an exe file. You need to install it by double clicking the exe.
  • When you use it as command line version, you need to go to the installation folder and then call the pdfpg.exe in MS Dos Windows.

Step 2. Merging PDF file by command line and skip corrupted files.

  • When using this software, please refer to the usage. Please call pdfpg.exe in MS Dos Windows and then press enter,  you will find all the parameters and examples.
  • Here are some examples and parameters for your reference:

    -mergeform   : merge two fillable PDF files together
    -crossmerge  : cross merge two PDF files together with compression
    -crossmerge2 : cross merge two PDF files together without compressio
    -getpagecount: retrieve page count from PDF file
    -addbookmark <int> : create bookmark to PDF file
         addbookmark 1: use short filename as bookmarks
    -set RetainBookmarks on/off: enable or disable bookmarks
    -set RetainAcroForms on/off: enable or disable AcroForms
    -----------------------------------
    Examples:
    pdfpg.exe C:\A.pdf,1,3 C:\merged.pdf
    pdfpg.exe C:\A.pdf,-20,50 C:\merged.pdf
    pdfpg.exe C:\A.pdf,1,3- C:\merged.pdf
    pdfpg.exe C:\A.pdf,1,2,3 C:\B.pdf,5,2,9 C:\merged.pdf
    pdfpg.exe C:\A.pdf,1,1-9 C:\B.pdf,5,2,9 C:\A.pdf,10 C:\merged.pdf
    pdfpg.exe C:\A.pdf,even C:\merged.pdf
    pdfpg.exe C:\A.pdf,odd C:\merged.pdf
    pdfpg.exe C:\A.pdf,reverse C:\merged.pdf
    pdfpg.exe C:\filelist.txt C:\merged.pdf

  • You can run following command line to combine two or more PDF files into one PDF file, pdfpg.exe will skip the corrupted PDF file automatically,

pdfpg.exe "C:\test\forms0001.pdf" "C:\test\forms0002.pdf" "C:\test\formmerged.pdf"

pdfpg.exe "C:\test\forms0001.pdf" "C:\test\forms0002.pdf" "C:\test\forms0003.pdf" "C:\test\formmerged.pdf"

pdfpg.exe "C:\test\forms0001.pdf" "C:\test\forms0002.pdf" "C:\test\forms0003.pdf" "C:\test\forms0004.pdf" "C:\test\formmerged.pdf"

If you wish merge more than 1000 PDF files into one PDF file, you can use a .txt file to do the merging, please by following steps to try,

1. Please run following command line to get a .txt file which contain the filenames for all of your PDF files,

dir C:\pdf\*.pdf /s/b > C:\files.txt

Note: you can adjust the order for files in C:\files.txt by manual.

2. Please run following command line merge these PDF files into one PDF file,

"C:\Program Files\PDF Split-Merge v3.0\pdfpg.exe" C:\files.txt  C:\out.pdf

The command line application is better than GUI version if you wish merge 1000+ PDF files into one PDF file. If there are some extremely corrupted PDF files in the file list, pdfpg.exe will skip these corrupted files automatically.

By this software and this method, you can definitely merge PDF by command line and skip corrupted ones. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in PDF Split-Merge and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!