Reputation: 19
How to extract the text/content of a pdf file using JSR223 PreProcessor in JMeter?
Upvotes: 0
Views: 182
Reputation: 168072
You will need a library like PDFBox for this
Add it and all its dependencies to JMeter Classpath
Restart JMeter to pick the .jars up
The simplest code to read text from PDF would be something like:
def doc = org.apache.pdfbox.pdmodel.PDDocument.load(new File('path-to-the-file.pdf'))
def text = new org.apache.pdfbox.text.PDFTextStripper().getText(doc)
//now do what you need with the text, i.e. save it into ${text} JMeter variable
vars.put('text', text)
More information:
Upvotes: 0