Tuesday, January 21, 2014

How to split a PDF with spread pages to single pages

I recently bought a book that is not available as eBook.

As I wanted to take the book with me on my iPad I thought that I would digitize it and convert it to an eBook.

Ok. Sounds easy.
It is not.

First it it is not that easy to scan a complete book with around 330 pages.
But ok. That was doable. I used a Canon Multifunction Copier 'iR-ADV C5030'.

I scanned around 100 pages and sent the PDF as Email.

Now comes the interesting part.

I used Adobe Acrobat Pro version 10.1.9 do join the PDF.
No now I had a complete document of the book.

But wat, there's more.
The thing is that when scanning this way, I get a PDF that contains both the even and the odd page of a book on a singe page within the PDF.
This is not what I want.

So here's the trick:

The scan was quite precise. So I used the function 'Recognize Text > In this File'.
This not in order to get the text. What this function also does is rotate the scans so that the text is horizontal.
The next step was this: Save the PDF and make a copy of it. Open the copy and crop the pages so that only the even pages are left. Make another copy and crop it so that only the odd page numbers are left.
So OK. Now we have tow PDF files. One contains all pages with even page numbers, the other one contains all the pages with odd page numbers.
Fine. But now I need to merge these two files. Having used AppleScript a lot, I quickly came up with a script that does just that:

property pages_even : "scans_even.pdf"
property pages_odd : "scans_odd.pdf"

tell application "Adobe Acrobat Pro"

set c to number of pages in document pages_odd
repeat with i from 1 to c
set b to (i * 2 - 1) as integer
-- display dialog "inserting page " & i & " after " & b
insert pages document pages_even after b from document pages_odd starting with i number of pages 1
end repeat
end tell

This takes every page of the odd pages and inserts it in the right place in the even document.
This way I end up having a PDF that contains single pages instead of spread pages.


Søren Maarbjerg said...

OS X Yosemite 10.10.5
Adobe Acrobat X 10.1.16

Thanks a lot!
I had problems with file recognition.
This did the job for me:

tell application id "com.adobe.Acrobat.Pro"

set folder_XY to "/Users/myUserName/Downloads/"

set filename_X to "first.pdf"
set filename_Y to "second.pdf"

open folder_XY & filename_X
set X to document filename_X
set count_X to count pages of X

open folder_XY & filename_Y
set Y to document filename_Y
set count_Y to count pages of Y

set c to count_X
repeat with i from 1 to c
set b to (i * 2 - 1) as integer
insert pages Y after b from X starting with i number of pages 1
end repeat

close X saving yes
close Y saving yes

end tell

Eugen said...

Split multiple PDF files in a single processing
session. https://3steppdf.com/features-split.php