Page 1 of 1

I have s problem with PDF

Posted: Wed Nov 02, 2005 7:08 am
by fastfingertips
I'm using ghostscript to merge 1 or more pdf files into a big one but when i'm trying to display the output i'm getting only
strange characters. I mention that the file is created and looks ok on server, but in browser is dust.

My code looks

Code: Select all

exec($createPdf);																			
$len = filesize($tmpfname);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=SelectedOrders".$_POST['pdfExt']);						
readfile($tmpfname);
unlink($tmpfname);
exit();

The output looks like:

[quote]
%PDF-1.3 %Çì

Posted: Wed Nov 02, 2005 7:17 am
by feyd
General Discussion is not for coding questions..

Moved to PHP - Code.

Posted: Thu Nov 03, 2005 1:16 am
by fastfingertips
Anyone any idea please?

Posted: Thu Nov 03, 2005 5:12 am
by Chris Corbyn
The correct file is created yes? But when it's downloaded like that in the browser it's failing? :? Unless the created file isn't PDF that looks right to me.

You haven't got some whitespace above that code have you? That could mess things up with your headers.

Posted: Thu Nov 03, 2005 5:18 am
by fastfingertips
I resolved.

In an included file (create by my team) someone inserted a space before php tag, and because of that
the header was changed to html. Since all my errors where disabled i had to make a research first :).

Posted: Thu Nov 03, 2005 5:22 am
by Chris Corbyn
Glad you got it sorted :D