Comparison of two pdf files

前端 未结 4 1010
感动是毒
感动是毒 2020-12-16 19:49

I need to compare the contents of two almost similar files and highlight the dissimilar portions in the corresponding pdf file. Am using pdfbox. Please help me atleast with

4条回答
  •  余生分开走
    2020-12-16 20:13

    I had this very problem myself and the quickest way that I've found is to use PHP and its bindings for ImageMagick (Imagick).

    compareImages($im2, \Imagick::METRIC_MEANSQUAREERROR);
    
    if($result[1] > 0.0){
        // Files are DIFFERENT
    }
    else{
        // Files are IDENTICAL
    }
    
    $im1->destroy();
    $im2->destroy();
    

    Of course, you need to install the ImageMagick bindings first:

    sudo apt-get install php5-imagick # Ubuntu/Debian
    

提交回复
热议问题