Can PDF Have Viruses? (Everything You Need to Know)

Reading time: 8 min read
Harsha Kiran
Written by
Harsha Kiran

Updated · Oct 25, 2023

Harsha Kiran
Founder | Joined March 2023 | LinkedIn
Harsha Kiran

Harsha Kiran is the founder and innovator of He started it as a personal passion proje... | See full bio

Florence Desiata
Edited by
Florence Desiata


Florence Desiata
Joined June 2023 | LinkedIn
Florence Desiata

Florence is a dedicated wordsmith on a mission to make technology-related topics easy-to-understand.... | See full bio

Techjury is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more.

Computer viruses are so widespread that they can be in all file types. This includes everyone’s favorite file format—Portable Document Format (PDF). 

Many users prefer PDF for its flexibility, convenience, and compatibility. In 2021, PDF is the 3rd most popular file format on the web.

One common mistake users have is they think PDF files are all safe and virus-free. For this reason, hackers use the format as a tool to spread malware and cause cyberattacks.

If you use PDF files, you must understand how PDF viruses work and what you can do about them. Read on. 

🔑 Key Takeaways

  • PDFs can carry viruses through codes, dynamic content, hyperlinks, encrypted objects, and system commands.
  • Infected PDFs can lead to DoS attacks, information disclosure, and remote code execution—endangering devices and personal data.
  • Use built-in or dedicated PDF virus scanners to identify and remove malware.
  • Reduce risk by updating PDF readers, disabling JavaScript, keeping systems updated, and being cautious with emails and websites.

Viruses in PDFs: How Do They Work?

Computer viruses attach themselves to PDFs through embedded codes. These codes make the PDF files workable for signing and editing.

JavaScript is an effective tool for creating editable PDF files. However, hackers use JavaScript to inject viruses. As a result, the editable PDF can contain viruses.

Take a look at how you can add JavaScript to a PDF:

Adding JavaScript to a PDF Document

There are other ways viruses attach themselves to PDFs. Take a closer look at how PDFs can contain viruses.

1. Multimedia Content

PDF files usually have multimedia content like pictures, videos, or audio to provide more context. However, attackers can embed viruses in the media content in the PDF file.

It is normal to find links in PDFs. Hyperlinks help users access more data besides the content on the file. The downside is these links can redirect users to pages that contain viruses. 

3. Encrypted Object

Some PDFs have embedded and encrypted objects. You’ll usually see them in files with dynamic or clickable content.

Viruses can use an encrypted object to hide from scanners, making them undetectable. A PDF file virus is activated once a user opens the file and decrypts the content.

4. System Command

PDF files contain code instructing the user's computer to execute specific commands. This command causes the PDF files to open and run. 

When a user opens a virus-infected PDF file, the malicious code compromises the device's operating system.

👍 Helpful Article

Besides viruses, cyberattackers can also embed other types of malicious software in PDF files. Learning about the various kinds can help you stay safe and avoid potential harm brought by each kind.

Dangers of Infected PDFs

Depending on the virus attached to the PDF, the damage can be minor to severe. Here are some dangerous effects that PDF malware can do:

Risks of Infected PDFs

1. Denial of Service (DoS)

DoS is a cyberattack that can shut down or disrupt a network. 

It interrupts data flow into and out of a system, making it inaccessible for some time. A DoS attack can also cause data loss.

When users open an infected PDF file, the PDF viewer freezes or disrupts the system.  Then, the virus freezes and takes control of your device. 

2. Information Disclosure

When opened, infected PDF files allow hackers to access important information. These cyberattackers reveal or leak all kinds of information about the victim. 

Revealing sensitive information can lead to identity theft or financial loss (if they gain access to your bank details). 

💡 Did You Know?

Cybercriminals in the US have exposed the personal information of 47% of Americans. This only shows how data is vulnerable when it comes to cyberattacks.  

3. Remote Code Execution

This happens when a user opens a malicious PDF file that can run a command to inject malware into the device. This allows attackers to control your device remotely—compromising your safety and privacy.

If you’re planning to open a file from a questionable source, it is important that you know how to check if a PDF has a virus.

Learn how to scan files for viruses in the next section. 

Scanning PDFs for Viruses

Checking a PDF file for viruses is manageable with the right tool. You can do it with built-in software or a professional PDF file virus scanner

Windows and Mac have built-in antivirus software that can scan these files. To check a PDF with built-in software:

1. Right-click the PDF file.

2. Scan the file with the selected built-in software.

PDF File Action options

3. Select "Custom Scan," then click Scan.

Virus Scanning Options on Windows

4. Wait for the result.

While your device’s built-in scanner is helpful, it is not super reliable. Built-in scanners often miss a lot of potential online threats.

In that case, you may want to consider getting PDF file virus scanners. To scan a PDF with an antivirus PDF scanner, follow the steps below:

1. Open the antivirus app and launch the file scanner. 

2. Drag and drop the PDF file to the file scanning window. 

Dragging and dropping a PDF file in the PDF Scanner

3. Wait for the scan to be completed. 

4. Once done, the scanner will provide results. Start deleting malware if the tool detects anything. 

Example of an Antivirus Scan Result

Top Antivirus Software

