I'm using article2pdf and it can generate a pdf file which automaticly downloaded but there's error when open the pdf file, it says :
Couldn’t open the file. It may be corrupt or a file format that Preview doesn’t recognize.
Any help ?
Thanks
SOLVED :
it's because the webserver does not allow using readfile()
here is the code from article2pdf_getfile.php on about line 44
$tmpfile = $tmpdir . (substr( $tmpdir, -1 ) != '/' ? '/' : '') . 'a2p.tmp.' . $post_name . '.' . $tmprand . '.pdf';
if( file_exists( $tmpfile ) )
{
if( $_GET[ 'debug_pdf_file' ] != '1' )
{
header( "Content-Type: application/pdf" );
header( "Content-Disposition: attachment; filename=\"" . $post_name . ".pdf\"" );
}
//readfile( $tmpfile );
<strong>// replace with </strong>
echo file_get_contents($tmpfile);
unlink( $tmpfile );
}
else die( 'Sorry no pdf tempfile found. Please try again.' );
Hope it helps other
This topic has been closed to new replies.