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
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Google Cloud Document AI Basics
  • How to Convert Between PDF and TIFF in Java
  • Thumbnail Generator Microservice for PDF in Spring Boot
  • Python and Open-Source Libraries for Efficient PDF Management

Trending

  • FIPS 140-3: The Security Standard That Protects Our Federal Data
  • Developers Beware: Slopsquatting and Vibe Coding Can Increase Risk of AI-Powered Attacks
  • How To Develop a Truly Performant Mobile Application in 2025: A Case for Android
  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  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
10.7K 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, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Google Cloud Document AI Basics
  • How to Convert Between PDF and TIFF in Java
  • Thumbnail Generator Microservice for PDF in Spring Boot
  • Python and Open-Source Libraries for Efficient PDF Management

Partner Resources

×

Comments
Oops! Something Went Wrong

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

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

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 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!