Last updated: September 2025
The PDF Utility plugin provides 14 custom keywords that allow testers to work with PDF documents in various ways. You can extract and compare content, save pages as images, and perform other tasks within automated test cases.
Here's how to perform PDF testing in Katalon Studio using the PDF Utility plugin:
- Open Katalon Studio and create a new project. See Create a test project in Katalon Studio.
- Place the PDF files you want to test in the
Data Files directory of your project.For example, you can put your PDF files in the following location: <Your Project Folder>/Data Files/
- Create a new test case. See Create a new test case in Katalon Studio.
- In the new test case, switch to the Script tab, use the sample code below to enable the plugin:
import com.kms.katalon.core.util.KeywordUtil as KeywordUtil
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import internal.GlobalVariable as GlobalVariable
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
// To specify the path to data files
String path = RunConfiguration.getProjectDir() + '/Data Files/'
- Apply custom keywords to work with PDF files in your test cases.
In the example below, we use the getPageNumber custom keyword to get the total number of pages in a PDF document.
import com.kms.katalon.core.util.KeywordUtil as KeywordUtil
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import internal.GlobalVariable as GlobalVariable
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
// To specify the path to data files
String path = RunConfiguration.getProjectDir() + '/Data Files/'
// Get the total number of pages in a PDF document
CustomKeywords.'com.kms.katalon.keyword.pdf.PDF.getPageNumber'(path + 'test_text1.pdf')
- Run the test case by selecting the Run button in the toolbar.
In the Log Viewer tab, you can see the PDF-related actions and the outcomes generated by the custom keywords in your test case.