Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ingesting:pdfw [2012/11/26 18:30]
giancarlo
ingesting:pdfw [2012/11/26 18:34]
giancarlo
Line 81: Line 81:
 </WRAP> </WRAP>
  
 +<WRAP prewrap center>
 +<code bash pdfatiff.sh>
 +#!/bin/bash
 +
 +bdir=$1
 +
 +SAVEIFS=$IFS
 +IFS=$(echo -en "\n\b")
 +for bookdir in $(find "$bdir/"openbess* -maxdepth 0 -type d );
 +do
 +   
 +   echo "$bookdir"
 +   n=0
 +   SAVEIFS=$IFS
 +   IFS=$(echo -en "\n\b")
 +   for nfile in $(find "$bookdir/"*.pdf -type f);
 +   do
 +      let "n += 1"
 +      filepdf="$nfile"
 +   done
 +   if [ $n -gt 1 ] || [ $n -lt 1 ]
 +   then
 +      echo "ERROR file PDF non unico"
 +      exit
 +   fi
 +   
 +   mkdir "$bookdir""/pdfs"
 +   cp "$filepdf" "$bookdir""/pdfs"
 +   cd "$bookdir""/pdfs"
 +   
 +   pdftk "$filepdf" burst output pg-%04d.pdf
 +   
 +   n=0
 +   SAVEIFS=$IFS
 +   IFS=$(echo -en "\n\b")
 +   for nfile in $(find pg-*.pdf -type f);
 +   do
 +      let "n += 1"
 +      sn=$(printf "%04d" $n)
 +      filepdf="$nfile"
 +      echo "$filepdf"" -> ""$sn.tif"
 +      
 +      pdftk "$filepdf" output "temp.pdf"
 +      
 +      # For PDF from image
 +      # convert -density 150 "temp.pdf" "$sn.tif"
 +      # For PDF from Word
 +      convert -background white -flatten -density 600 -resize 1200 -border 0.5% -bordercolor LightGray "temp.pdf" "../""$sn.tif"
 +      rm "temp.pdf"
 +   done
 +   cd ~/clineFC
 +   rm -R "$bookdir""/pdfs"
 +done
 +exit
 +</code>
 +</WRAP>
 +The script creates a single tif file for every pdf page (i.e. 0001.tif, 0002.tif, ...) in every book directory.
 +\\
 +\\
 +Book in now ready for ingesting.
  
 
 
ingesting/pdfw.txt ยท Last modified: 2012/11/26 18:34 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ ircres.cnr.it) and Anna Perin (anna.perin _@_ ircres.cnr.it)
DigiBess is licensed under: Creative Commons License
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki