PDF Keywords - Comparing 2 PDFs and ignoring a string


#1

Hello,

I’m running a few tests with the PDF Keywords plugin. I need to compare 2 PDFs that are identical except for a key string that is unique to each PDF. I need to tell the instruction to ignore that key string and compare everything else.

These are the keys on each PDF:
MU1T_c3e2d840d4e4f1e34040404040404040d68a7449ebaf6966_QM2_PDF_FT.xml

MU2T_c3e2d840d4e4f2e34040404040404040d68a74ed33739706_QM2_PDF_FT.xml

Katalon allows me to use a parameter so I can exclude a certain pattern, like If I want to exclude the strings “1998” and “1999” it would be like this:

CustomKeywords.‘com.kms.katalon.keyword.pdf.PDF.compareAllPages’(path+ “test_text1.pdf”, **
** path+ “test_text2.pdf”, [‘1998’,‘1999’])

But I don’t know how to tell Katalon to exclude a 2 strings (whatever they are) that always end in “.xml”.

Any ideas on how to do this are much appreciated. Thank you.


#2

You could do something like this in the meantime :

String firstText = CustomKeywords.'com.kms.katalon.keyword.pdf.PDF.getTextFromPage'(path + "text1.pdf", 
    3)
String secondText = CustomKeywords.'com.kms.katalon.keyword.pdf.PDF.getTextFromPage'(path + "text2.pdf", 
    3)
String delXML1 = "MU1T_c3e2d840d4e4f1e34040404040404040d68a7449ebaf6966_QM2_PDF_FT.xml"
String delXML2 = "MU2T_c3e2d840d4e4f2e34040404040404040d68a74ed33739706_QM2_PDF_FT.xml"
firstText = firstText.replaceall(delXML1 )
secondText = secondText.replaceAll(delXML2)
firstText.compareTo(secondText)