Rants and raves on (mostly) technology
13 Feb
I got this error trying to use the PDF functions in PHP 5.2 on Windows:
PDFlib exception (fatal): [1202] PDF_set_parameter: Unknown key ‘objorient’
The problem seems to be with the bundled PDF extension (php_pdf.dll) that comes with PHP 5.2 – it’s a version 5 of the PDFlib. But upgrading to version 6 solved the problem for me.
So the following describes the steps that I took to fix it…
Download the Windows version of PDFlib 6 for “C, C++, Java, PHP”:
http://www.pdflib.com/binaries/PDFlib/604/PDFlib-6.0.4-Windows.zip
You may want to check this page for an updated version of 6 that is higher than 6.0.4:
http://www.pdflib.com/download/pdflib-family/pdflib-6/
Unzip the file and copy “bind\php5\php-520\libpdf_php.dll” to your PHP extension directory (e.g., C:\Program Files\PHP\ext).
Edit your “php.ini” file by commenting out the default PDF extension and adding the new one:
[PHP_PDF]
;extension=php_pdf.dll
extension=libpdf_php.dll
Restart Apache.
In your phpinfo() page, you should see:
PDF Support: enabled
PDFlib GmbH Binary-Version: 6.0.4
PECL Version: 2.0.5
Revision: $Revision: 1.55.2.20 $
Unfortunately, this new PDFlib is a trial version that adds a watermark to all the generated PDFs. So you’ll need to purchase a license and install your key.
A free PDFlib Lite version is available, but you’ll have to compile it yourself.
To install your PDFlib license, you can do the following:
To set the license in your PHP code at runtime, set the license parameter (with your own registration key):
$p = new PDFlib();
$p->set_parameter( “license”, “X600605-009100-45432E-D1E2B4″ );
If you’re using the dompdf library (0.5.1) with CodeIgniter like me, add your key in the “system\plugins\dompdf\dompdf_config.inc.php” file:
#define(”DOMPDF_PDFLIB_LICENSE”, “your license key here”);
define(”DOMPDF_PDFLIB_LICENSE”, “X600605-009100-45432E-D1E2B4″);
If you want to set it globally, create a “licensekeys.txt” under “C:\Program Files\PDFlib”:
PDFlib license file 1.0
# This is a license file template for PDFlib GmbH products.
# You can accumulate multiple CPU keys here (line by line).
# Replace the 0 in the third column with your actual license key.#PDFlib 6.0.4 0
PDFlib 6.0.4 X600605-009100-45432E-D1E2B4
Set the system environment variable (under Control Panel > System > Advanced > Environment Variables):
PDFLIBLICENSEFILE=C:\Program Files\PDFlib\licensekeys.txt
You can also set it in the Registry. I didn’t try this, but this page has more instructions:
http://www.pdflib.com/pdflib-cookbook/general-programming/license-key/
That should do it. Now create a sample PDF with PHP. See these pages for examples:
http://ca.php.net/manual/en/ref.pdf.php
http://www.digitaljunkies.ca/dompdf/usage.php
I hope that helps.
5 Nov
I’m one of those reluctant users of Windows Vista…and the other day it gave me something else to gripe about besides the UAC. I powered on my trusty laptop and tried to delete a bunch of files. Normally, this is a simple task of holding down they Ctrl key while you click on the files. But for some reason, it wasn’t working…I even tried Ctrl-A to “Select All” files. No luck! ![]()
After doing a bit of research, I found out this problem occurs because certain applications add a “rogue” key to the registry, which prevents you from selecting multiple items in Windows Explorer.
One solution is to use the “Reset Folders” command under Organize -> Folder and Search Options -> View, but I found that my problem had perpetuated to other folders. So a more brute force solution is to delete something called “Bags” in the registry.
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags
Apparently, “Bags” stores the user’s view state for each folder. So if you delete it, Vista will re-create it when you login again.
1 Oct
With the increased security in Windows Vista, installing server applications can be a pain compared to XP/2000/2003. But here’s a quick solution:
msiexec /i apache*.msi
where, apache*.msi is the name of the actual file. Tip: press Tab after “apache” to use the auto-complete feature. Then continue the setup as you normally would.
msiexec /i php*.msi
29 Aug
The preview feature in Windows Explorer is neat until you need to perform file management tasks on AVI files like deleting, renaming, or moving. You’ll often get “access denied” messages if you don’t let Windows finish its scan. So to remove this annoying feature, you can run these commands from a Command Prompt (Start -> Run, type in ‘cmd’ hit enter) to remove image and media preview:
regsvr32 /u shimgvw.dll
regsvr32 /u shmedia.dll
Of course, if you need to re-enable image and media preview, use these commands:
regsvr32 shimgvw.dll
regsvr32 shmedia.dll