Re: I am looking for some python script to compare two files
Hello david,
[color=blue]
> The file can be PDF or Word format. Any help?[/color]
If just like to know if they differ you can compare their md5 signature (or
any other digital signature).
If you want a real diff then convert them to text.
* For PDF you can use pdftotext (comes with xpdf) or Acrobat COM object (if
you're on windows). There are also some commercial pdf2txt programs.
* For word you can use antiword and friends and again the word COM object
if you're on windows.
Re: I am looking for some python script to compare two files
On 8 Nov 2005 19:35:07 -0800, "david" <yongsheng.yang @gmail.com>
declaimed the following in comp.lang.pytho n:
[color=blue]
> hi:
>
> The file can be PDF or Word format. Any help?
>[/color]
Install an ASCII-only print driver
Print "to file" using this driver
Compare text files.
PDF is a variation of PostScript -- that is, the contents are a
specially optimized programming language for rendering text. The text
could be identical but all the code surrounding it could be different.
(I've seen PostScript drivers for word processors vary between passing a
single line of text to a function that then character spaced the text
for justification, vs another that computed starting locations for each
word, passing words to the rendering function).
Word documents, too, could "look" identical when printed, but be
completely different internally. Word files may have things like linked
sections as one has edited, and remnants of such things as unused style
tags.
Comment