You can find many antivirus tools to are capable of removing malicious PDF files. Here are three of the best tools to help you avoid PDF file viruses:

1. Norton

Norton has been a popular antivirus software since 1991. Being on the market for over 30 years, Norton Antivirus has a good reputation and user reviews.

Norton Antivirus Homepage

It offers complete protection against computer viruses and malware. Norton also comes with a VPN, password manager, firewall, parental control, and a cloud backup.

The price of a Norton subscription varies, depending on the needs of the user. A Norton basic plan starts at $19.99 for the first year for a single device.

2. McAfee

McAfee is an antivirus app with real-time malware detection and online threat protection. It also features WiFi security, password management, PC optimization, and more.

McAfee Antivirus Software

The most basic plan for McAfee costs $39.99 for the first year. It only offers annual plans, meaning no monthly options. 

However, you can also try McAfee’s 30-day free trial to see if it works for you. 

3. Avast

With more than 435 million active users, Avast is one of the most popular antivirus apps today. It is compatible with Mac, Windows, Android, and iOS devices.

Avast Antivirus App

This tool provides an all-in-one service with malware and virus protection for only $50.28 in the first year. This plan is suitable for five devices. 

Avast has a wide range of plans and prices, which users can choose from depending on their needs. 

Protect Yourself from PDF Viruses

While it is easy to detect and remove PDF viruses, there is no foolproof method to guarantee protection against them. However, the best thing that you can do is to avoid potential threats.

To reduce threats from PDF viruses, take note of the following best practices: 

1. Update Your PDF Reader

Software updates are essential to improve application functionality and vulnerability patching. 

Using an updated PDF reader ensures that you’re using the tool’s best functions and that you’re protected against malware.  

🎉 Fun Fact

Adobe launched the first PDF file on June 15, 1993. It came with Version 1.0 of Adobe Acrobat, the first program ever to read a PDF file. 

2. Disabling JavaScript When Reading PDF Files

JavaScript is the most common tool for creating dynamic websites and apps. Around 97.8% of all dynamic content is JavaScript-based

Besides its support for dynamic data, it is also considered the best tool for workable PDF files. 

However, since JavaScript can carry a virus, deactivating it when you open PDFs from untrusted sources is best. Here’s how you can do that:

In Google Chrome

  1. Go to Settings.
  2. Select Privacy and Security > Site Settings. 
  3. Choose JavaScript.
  4. Set the default behavior to Don't allow sites to use JavaScript.

In PDF Reader

  1. Launch Acrobat or Adobe Reader.
  2. Select Edit, then click Preferences.
  3. Choose the JavaScript category. 
  4. Uncheck the Enable Acrobat JavaScript option.

3. Updating All Systems

PDF readers are not the only software susceptible to malware attacks. The rest of your system can also get infected. 

Thus, you should update your system regularly. System updates can strengthen your device's protection from potential threats.

Security measures in browsers and PDF readers may or may not work. Sometimes, antivirus apps also can't detect malware before opening a PDF.

Operating systems can be vulnerable to threats and malware attacks when this happens. That’s why it is best to keep your systems updated for more protection. 

✅ Pro Tip

Make sure your device’s firewall is also switched on all the time. Firewalls filter all incoming and outgoing data, so they serve as another layer of protection against PDF viruses.  

4. Using a Legitimate PDF Reader

Always use a legitimate PDF reader for a secure experience. Legitimate PDF readers regularly update and follow protocols for viewing and using PDFs.

Here are online and offline PDF readers that you can use:  

  • Adobe Acrobat Reader
  • Nitro PDF Reader
  • UPDF
  • Xodo PDF Reader & Editor
  • Microsoft PDF Reader
  • Foxit Reader
  • Google PDF Viewer

5. Avoiding Malicious Emails and Websites

Do not interact with sketchy websites or open emails from unknown sources. Malicious websites can trick users into downloading PDF files infected with PDF malware.

Email attachments, when opened, can also infect your computer with malware. It can even cause damage, lock user access, and steal data.

🔓 Security Note

Most malicious emails containing virus-infected PDFs are spam. With over 60 billion spam emails sent daily, you’re prone to receive a few. 

Avoid opening and engaging with spam emails to stay safe.


PDF files are one of the most common document file types today. Due to widespread use, cybercriminals see these files as an opportunity for cyberattacks. 

Detecting and removing PDF viruses is easy with the help of  PDF virus scanners which are available in most antivirus software. 

However, the best thing to do in order to stay safe is to be cautious when opening PDF files—whether they are from trusted sources or not.


Does Google Drive scan for viruses?

Yes. Google Drive scans for viruses and malware to avoid downloading infected files. 

Can EPUB files have viruses?

Yes. EPUB files can contain viruses. Like PDF files, EPUB files can include multimedia content and JavaScript. These content types can carry and spread viruses and other types of malware.

Does printing PDF remove a virus?

No. Since printing PDFs only captures a website's image, it does not involve any code. PDFs can contain viruses if there are codes included in them.

How do I know if a PDF is secure?

To know if a PDF file is secure, open the PDF document with Adobe Reader. Check the file's status. If it says "secured," then the file is safe.


Facebook LinkedIn Twitter
Leave your comment

Your email address will not be published.