Saturday, November 12, 2016

Replacing non consecutive pages from one (InDesign exported) pdf file to another


From single document in InDesign I export 2 pdf files.


First pdf file contains all pages as grayscale, second pdf document contains only colour pages. Color pages pdf document carries information about page numbers.


How can I automatically replace relevant grayscale pages in first PDF document with respective colour pages from second PDF document?


Example:




  • 1st exported PDF document has 100 grayscale pages.

  • 2nd PDF document has color pages i.e.: 5,8,52,68,90.


I want to put these color pages from second PDF document into the first PDF document at once, by replacing the respective grayscale pages in it.



Answer



Thanks a lot to everyone who tried to find solution of my problem. Special thanks to @13ruce advice I found very nice and simple solution.


I use PDF Toolkit server and its feature of combining two files into the third one.


The general PDFTK string is:


pdftk K=black.pdf C=color.pdf cat K1-2 C3 C4 C5 C6 C7 C8 C9 C10 K11 K12 output out.pdf


In this example the output.pdf will contain pages 1-2 from black.pdf, pages 3-10 from color.pdf and again pages 11-12 from black.pdf.


The only time consuming thing can be writing this string, especially, when the color pages are randomly distributed over the whole range of pages. That is why I programmed a simple utility in MS Excel, using VBA macro, that automatically creates this string. You can download it free.


It looks like this:


enter image description here


Here are some instructions:


After opening xlsm file, macros need to be allowed. Insert Total pages in document (cell B1). Define which pages will be replaced by color ones (cell B2). The last defined color page must be lower or equal the total pages. Color pages must be comma separated, without space. In defining the page range dashes are not allowed in this version. Press Create PDTK String and the PDFTK String will be written into cell B4.


If you have PDFTK server installed, you can use Total Commander to run PDFTK string. Just open it in the subfolder when your processed files are and insert PDFTK string into Command window of Total Commander. See the next picture.


black.pdf document contains all the document pages as black (grayscale), color.pdf document contains the same pages as color, out.pdf document contains all the black pages but pages defined in cell B2 are replaced by color ones.


I hope it will be helpful for someone. Feel free to give me ideas for improvements.



enter image description here


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...