Re: PDF pain
| From: | Michael Hall | Date: | Fri, 19 Jul 2002 15:11:08 +0000 |
| Subject: | Re: PDF pain | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108521@lists.php.net to get a copy of this message | ||
Thanks for all the suggestions. I am making progress after discovering a
typo in my code (single quotes in a header() string containing a $var ...
double quotes fixed it).
Now I get a pdf document but no text :-(
If I save the doc to disk and try to open it with xpdf, it complains that
the "xref table" is broken and that it can't find a "trailer dictionary".
???
Michael
On Fri, 19 Jul 2002, Jason Wong wrote:
> On Friday 19 July 2002 21:54, Michael Hall wrote:
> > I THINK I have installed pdflib and compiled it into PHP 4.2.1 OK.
> > At least, configure/make/make install all went OK and it is trying to
> > work.
> >
> > I copied the sample 'Hello World in PDF' script out of Programming PHP (p
> > 234) into a file named pdftest.pdf
>
> I think you want the name to be 'pdftest.php'. Try it and see what you get.
>
> > When I try to access http://localhost/pdftest.pdf,
> > Konqueror tries to open
> > a PDF file but then spits the dummy saying:
> >
> > "Could not open file
> > blahblah.pdf which has type application/x-zerosize. KGhostview can only
> > open Postscript and Portable Document Format files"
>
> That's because your 'pdf' file is in actual fact a raw php file.
>
> > So it looks like a header problem or something?
>
> No.
>
> > This raises a few other questions:
> >
> > - Should the PHP script be called pdftest.php or pdftest.pdf?
>
> The former.
>
> > - Does httpd.conf need an AddType directive for pdf files? I've tried a
> > few variations on "AddType application/x-pdf .pdf" etc
>
> No.
>
> > - Should .pdf be added to the php AddType directive?
> > eg. "AddType application/x-httpd-php .php .htm .pdf
>
> No.
>
> > Basically, I'm confused. Anyone been there done that?
>
> Yes.
>
>