Friday, November 5, 2010

Sterowniki Davicom Cnet Cn200 Pro

Compare the differences between two PDF documents (2)

few days ago I explained a simple bash script that allows you to perform a basic comparison between two PDF documents to look for differences. However, as I said, this script has many flaws because it is primarily differences in the text of two documents (if you are able to successfully extract the text from them). But there is a GUI program that allows a comparison to be more effective DiffPDF . This package is provided by the major distributions GNU / Linux, Debian, Ubuntu & Co. need to install the package diffpdf with Synaptic Package Manager or from the terminal with the usual command:
 sudo apt-get install diffpdf 
For other distributions refer your package manager.

The program can be started by the pitcher (in Ubuntu: Applications → Accessories → DiffPDF ) or from the terminal with the command
 diffpdf 
can be passed as arguments to the locations of files you want to compare:
 diffpdf / percorso/del/file1.pdf / percorso/del/file2.pdf 



Normally DiffPDF comparing the texts of the documents, but as you can see from screenshot below, you can also make a visual comparison between two documents, in order to search for differences between the images. To do this you must select Appearance Comparison drop down menu at the top right Mode and run a comparison with the Compare button located lower down, always on the right panel. This mode may provide false positives (as is proposed in the image) because it is no longer compared to only text, but the results are generally very good.



Anche qui propongo uno Script per Nautilus che permette di avviare DiffPDF con pochi clic selezionando i file che si desidera confrontare:
   #    !/bin/    bash     

titolo = "Confronta PDF"

function controlla() {
estensione =$( echo "$1" zenity - error - title =
"$ title" - text = "You must select two files with the extension \\." pdf \\ "." exit 1 esac



} if [$ #-ne 2];
then zenity - error - title =
"$ title" - text = "You must select two PDF files at a time. "


exit 1 fi
pdf1 = "$ 1"
pdf2
= "$ 2" controls
"$ pdf1" check & & "$ pdf2"
if [$? -Eq 0]; then diffpdf
"$ pdf1" "$ pdf2"
else # should not ever come here, to put safety
zenity - error - title = "$ title" - text = "There was an error."
exit 1 fi
exit 0 To use this script open a blank file with a text editor, copy the script editor and save it in the folder ~
/ .gnome2/nautilus-scripts (recall that the tilde ~
is an abbreviation of the folder current user's home) called, for example, " Compare PDF . Make the script executable
and so you can choose to compare two PDF files that are in the same folder and clicking the right button, choose Script
→ Compare PDF (or the name you gave to the script).

0 comments:

Post a Comment