Sunday 15 March 2015

Content-Type PDF in PHP, not encoded properly -



Content-Type PDF in PHP, not encoded properly -

i'm creating pdf file in php:

header("content-type: application/pdf"); header("content-disposition: attachment; filename=\"file.pdf\""); echo "hello";

the downloaded file.pdf not able open. says "adobe reader not open file because either not supported file type or because file has been damaged (for example, sent email attachment , wasn't correctly decoded)".

but when opening file text editor, "hello" there within file. looks if it's not encoded correctly pdf. help please?

you can't echo out string , expect correctly formatted pdf file, "like that".

you need pdf generation. here related questions:

php pdf generator advice php create pdf invoice generating pdfs php

php pdf pdf-generation content-type

No comments:

Post a Comment