Consider the following procedure:
1) Open a PDF file using the (Ubuntu) document viewer.
2) Goto File
3) Goto Print
4) Choose 'Print as file' and check the mark "pdf"
Yes, I am printing a PDF as PDF file. I have to do this for a large collection of files. I would like to do this running a script at the terminal.
Maybe you think that this procedure does not make any sense at all, but it actually was the only safe way I found to deal with the issue considered here. This StackOverflow question shows a problem with PDF files the EOF marker is not found. When I do the procedure described above, I am able to solve this problem [This is not the solution presented in StackOverflow site, which does not work here.]
I would like to this automatically with all files that present this issue.
I know that I should build one script (.sh) to this, but I do not know how to proceed.
An example of the PDF file (1) with problems is here
The corrected PDF file (2) is here
The only difference between them is that I opened the first using the "Ubuntu Document Viewer", I went to "File", "Print", "Print to File", "Output=pdf".
I want to make this automatically.
EDIT:
I do NOT want to merge the files.