DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Document Generation API: How to Automate Personalized Document Creation at Scale
  • Extracting Clean Excel Tables From PDFs Using Python + Docling
  • Web App Load Testing Using Maven Plugins for Apache JMeter, and Analyzing the Results
  • Why Whole-Document Sentiment Analysis Fails and How Section-Level Scoring Fixes It

Trending

  • 7 Technology Waves I’ve Seen in 30 Years of Software — Will AI Be the Next Real Transformation?
  • Implementing Secure API Gateways for Microservices Architecture
  • Getting Started With Agentic Workflows in Java and Quarkus
  • 5 Common Security Pitfalls in Serverless Architectures
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. How to Read a PDF File in Apache JMeter

How to Read a PDF File in Apache JMeter

In this article, I'll show you how to download and read a PDF file in Apache JMeter by simply creating custom requests.

By 
NaveenKumar Namachivayam user avatar
NaveenKumar Namachivayam
DZone Core CORE ·
Dec. 12, 15 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
11.0K Views

Join the DZone community and get the full member experience.

Join For Free

First, you need to understand how the application is designed (i.e. how the PDFs are getting loaded to the page). In most cases, PDFs load within iframe tags. But each request will generate unique PDFs. You need to capture which request generates the PDF in the page. This can be done using Fiddler or Developer Tools from the browser. I always use Google Developer Tools or IE Developer Tools.

Open the developer console in your browser and repeat the business actions. In my case, I saw one POST request which sent the session ID, auth ID, and some unique data. Its response was a PDF output. But, when I recorded it in JMeter, this particular request was not recorded.

Hence, I created a custom sampler in Apache JMeter and sent the data as generated in the developer tool. At last, I got the output below. By default, PDFs response will look like this.

PDF Output

PDF Output


It is not in a readable format. To download the whole PDF, you need to add the elements below to your test plan.

  1. Regular Expression Extractor is used to extract the complete response of the PDF. Use the following regular expression (?s)<^.*) which saves the complete response and save it to the variable pdfresponse:

Regular Expression Extractor

2. Save Responses to a file which saves the complete response as a file.

Now configure Save Responses to a file as shown below which will save the PDF to your JMETER_HOME\bin folder:

Save Responses to a file

Save Responses to a file

To read/parse contents from the document, you need to download the jar file from following URL http://www.apache.org/dyn/closer.cgi/tika/tika-app-1.11.jar.

PDF Apache JMeter

Published at DZone with permission of NaveenKumar Namachivayam. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Document Generation API: How to Automate Personalized Document Creation at Scale
  • Extracting Clean Excel Tables From PDFs Using Python + Docling
  • Web App Load Testing Using Maven Plugins for Apache JMeter, and Analyzing the Results
  • Why Whole-Document Sentiment Analysis Fails and How Section-Level Scoring Fixes It

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook