Ashwin Shetty
Ashwin Shetty

Reputation: 41

p:media with PDF file causes "File does not begin with '%PDF-'." error in IE7

I'm using <p:media> based on this question&answer: How to bind dynamic content using <p:media>?

It doesn't work in IE7 while it works fine Mozilla and Chrome. IE7 errors as:

File does not begin with '%PDF-'.

I understood it's because the file name for generated PDF is dynamiccontent.properties.xhtml. How do I change the file name? I tried passing the file name in DefaultStreamedContent constructor, but it had no effect.

Upvotes: 4

Views: 25802

Answers (1)

user6450763
user6450763

Reputation: 51

Sorry to necro-post but for those who are seeing this article, yes it can be a file name issue.

Acrobat products have historically opened a PDF as long as the %PDF-header started anywhere within the first 1024 bytes of the file. No checks were performed on the extraneous bytes before the %PDF-header. However, the 10.1.5 and 11.0.01 updates improve security by enforcing stricter parsing of the PDF-header. The product now refuses to open the small fraction of PDFs that do not correctly start with the '%PDF-' header.

You can disable the header validation on machines by setting the appropriate preference

If the AVGeneral key does not exist, create it manually.

The HKLM path is generically:

HKLM\Software\Adobe(product name)(version)\AVGeneral\bValidateBytesBeforeHeader=dword:00000000

For example, to change the behavior for Acrobat 11.0, create a DWORD at this location: HKLM\SOFTWARE\Adobe\Adobe Acrobat\11.0\AVGeneral\bValidateBytesBeforeHeader=dword:00000000

The HKCU path is generically:

HKCU\Software\Adobe(product name)(version)\AVGeneral\bValidateBytesBeforeHeader=dword:00000000

For example, to change the behavior for Reader 10.0, create a DWORD at this location: HKCU\SOFTWARE\Adobe\Acrobat Reader\10.0\AVGeneral\bValidateBytesBeforeHeader=dword:00000000

Always change the product and version number in the preference path to match your installation. This method allows the PDF to display on machines you control.

https://helpx.adobe.com/acrobat/kb/pdf-error-1015-11001-update.html

Upvotes: 5

Related Questions