2
$\begingroup$

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.

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.