Title: TCPDF_PARSER ERROR: Invalid PDF data: missing %PDF header.
Last modified: January 31, 2020

---

# TCPDF_PARSER ERROR: Invalid PDF data: missing %PDF header.

 *  Resolved [Firelight](https://wordpress.org/support/users/mdc2957/)
 * (@mdc2957)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/)
 * Just got strange email from a customer. He bought a downloadable file, which 
   is a zip file, not a PDF. So I’m not sure why this would happen, he reported 
   the following error:
 *     ```
       Unable to watermark this file for download. Please notify site administrator.
       TCPDF_PARSER ERROR: Invalid PDF data: missing %PDF header.
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12402353)
 * Hi [@mdc2957](https://wordpress.org/support/users/mdc2957/),
 * Sorry to hear that happened with a customer. However, this plugin watermarks **
   PDFs**. It does not unpack ZIP files. So of course you’re going to get an error.
 *  Thread Starter [Firelight](https://wordpress.org/support/users/mdc2957/)
 * (@mdc2957)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12404000)
 * ??? I think you read my post too quickly. He purchased a ZIP file for download,**
   not** a PDF file. As such, he shouldn’t be getting any error messages about watermarking
   from your plugin. What it appears is happening is your plugin is attempting to
   watermark a zip file. Does it make more sense now?
 *  Plugin Author [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12408236)
 * Hi again [@mdc2957](https://wordpress.org/support/users/mdc2957/)
 * That’s really strange because WaterWoo does checks to see if it should proceed
   on a download file. I’m wondering why your download would fail… assuming this
   file in question is named like “something.zip”…
 *     ```
       // PDF - watermarking - start by checking if it's even a PDF
       $file_extension = preg_replace( '/\?.*/', '', substr( strrchr( $file_path, '.' ), 1 ) );
       // Abort if not a PDF
       if ( ! strtolower( $file_extension ) == 'pdf' ) return $file_path;
       ```
   
 * What _is_ the file named?
 *  Thread Starter [Firelight](https://wordpress.org/support/users/mdc2957/)
 * (@mdc2957)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12408363)
 * I can’t remember the exact name, but it does indeed end in .zip extension.
    It
   was working fine as recently as Jan 31st I think. If the problem existed then,
   then the customer didn’t complain about it anyways.
 *  Plugin Author [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12410347)
 * [@mdc2957](https://wordpress.org/support/users/mdc2957/) I’d be really curious
   to know what the file name was in this case (and frankly can’t do much anyway
   without knowing) because honestly this is the first time since 2013 I’ve heard
   of this happening! Let me know if you remember.
 *  Thread Starter [Firelight](https://wordpress.org/support/users/mdc2957/)
 * (@mdc2957)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12411828)
 * Sure, I sent it to you privately via the pre-sales contact form on your website
 *  Plugin Author [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12411887)
 * [@mdc2957](https://wordpress.org/support/users/mdc2957/) Got it! Wrote you back
   via email.
 *  Plugin Author [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12419208)
 * [@mdc2957](https://wordpress.org/support/users/mdc2957/) Thanks to your kind 
   cooperation, version 2.5.1 is ready, and this issue should be fixed. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘TCPDF_PARSER ERROR: Invalid PDF data: missing %PDF header.’ is closed
to new replies.

 * ![](https://ps.w.org/waterwoo-pdf/assets/icon.svg?rev=3301838)
 * [PDF Ink Lite - Free PDF Watermark & Password Protection](https://wordpress.org/plugins/waterwoo-pdf/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/waterwoo-pdf/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/waterwoo-pdf/)
 * [Active Topics](https://wordpress.org/support/plugin/waterwoo-pdf/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/waterwoo-pdf/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/waterwoo-pdf/reviews/)

## Tags

 * [zip file](https://wordpress.org/support/topic-tag/zip-file/)

 * 8 replies
 * 2 participants
 * Last reply from: [Little Package](https://wordpress.org/support/users/littlepackage/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/tcpdf_parser-error-invalid-pdf-data-missing-pdf-header/#post-12419208)
 * Status: resolved