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
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • How To Get and Set PDF Form Fields in Java
  • A PDF Framework That Solves the Pain Points of Enterprise Development
  • How To Create and Edit PDF Annotations in Java
  • Alternatives to Handsontable and ag-Grid

Trending

  • Java Parallel GC Tuning
  • AWS vs. Azure vs. Google Cloud: Comparing the Top Cloud Providers
  • Reflections From a DBA
  • AWS Amplify: A Comprehensive Guide
  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.

NaveenKumar Namachivayam user avatar by
NaveenKumar Namachivayam
CORE ·
Dec. 12, 15 · Tutorial
Like (2)
Save
Tweet
Share
9.50K 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

  • How To Get and Set PDF Form Fields in Java
  • A PDF Framework That Solves the Pain Points of Enterprise Development
  • How To Create and Edit PDF Annotations in Java
  • Alternatives to Handsontable and ag-Grid

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • 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: