I don't remember exactly but there is no change into the code itself.
Unzip php4.0.5 source code. Unzip www.php.net/extra/win32build.zip under php4.0.5/win32.
Add include and library (php4.0.5/win32/...) path in VisualC++6.
Add directory C:\usr... (I don't remember exactly) with a bison file.
compile php4.0.5/win32/php4ts.
For PDFLib, unzip the source code. Compile pdflib. Add the code for php into php4.0.5 tree. Add the library (php4ts.lib, pdflib.lib, zlib.lib, libpng.lib, libtiff.lib) under the php_pdf directory. Delete the call of _snprintf in a the last file compiled because of a problem of link.
Compile php_pdf.
Good luck.