Does Content-Encoding effect any PDF generation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Does Content-Encoding effect any PDF generation

Post by dude81 »

Hi all,

I'm facing this problem, I'm trying to download PDF generated dynamically from the server.

When I say

Code: Select all

header('Content-type: application/pdf');
 header('Content-Disposition: attachment; filename="abcd.pdf"');
 echo $pdf->render();
All it does is it generates the pdf content but it doesnt go to the client (browser) as a save/Open abcd.pdf
When I see the headers I see the gzip compression happening . Will this effect the pdf generation??

Code: Select all

HTTP/1.x 200 OK
Date: Tue, 17 Jul 2007 09:58:25 GMT
Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.2
X-Powered-By: PHP/5.2.2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
content-disposition: attachment; filename="abcd.pdf"
Content-Encoding: gzip
Content-Transfer-Encoding: binary
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/pdf
Can somebody help in what I've to do. I'm using Zend Framework PDF
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Does Content-Encoding effect any PDF generation

Post by volka »

dude81 wrote:All it does is it generates the pdf content but it doesnt go to the client (browser) as a save/Open abcd.pdf
Then where does it go and how do you know?
When I see the headers I see the gzip compression happening . Will this effect the pdf generation??
No, the http response is always encoded in some way. This time it is gzip compressed. Doesn't matter.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

It saves on server(this is beacase I use on save function to do that). I also use an Ajax Framework, may be this is not allowing it to generate
Post Reply