# Merge pdfs to one

I have a set of pdfs in a folder, named: 1.pdf,2.pdf,3.pdf,...,20.pdf

Is it possible for mathematica to merge them to one pdf ? If yes, how ?

I had a look at this answer, but I don't really understand how to use it for my case: Combine multiple PDF files into one document

This is what I tried: I import the PDS:

pages = Import[ToString[#] <> ".pdf"] & /@ Range[20];


Then I use the code provided in the linked question:

Export["test.pdf",
CreateDocument[
Riffle[Join[pages, pages],
Cell["", "PageBreak", PageBreakBelow -> True]], Visible -> False]]


but the result is that the "comma" is still visible next to each pdf and the pdf pages have been shrinked down by quiet a lot. ... and instead of being 20 pages, it is now 40 pages, each pdf page was printed twice.

• This feels like one of those cases where you should be using something else (e.g. pdftk). – J. M. will be back soon Oct 27 '17 at 12:31
• @Kuba Please have a look at my updated question – james Oct 27 '17 at 12:48
• Riffle[ Join @@ pages, Cell["", "PageBreak", PageBreakBelow -> True]. Notice that original pages were from one pdf, you have an array. – Kuba Oct 27 '17 at 13:01
• @Kuba Thanks ! Now its 20 pages ! But it is still shrinked down, like in the image. – james Oct 27 '17 at 14:14
• you may try the accepted solution at mathematica.stackexchange.com/questions/31780/…, where the myList variable should be Flatten[pages] here – egwene sedai Oct 27 '17 at 16:17