How to get markFailed when "PDF content does not match"


I am comparing 2 pdf files with com.kms.katalon.keyword.pdf.PDF.compareAllPages, hence,
the output in the log when the files are different writes: “PDF content does not match”, But the test step is still Passed, because the process is performing properly, of course.

how can I add someting like markFailed based on the output value or any other way to validate in order to make the test case fail when I get “PDF content does not match”.

this is how I am calling the function:
CustomKeywords.‘com.kms.katalon.keyword.pdf.PDF.compareAllPages’(path+ “myPDF.pdf”, mySecondPDF,null)

From the documentation for that method:

“To compare all the pages of the PDF files. By default as soon as a mismatch is found, the method returns false and exits.”

So you could do something like:

assert CustomKeywords.‘com.kms.katalon.keyword.pdf.PDF.compareAllPages’(path+ “myPDF.pdf”, mySecondPDF,null)