Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

alternating pages

Discussions, questions, comments, ideas, and your projects having to do with DIY Book Scanner software. This includes the Stereo Data Maker software for the cameras, post-processing software, utilities, OCR packages, and so on.
Post Reply
tarakan114

alternating pages

Post by tarakan114 » 14 Dec 2011, 02:02

I ran across this kind of problem:
After I shoot all the pages, I use Fine reader 10 for OCR.
Than I end up with a PDF file that has all the left and all the right pages separately.
How do I intertwine those pages?
Is there any way to keep track of the page number in case I forget a page?

pav
Posts: 25
Joined: 05 Mar 2011, 17:41

Re: alternating pages

Post by pav » 21 Dec 2011, 14:57

Looks like a job for:
http://www.sheelapps.com/index.php?p=P ... ction=view

I have not tried it yet but from the description:
'Split PDF :
This option allows you to split a PDF file in multiple ways. You can split each page to new PDF, split even pages to new PDF, split odd pages to new PDF, split after given page number, split at every given page count or split a range of pages to new PDF file. '


and also:
Join PDFs :
This option allows you to create a PDF file by joining multiple PDF files.
and
Rearrange PDF :
This option allows you arrange pages in a PDF file. You can reverse all pages, copy multiple pages on single page or create handout style pages.
There is also:


http://www.paologios.com/products/?type=bin


Both freeware, the latter also Opensource.

Hope it helps.

pav
Posts: 25
Joined: 05 Mar 2011, 17:41

Re: alternating pages

Post by pav » 21 Dec 2011, 15:00

On a second thought may be a simpler solutin is to change the way you arrange or name your pictures files before you feed them to the OCR?

User avatar
dingodog
Posts: 106
Joined: 22 Jul 2010, 18:19
Number of books owned: 1000
Country: on the net
Location: on the net
Contact:

Re: alternating pages

Post by dingodog » 24 Dec 2011, 13:29

tarakan114 wrote:I ran across this kind of problem:
After I shoot all the pages, I use Fine reader 10 for OCR.
Than I end up with a PDF file that has all the left and all the right pages separately.
How do I intertwine those pages?
Is there any way to keep track of the page number in case I forget a page?
use my script in linux (it relies on pdftk)
http://pastebin.com/P9uc84Ya

your first pdf is pdf file with right pages (odd)
your second pdf is pdf file with left pages (even)

Code: Select all

#!/bin/sh
#script able to interleave the pages of two pdf files, saving the result in a new pdf file. Useful for any use, specially to mount parallel text books
echo "enter the name (with extension) of first PDF"
read filename1
echo "enter the name (with extension) of second PDF"
read filename2
pages1="`pdftk $filename1 dump_data output |grep Pages|cut -f2 -d :`"
pages2="`pdftk $filename2 dump_data output |grep Pages|cut -f2 -d :`"

if [ $pages1 -ge $pages2 ]
	then
	pagesincr="$(echo "scale=0; $pages2+1" |bc -l)"
echo "$filename1 has $pages1 pages"
echo "$filename2 has $pages2 pages"

rule="$(for x in $(seq 1 $pages2); do echo -n "A$x B$x ";  done; for x in $(seq $pagesincr $pages1); do echo -n "A$x ";done)"
	
		
	echo $rule
		
		elif
		[ $pages2 -ge $pages1 ]
			then
	pagesincr="$(echo "scale=0; $pages1+1" |bc -l)"

echo "$filename1 has $pages1 pages"
echo "$filename2 has $pages2 pages"

rule="$(for x in $(seq 1 $pages1); do echo -n "A$x B$x ";  done; for x in $(seq $pagesincr $pages2); do echo -n "B$x ";done)"

	
	echo $rule
				else
echo "$filename1 has $pages1 pages"
echo "$filename2 has $pages2 pages"

rule="$(for ((a=1, b=1; a <= $pages1, b <= $pages2 ; a++, b++)); do echo -n "A$a B$b "; done)"

echo $rule
fi

pdftk A=$filename1 B=$filename2 cat $rule output interleaved.pdf
echo "file created!"
exit 0

Post Reply