View Full Version : Testing PDF viewer in browser

02-28-2012, 04:40 PM
The built in PDF viewer in Google Chrome does not support the Adobe function submitForm. Adobe Reader, Acrobat and Foxit reader do support submitForm. I did not test Safari's built in PDF viewer.

To test for this, I created a blank PDF file (called test.pdf - attached) that runs submitForm as soon as it opens and a PHP script (below) that returns "Ok" when it receives the file from the submitForm call. When I load test.pdf in Chrome, I just get a blank pdf file. When I load test.pdf in IE (which is using Adobe Reader) or Firefox (which is using Foxit Reader) I get an "0k".

What I don't know how to do is create a script that loads the test.pdf file. If it does not get the "0k", closes the page with test.pdf and warns the user. If it does get the "Ok", closes that page and loads the PDF form I want the user to see. Any ideas?

//echo "<script type='text/javascript'>alert('Really annoying pop-up!');</script>";
//Get the FDF Raw Data

$FDFData = file_get_contents('php://input');

//Check it to see if it is empty or too short
if ( strlen($FDFData)<10)
echo "An invalid file was received or only part of the file was received.<br>" ;

//Save file
$fdffp = fopen("test.fdf", "w");
fwrite($fdffp, $FDFData, strlen($FDFData)); //write into a file

//Test if file exists
if(file_exists ("test.fdf"))
echo "OK";
unlink("test.fdf"); //Delete file

return false;

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum