-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not download as pdf when data is sent by post - Google Chrome #176
Comments
I am able to reproduce it. Changing the header before the ezStream seems to solve the issue but I'm not sure if that should be implemented as an internal fix in the library or should be something external.
Edit:
|
Hi Savioret |
Could you kindly send a simple example of a php POST script and the Pdf creation that you are doing, which reproduces the problem so I can test it locally ? |
/* The post variables are:
|
Sorry I cannot run that code. |
Dear Savioret Here it's a tiny sample. include ('../Cezpdf.php'); $pdf = new Cezpdf('a5','landscape'); $pdf->setLineStyle(.3); $pdf-> line( 28.3 , 380.635 , 577.32 , 380.635 ); $pdf->addText( 452.8 , 389.125 , 10 , "Any text" ); $pdf->ezStream(); |
did not you set the cache header as explained ? This is working for me. Please paste this in a single php file and try it. include ('../Cezpdf.php');
if ( $_SERVER['REQUEST_METHOD'] == 'POST') {
$pdf = new \Cezpdf('a5', 'landscape');
$pdf->setLineStyle(.3);
$pdf->line(28.3, 380.635, 577.32, 380.635);
$pdf->line(28.3, 362.24, 577.32, 362.24);
$pdf->addText(452.8, 389.125, 10, "Any text");
// set the cache control as explained above
header("Cache-Control: private");
$pdf->ezStream( );
}
else {
echo '<form method="POST">
<input type="submit" />
</form>';
} Remember that by default you will get the file downloaded as "file.pdf". If you need to specify another name use Content-Disposition $pdf->ezStream( ['Content-Disposition' => 'MyDesiredFilename.pdf']); |
I set the cache correctly and updated the version but still doesn't work for me |
Then you'll first need to work on solving that "provisional headers" problem, which seems a server side configuration problem, and not directly related with the library. |
Yes, it worked in incognito mode, but in the normal window it still remains, even after disabling all extensions |
It streams normally but when I click to download it saves a php file instead a pdf, it happens only in Chrome and when data is sent via post.
The text was updated successfully, but these errors were encountered: